Merge "TagLogFormatter: For log entries changing both revid and logid tags, prefer...
[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 # FIXME: The output seems broken. Filed as T110268.
6338 !! test
6339 ! and || in td attributes should not be parsed as <th>/<td>
6340 !! options
6341 parsoid=wt2html
6342 !! wikitext
6343 {|
6344 | style="color: red !important;" data-contrived="put this here ||" | foo
6345 |}
6346 !! html/php
6347 <table>
6348 <tr>
6349 <td> style="color: red !important;" data-contrived="put this here </td>
6350 <td> foo
6351 </td></tr></table>
6352
6353 !! html/parsoid
6354 <table>
6355 <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>
6356 </tbody></table>
6357 !! end
6358
6359 !! test
6360 Indented table markup mixed with indented pre content (proposed in bug 6200)
6361 !! wikitext
6362 <table>
6363 <tr>
6364 <td>
6365 Text that should be rendered preformatted
6366 </td>
6367 </tr>
6368 </table>
6369 !! html
6370 <table>
6371 <tr>
6372 <td>
6373 <pre>Text that should be rendered preformatted
6374 </pre>
6375 </td>
6376 </tr>
6377 </table>
6378
6379 !! end
6380
6381 !! test
6382 1. Template-generated table cell attributes and cell content
6383 !! wikitext
6384 {|
6385 |{{table_attribs}}
6386 | {{table_attribs}}
6387 || {{table_attribs_5}}
6388 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6389 |align=center {{table_attribs}}
6390 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6391 |}
6392 !! html
6393 <table>
6394 <tr>
6395 <td style="color:red;">Foo
6396 </td>
6397 <td style="color:red;">Foo
6398 </td>
6399 <td> style="color:red;"</td>
6400 <td>Bar
6401 </td>
6402 <td style="color:red;">Foo
6403 </td>
6404 <td align="center" style="color:red;">Foo
6405 </td>
6406 <td align="center" style="color:red;">Foo
6407 </td></tr></table>
6408
6409 !! end
6410
6411 !! test
6412 2. Template-generated table cell attributes and cell content
6413 !! wikitext
6414 {|
6415 |{{table_attribs_2}}
6416 |}
6417 !! html/php
6418 <table>
6419 <tr>
6420 <td style="color:red;">Foo
6421 </td>
6422 <td>Bar</td>
6423 <td>Baz
6424 </td></tr></table>
6425
6426 !! html/parsoid
6427 <table>
6428 <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>
6429 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6430 </tbody></table>
6431 !! end
6432
6433 !! test
6434 3. Template-generated table cell attributes and cell content
6435 !! wikitext
6436 {|
6437 !align=center {{table_header_cells}}
6438 |-
6439 |align=center {{table_cells}}
6440 |}
6441 !! html/php
6442 <table>
6443 <tr>
6444 <th align="center" style="color:red;">Foo</th>
6445 <th style="color:red;"><i>Bar</i></th>
6446 <th style="color:brown;"><i>Foo</i> and Baz
6447 </th></tr>
6448 <tr>
6449 <td align="center" style="color:red;">Foo</td>
6450 <td style="color:red;"><i>Bar</i></td>
6451 <td style="color:brown;"><i>Foo</i> and Baz
6452 </td></tr></table>
6453
6454 !! html/parsoid
6455 <table>
6456 <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>
6457 <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>
6458 </tbody></table>
6459 !! end
6460
6461 !! test
6462 4. Template-generated table cell attributes and cell content inside a templated table
6463 !! wikitext
6464 {{tbl-start}}
6465 !align=center {{table_header_cells}}
6466 |-
6467 |align=center {{table_cells}}
6468 {{tbl-end}}
6469 !! html/php
6470 <table>
6471 <tr>
6472 <th align="center" style="color:red;">Foo</th>
6473 <th style="color:red;"><i>Bar</i></th>
6474 <th style="color:brown;"><i>Foo</i> and Baz
6475 </th></tr>
6476 <tr>
6477 <td align="center" style="color:red;">Foo</td>
6478 <td style="color:red;"><i>Bar</i></td>
6479 <td style="color:brown;"><i>Foo</i> and Baz
6480 </td></tr></table>
6481
6482 !! html/parsoid
6483 <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}}]}'>
6484 <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>
6485 <tr>
6486 <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>
6487 </tbody></table>
6488 !! end
6489
6490 ## Edge case fix to prevent future regressions
6491 !! test
6492 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6493 !! wikitext
6494 {|
6495 |{{table_attribs_7}}
6496 |}
6497 <references />
6498 !! html/parsoid
6499 <table>
6500 <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>
6501 </tbody></table>
6502 <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>
6503 !! end
6504
6505 !! test
6506 Table with row followed by newlines and table heading
6507 !! wikitext
6508 {|
6509 |-
6510
6511 ! foo
6512 |}
6513 !! html
6514 <table>
6515
6516
6517 <tr>
6518 <th> foo
6519 </th></tr></table>
6520
6521 !! end
6522
6523 !! test
6524 Table with empty line following the start tag
6525 !! wikitext
6526 {|
6527
6528 |-
6529 | foo
6530 |}
6531 !! html
6532 <table>
6533
6534
6535 <tr>
6536 <td> foo
6537 </td></tr></table>
6538
6539 !! end
6540
6541 # FIXME: Preserve the attribute properly (with an empty string as value) in
6542 # the PHP parser. Parsoid implements the behavior below.
6543 !! test
6544 Table attributes with empty value
6545 !! wikitext
6546 {|
6547 | style=| hello
6548 |}
6549 !! html/parsoid
6550 <table>
6551 <tbody>
6552 <tr>
6553 <td style=""> hello
6554 </td></tr></tbody></table>
6555
6556 !! end
6557
6558 !! test
6559 Wikitext table with a lot of comments
6560 !! wikitext
6561 {|
6562 <!-- c0 -->
6563 | foo
6564 <!-- c1 -->
6565 |-<!-- c2 -->
6566 <!-- c3 -->
6567 |<!-- c4 -->
6568 <!-- c5 -->
6569 |}
6570 !! html
6571 <table>
6572 <tr>
6573 <td> foo
6574 </td></tr>
6575 <tr>
6576 <td>
6577 </td></tr></table>
6578
6579 !! end
6580
6581 !! test
6582 Wikitext table comments represented in parsoid dom
6583 !! wikitext
6584 {|<!--c1--><!--c2-->
6585 |-<!--c3-->
6586 | x
6587 |}
6588 !! html/php+tidy
6589 <table>
6590 <tr>
6591 <td>x</td>
6592 </tr>
6593 </table>
6594 !! html/parsoid
6595 <table><!--c1--><!--c2-->
6596 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6597 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6598 </tbody></table>
6599 !! end
6600
6601 !! test
6602 Wikitext table with double-line table cell
6603 !! wikitext
6604 {|
6605 |a
6606 b
6607 |}
6608 !! html
6609 <table>
6610 <tr>
6611 <td>a
6612 <p>b
6613 </p>
6614 </td></tr></table>
6615
6616 !! end
6617
6618 !! test
6619 Table cell with a single comment
6620 !! wikitext
6621 {|
6622 | <!-- c1 -->
6623 | a
6624 |}
6625 !! html
6626 <table>
6627 <tr>
6628 <td>
6629 </td>
6630 <td> a
6631 </td></tr></table>
6632
6633 !! end
6634
6635 !! test
6636 Table-cell after a comment-only-empty-line
6637 !! wikitext
6638 {|
6639 |a
6640 <!--c1-->
6641 <!--c2-->| b
6642 |}
6643 !! html
6644 <table>
6645 <tr>
6646 <td>a
6647 </td>
6648 <td> b
6649 </td></tr></table>
6650
6651 !! html/parsoid
6652 <table>
6653 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6654 <!--c1-->
6655 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6656 </tbody></table>
6657
6658 !! end
6659
6660 !! test
6661 Build table with {{!}}
6662 !! wikitext
6663 {{{!}} class="wikitable"
6664 ! header
6665 ! second header
6666 {{!}}- style="color:red;"
6667 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6668 {{!}}}
6669 !! html
6670 <table class="wikitable">
6671 <tr>
6672 <th> header
6673 </th>
6674 <th> second header
6675 </th></tr>
6676 <tr style="color:red;">
6677 <td> data </td>
6678 <td style="color:red;"> second data
6679 </td></tr></table>
6680
6681 !! end
6682
6683 !! test
6684 Build table with pipe as data
6685 !! wikitext
6686 {| class="wikitable"
6687 ! header
6688 ! second header
6689 |- style="color:red;"
6690 | data || style="color:red;" | second data
6691 |-
6692 | style="color:red;" | data with | || style="color:red;" | second data with |
6693 |-
6694 || data with | ||| second data with |
6695 |}
6696 !! html
6697 <table class="wikitable">
6698 <tr>
6699 <th> header
6700 </th>
6701 <th> second header
6702 </th></tr>
6703 <tr style="color:red;">
6704 <td> data </td>
6705 <td style="color:red;"> second data
6706 </td></tr>
6707 <tr>
6708 <td style="color:red;"> data with | </td>
6709 <td style="color:red;"> second data with |
6710 </td></tr>
6711 <tr>
6712 <td> data with | </td>
6713 <td> second data with |
6714 </td></tr></table>
6715
6716 !! end
6717
6718 !! test
6719 Build table with wikilink
6720 !! wikitext
6721 {| class="wikitable"
6722 ! header || second header
6723 |- style="color:red;"
6724 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6725 |-
6726 | data || second data [[Main Page|link|text with pipe]]
6727 |}
6728 !! html
6729 <table class="wikitable">
6730 <tr>
6731 <th> header </th>
6732 <th> second header
6733 </th></tr>
6734 <tr style="color:red;">
6735 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6736 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6737 </td></tr>
6738 <tr>
6739 <td> data </td>
6740 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6741 </td></tr></table>
6742
6743 !! end
6744
6745 # The expected HTML structure in this test is debatable. The PHP parser does
6746 # not parse this kind of table at all. The main focus for Parsoid is on
6747 # round-tripping, so this output is ok for now. TODO: revisit!
6748 !! test
6749 Wikitext table with html-syntax row
6750 !! wikitext
6751 {|
6752 |-
6753 <td>foo</td>
6754 |}
6755 !! html/parsoid
6756 <table>
6757 <tbody>
6758 <tr>
6759 <td>foo</td></tr></tbody></table>
6760 !! end
6761
6762 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6763 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6764 ## PHP parser, which tidy then compounds by fostering the content
6765 ## entirely out of the table. Parsoid recognizes the table context
6766 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6767 ## depends on PHP's treatment of broken table markup!
6768 !! test
6769 Implicit <td> after a |-
6770 !! options
6771 parsoid=wt2html,html2html
6772 !! wikitext
6773 {|
6774 |-
6775 a
6776 |}
6777 !! html/php
6778 <table>
6779
6780 a
6781 </table>
6782
6783 !! html/php+tidy
6784 <p>a</p>
6785 !! html/parsoid
6786 <table>
6787 <tr><td>a</td></tr>
6788 </table>
6789 !! end
6790
6791 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6792 !! test
6793 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6794 !! options
6795 parsoid=wt2html,html2html
6796 !! wikitext
6797 {|
6798 |-
6799 |
6800 a
6801 |-
6802 b
6803 |}
6804 !! html/php
6805 <table>
6806
6807 <tr>
6808 <td>
6809 <pre>a
6810 </pre>
6811 </td></tr>
6812 b
6813 </table>
6814
6815 !! html/php+tidy
6816 <p>b</p>
6817 <table>
6818 <tr>
6819 <td>
6820 <pre>
6821 a
6822 </pre></td>
6823 </tr>
6824 </table>
6825 !! html/parsoid
6826 <table>
6827 <tbody>
6828 <tr><td><pre>a</pre></td></tr>
6829 <tr><td> b</td></tr>
6830 </tbody>
6831 </table>
6832 !! end
6833
6834 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6835 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6836 !! test
6837 Lists should be recognized in an implicit <td> context
6838 !! options
6839 parsoid=wt2html,html2html
6840 !! wikitext
6841 {|
6842 |-
6843 *a
6844 |}
6845 !! html/php
6846 <table>
6847
6848 <ul><li>a</li></ul>
6849 </table>
6850
6851 !! html/php+tidy
6852 <ul>
6853 <li>a</li>
6854 </ul>
6855 !! html/parsoid
6856 <table>
6857 <tr>
6858 <td><ul>
6859 <li>a</li>
6860 </ul></td>
6861 </tr>
6862 </table>
6863 !! end
6864
6865 !! test
6866 Table cells not properly parsed in an implicit-td context
6867 !! wikitext
6868 {|
6869 |-
6870 {{table_attribs_4}} || a || b
6871 |}
6872 !! html/php+tidy
6873 <table>
6874 <tr>
6875 <td style="background-color:#DC241f;" width="10px"></td>
6876 <td>a</td>
6877 <td>b</td>
6878 </tr>
6879 </table>
6880 !! html/parsoid
6881 <table>
6882 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6883 <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>
6884 </tbody></table>
6885 !! end
6886
6887 !! test
6888 Parsoid: Round-trip tables directly followed by content (bug 51219)
6889 !! options
6890 parsoid=wt2html,wt2wt
6891 !! wikitext
6892 {|
6893 |foo
6894 |} bar
6895
6896 {|
6897 |baz
6898 |}<b>quux</b>
6899 !! html+tidy
6900 <table>
6901 <tr>
6902 <td>foo</td>
6903 </tr>
6904 </table>
6905 <p>bar</p>
6906 <table>
6907 <tr>
6908 <td>baz</td>
6909 </tr>
6910 </table>
6911 <p><b>quux</b></p>
6912 !! end
6913
6914 !! test
6915 Parsoid: Default to a newline after tables in new content (bug 51219)
6916 !! options
6917 parsoid=html2wt
6918 !! html/parsoid
6919 <table><tbody>
6920 <tr><td>foo</td></tr></tbody></table> bar
6921 <table><tbody>
6922 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6923 !! wikitext
6924 {|
6925 |foo
6926 |}
6927 <nowiki> </nowiki>bar
6928 {|
6929 |baz
6930 |}
6931 '''quux'''
6932 !! end
6933
6934 !! test
6935 Parsoid: newline inducing block nodes don't suppress <nowiki>
6936 !! options
6937 parsoid=html2wt
6938 !! html/parsoid
6939 a<h1>foo</h1>
6940 !! wikitext
6941 <nowiki> </nowiki>a
6942
6943 = foo =
6944 !! end
6945
6946 !! test
6947 Parsoid: Row-syntax table headings followed by comment & table cells
6948 !! options
6949 parsoid=wt2html,wt2wt
6950 !! wikitext
6951 {|
6952 ! foo || bar
6953 <!-- foo --> || baz || quux
6954 |}
6955 !! html/php
6956 <table>
6957 <tr>
6958 <th> foo </th>
6959 <th> bar
6960 </th>
6961 <td> baz </td>
6962 <td> quux
6963 </td></tr></table>
6964
6965 !! html/parsoid
6966 <table>
6967 <tbody><tr><th> foo </th><th> bar
6968 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6969 </tbody></table>
6970 !! end
6971
6972 !!test
6973 Parsoid: Recover better from broken table attributes
6974 !!options
6975 parsoid=wt2html
6976 !!wikitext
6977 {| class="foo
6978 | class="bar" |
6979 foo
6980 |}
6981 !!html/php+tidy
6982 <table class="foo">
6983 <tr>
6984 <td class="bar">
6985 <p>foo</p>
6986 </td>
6987 </tr>
6988 </table>
6989 !!html/parsoid
6990 <table class="foo">
6991 <tr>
6992 <td class="bar">
6993 <p>foo</p></td></tr>
6994 </tbody></table>
6995 !!end
6996
6997 !! test
6998 Tables: Digest broken attributes on table and tr tag
6999 !! options
7000 parsoid=wt2html
7001 !! wikitext
7002 {| || |} ++
7003 |- || || ++ --
7004 |- > [
7005 |}
7006 !! html
7007 <table>
7008 <tbody>
7009 <tr></tr>
7010 <tr></tr>
7011 </tbody></table>
7012 !! end
7013
7014 !! test
7015 Strip unsupported table tags
7016 !! options
7017 parsoid=html2wt
7018 !! html/parsoid
7019 <table>
7020 <thead>
7021 <tr>
7022 <th>Month</th>
7023 <th>Savings</th>
7024 </tr>
7025 </thead>
7026 <tbody>
7027 <tr>
7028 <td>January</td>
7029 <td>$100</td>
7030 </tr>
7031 <tr>
7032 <td>February</td>
7033 <td>$80</td>
7034 </tr>
7035 </tbody>
7036 <tfoot>
7037 <tr>
7038 <td>Sum</td>
7039 <td>$180</td>
7040 </tr>
7041 </tfoot>
7042 </table>
7043 !! wikitext
7044 {|
7045
7046 !Month
7047 !Savings
7048
7049 |January
7050 |$100
7051
7052 |-
7053 |February
7054 |$80
7055
7056 |Sum
7057 |$180
7058
7059 |}
7060 !! end
7061
7062 !!test
7063 Testing serialization after deletion of table cells
7064 !!options
7065 parsoid={
7066 "modes": ["wt2wt", "selser"],
7067 "changes": [
7068 ["#x", "remove"]
7069 ]
7070 }
7071 !!wikitext
7072 {|
7073 !h1 !!h2 !!h3
7074 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7075 |}
7076 !! wikitext/edited
7077 {|
7078 !h1 !!h2 !!h3
7079 |c2 |||c3
7080 |}
7081 !!end
7082
7083 ###
7084 ### Internal links
7085 ###
7086 !! test
7087 Plain link, capitalized
7088 !! wikitext
7089 [[Main Page]]
7090 !! html
7091 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7092 </p>
7093 !! end
7094
7095 !! test
7096 Plain link, uncapitalized
7097 !! wikitext
7098 [[main Page]]
7099 !! html
7100 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7101 </p>
7102 !! end
7103
7104 !! test
7105 Piped link
7106 !! wikitext
7107 [[Main Page|The Main Page]]
7108 !! html
7109 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7110 </p>
7111 !! end
7112
7113 !! test
7114 Piped link with comment in link text
7115 !! wikitext
7116 [[Main Page|The Main<!--front--> Page]]
7117 !! html
7118 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7119 </p>
7120 !! end
7121
7122 !! test
7123 Piped link with multiple pipe characters in link text
7124 !! wikitext
7125 [[Main Page||The|Main|Page|]]
7126 !! html/php
7127 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7128 </p>
7129 !! html/parsoid
7130 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7131 !! end
7132
7133 !! test
7134 Piped link with no link text
7135 !! wikitext
7136 [[Thomas Bek (bishop of St David's)|]]
7137 !! html/php
7138 <p>[[Thomas Bek (bishop of St David's)|]]
7139 </p>
7140 !! html/parsoid
7141 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7142 !! end
7143
7144 !! test
7145 Broken link
7146 !! wikitext
7147 [[Zigzagzogzagzig]]
7148 !! html
7149 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7150 </p>
7151 !! end
7152
7153 !! test
7154 Broken link with fragment
7155 !! wikitext
7156 [[Zigzagzogzagzig#zug]]
7157 !! html
7158 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7159 </p>
7160 !! end
7161
7162 !! test
7163 Special page link with fragment
7164 !! wikitext
7165 [[Special:Version#anchor]]
7166 !! html
7167 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7168 </p>
7169 !! end
7170
7171 !! test
7172 Nonexistent special page link with fragment
7173 !! wikitext
7174 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7175 !! html
7176 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7177 </p>
7178 !! end
7179
7180 !! test
7181 Link with prefix
7182 !! wikitext
7183 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7184 !! html
7185 <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>
7186 </p>
7187 !! end
7188
7189 !! test
7190 Link with suffix
7191 !! wikitext
7192 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7193 !! html
7194 <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>!!!
7195 </p>
7196 !! end
7197
7198 !! article
7199 prefixed article
7200 !! text
7201 Some text
7202 !! endarticle
7203
7204 !! test
7205 Bug 43661: Piped links with identical prefixes
7206 !! wikitext
7207 [[prefixed article|prefixed articles with spaces]]
7208
7209 [[prefixed article|prefixed articlesaoeu]]
7210
7211 [[Main Page|Main Page test]]
7212 !! html
7213 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7214 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7215 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7216 </p>
7217 !! end
7218
7219
7220 !! test
7221 Link with HTML entity in suffix / tail
7222 !! wikitext
7223 [[Main Page]]&quot;, [[Main Page]]&#97;
7224 !! html/php
7225 <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;
7226 </p>
7227 !! html/parsoid
7228 <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>
7229 !! end
7230
7231 !! test
7232 Link with 3 brackets
7233 !! wikitext
7234 [[[Main Page]]]
7235 Foo [[[Main Page]]]
7236 !! html
7237 <p>[[[Main Page]]]
7238 Foo [[[Main Page]]]
7239 </p>
7240 !! end
7241
7242 !! test
7243 Link with 4 brackets
7244 !! wikitext
7245 [[[[Main Page]]]]
7246 !! html
7247 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7248 </p>
7249 !! end
7250
7251 !! test
7252 Piped link with 3 brackets
7253 !! wikitext
7254 [[[main page|the main page]]]
7255 !! html
7256 <p>[[[main page|the main page]]]
7257 </p>
7258 !! end
7259
7260 !! test
7261 Piped link with extlink-like text
7262 !! wikitext
7263 [[Main Page|[bar]]]
7264 [[Main Page|This is a [bar]]]
7265 !! html/php
7266 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7267 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7268 </p>
7269 !! html/parsoid
7270 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7271 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7272 !! end
7273
7274 !! test
7275 Link with multiple pipes
7276 !! wikitext
7277 [[Main Page|The|Main|Page]]
7278 !! html
7279 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7280 </p>
7281 !! end
7282
7283 # Note that parsoid does not munge anchor text; all non-space
7284 # characters are valid in HTML5 ids.
7285 !! test
7286 Anchor containing a #. (bug 63430)
7287 !! wikitext
7288 [[Main Page#And#Link]]
7289 !! html/php
7290 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7291 </p>
7292 !! html/parsoid
7293 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7294 !! end
7295
7296 !! test
7297 Link to namespaces
7298 !! wikitext
7299 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7300 !! html
7301 <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>
7302 </p>
7303 !! end
7304
7305 !! test
7306 Link with space in namespace
7307 !! wikitext
7308 [[User talk:Foo bar]]
7309 !! html
7310 <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>
7311 </p>
7312 !! end
7313
7314 !! article
7315 MemoryAlpha:AlphaTest
7316 !! text
7317 This is an article in the MemoryAlpha namespace
7318 (which shadows the memoryalpha interwiki link).
7319 !! endarticle
7320
7321 !! test
7322 Namespace takes precedence over interwiki link (bug 51680)
7323 !! wikitext
7324 [[MemoryAlpha:AlphaTest]]
7325 !! html
7326 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7327 </p>
7328 !! end
7329
7330 # The previous test doesn't work correctly in html2*, due to not recognizing the
7331 # link as an internal one. This one checks for the correct behavior.
7332 !! test
7333 Link to namespace preferred over interwiki with correct rel attribute
7334 !! options
7335 parsoid=html2wt,html2html
7336 !! html/parsoid
7337 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7338 !! wikitext
7339 [[MemoryAlpha:AlphaTest]]
7340 !! end
7341
7342 !! test
7343 Piped link to namespace
7344 !! wikitext
7345 [[Meta:Disclaimers|The disclaimers]]
7346 !! html
7347 <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>
7348 </p>
7349 !! end
7350
7351 !! test
7352 Link containing }
7353 !! wikitext
7354 [[Usually caused by a typo (oops}]]
7355 !! html
7356 <p>[[Usually caused by a typo (oops}]]
7357 </p>
7358 !! end
7359
7360 !! article
7361 7% Solution
7362 !! text
7363 Just a test of an article title containing a percent.
7364 !! endarticle
7365
7366 !! test
7367 Link containing % (not as a hex sequence)
7368 !! wikitext
7369 [[7% Solution]]
7370 !! html/php
7371 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7372 </p>
7373 !! html/parsoid
7374 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7375 !! end
7376
7377 # note that the parsoid HTML is identical to the previous test output,
7378 # so the previous test ensures that the html2wt mode will generate the
7379 # "not as a hex sequence" wikitext.
7380 !! test
7381 Link containing % as a single hex sequence interpreted to char
7382 !! options
7383 parsoid=wt2wt,wt2html,html2html
7384 !! wikitext
7385 [[7%25 Solution]]
7386 !! html/php
7387 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7388 </p>
7389 !! html/parsoid
7390 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7391 !!end
7392
7393 !! test
7394 Link containing % as a double hex sequence interpreted to hex sequence
7395 !! wikitext
7396 [[7%2525 Solution]]
7397 !! html
7398 <p>[[7%2525 Solution]]
7399 </p>
7400 !!end
7401
7402 # note that parsoid does not munge anchor text; all non-space
7403 # characters are valid in HTML5 anchors.
7404 !! test
7405 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7406 Example for such a section: == < ==
7407 !! wikitext
7408 [[%23%3c]][[%23%3e]]
7409 !! html/php
7410 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7411 </p>
7412 !! html/parsoid
7413 <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>
7414 !! end
7415
7416 !! test
7417 Link containing "<#" and ">#" as a hex sequences
7418 !! wikitext
7419 [[%3c%23]][[%3e%23]]
7420 !! html
7421 <p>[[%3c%23]][[%3e%23]]
7422 </p>
7423 !! end
7424
7425 !! test
7426 Link containing an equals sign
7427 !! wikitext
7428 [[Special:BookSources/isbn=4-00-026157-6]]
7429 !! html/php
7430 <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>
7431 </p>
7432 !! html/parsoid
7433 <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>
7434 !! end
7435
7436 !! article
7437 Foo~bar
7438 !! text
7439 Just a test of an article title containing a tilde.
7440 !! endarticle
7441
7442 # note that links containing signatures, like [[Foo~~~~]], are
7443 # massaged by the pre-save transform (PST) and so the tildes are never
7444 # seen by the parser.
7445 !! test
7446 Link containing a tilde
7447 !! wikitext
7448 [[Foo~bar]]
7449 !! html/php
7450 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7451 </p>
7452 !! html/parsoid
7453 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7454 !! end
7455
7456 !! test
7457 Link containing double-single-quotes '' (bug 4598)
7458 !! wikitext
7459 [[Lista d''e paise d''o munno]]
7460 !! html/php
7461 <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>
7462 </p>
7463 !! html/parsoid
7464 <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>
7465 !! end
7466
7467 !! test
7468 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7469 !! wikitext
7470 Some [[Link|pretty ''italics'' and stuff]]!
7471 !! html/php
7472 <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>!
7473 </p>
7474 !! html/parsoid
7475 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7476 !! end
7477
7478 !! test
7479 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7480 !! wikitext
7481 ''Some [[Link|pretty ''italics'' and stuff]]!''
7482 !! html
7483 <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>
7484 </p>
7485 !! end
7486
7487 !! test
7488 Link with double quotes in title part (literal) and alternate part (interpreted)
7489 !! wikitext
7490 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7491
7492 [[''Pentecoste'']]
7493
7494 [[''Pentecoste''|Pentecoste]]
7495
7496 [[''Pentecoste''|''Pentecoste'']]
7497 !! html/php
7498 <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>
7499 </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>
7500 </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>
7501 </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>
7502 </p>
7503 !! html/parsoid
7504 <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>
7505 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7506 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7507 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7508 !! end
7509
7510 !! test
7511 Broken image links with HTML captions (bug 39700)
7512 !! wikitext
7513 [[File:Nonexistent|<script></script>]]
7514 [[File:Nonexistent|100x100px|<script></script>]]
7515 [[File:Nonexistent|&lt;]]
7516 [[File:Nonexistent|a<i>b</i>c]]
7517 !! html/php
7518 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7519 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7520 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7521 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7522 </p>
7523 !! html/parsoid
7524 <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>
7525 <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>
7526 <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>
7527 <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>
7528 !! end
7529
7530 !! test
7531 Plain link to URL
7532 !! wikitext
7533 [[http://www.example.com]]
7534 !! html/php
7535 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7536 </p>
7537 !! html/parsoid
7538 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7539 !! end
7540
7541 !! test
7542 Plain link to URL with link text
7543 !! wikitext
7544 [[http://www.example.com Link text]]
7545 !! html
7546 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7547 </p>
7548 !! end
7549
7550 !! test
7551 Plain link to protocol-relative URL
7552 !! wikitext
7553 [[//www.example.com]]
7554 !! html/php
7555 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7556 </p>
7557 !! html/parsoid
7558 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7559 !! end
7560
7561 !! test
7562 Plain link to protocol-relative URL with link text
7563 !! wikitext
7564 [[//www.example.com Link text]]
7565 !! html
7566 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7567 </p>
7568 !! end
7569
7570 !! test
7571 Plain link to page with question mark in title
7572 !! wikitext
7573 [[A?b]]
7574
7575 [[A?b|Baz]]
7576 !! html
7577 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7578 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7579 </p>
7580 !! end
7581
7582
7583 # I'm fairly sure the expected result here is wrong.
7584 # We want these to be URL links, not pseudo-pages with URLs for titles....
7585 # However the current output is also pretty screwy.
7586 #
7587 # ----
7588 # I'm changing it to match the current output--it arguably makes more
7589 # sense in the light of the test above. Old expected result was:
7590 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7591 #</p>
7592 # But I think this test is bordering on "garbage in, garbage out" anyway.
7593 # -- wtm
7594 !! test
7595 Piped link to URL
7596 !! wikitext
7597 Piped link to URL: [[http://www.example.com|an example URL]]
7598 !! html/php
7599 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7600 </p>
7601 !! html/parsoid
7602 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7603 !! end
7604
7605 !! test
7606 BUG 2: [[page|http://url/]] should link to page, not http://url/
7607 !! wikitext
7608 [[Main Page|http://url/]]
7609 !! html/php
7610 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7611 </p>
7612 !! html/parsoid
7613 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7614 !! end
7615
7616 # Parsoid does not mark self-links, by design.
7617 !! test
7618 BUG 337: Escaped self-links should be bold
7619 !! options
7620 title=[[Bug462]]
7621 !! wikitext
7622 [[Bu&#103;462]] [[Bug462]]
7623 !! html/php
7624 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7625 </p>
7626 !! html/php+tidy
7627 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7628 !! html/parsoid
7629 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7630 !! end
7631
7632 !! test
7633 Self-link to section should not be bold
7634 !! options
7635 title=[[Main Page]]
7636 !! wikitext
7637 [[Main Page#section]]
7638 !! html
7639 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7640 </p>
7641 !! end
7642
7643 !! article
7644 00
7645 !! text
7646 This is 00.
7647 !! endarticle
7648
7649 !!test
7650 Self-link to numeric title
7651 !!options
7652 title=[[0]]
7653 !! wikitext
7654 [[0]]
7655 !! html
7656 <p><strong class="selflink">0</strong>
7657 </p>
7658 !!end
7659
7660 !!test
7661 Link to numeric-equivalent title
7662 !!options
7663 title=[[0]]
7664 !! wikitext
7665 [[00]]
7666 !! html
7667 <p><a href="/wiki/00" title="00">00</a>
7668 </p>
7669 !!end
7670
7671 !! test
7672 <nowiki> inside a link
7673 !! wikitext
7674 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7675 !! html
7676 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7677 </p>
7678 !! end
7679
7680 !! test
7681 Non-breaking spaces in title
7682 !! wikitext
7683 [[&nbsp; Main &nbsp; Page &nbsp;]]
7684 !! html
7685 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7686 </p>
7687 !!end
7688
7689 !! test
7690 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7691 !! options
7692 language=ca
7693 !! wikitext
7694 '''[[Main Page]]'''
7695 !! html
7696 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7697 </p>
7698 !! end
7699
7700 !! test
7701 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7702 !! options
7703 language=ca
7704 !! wikitext
7705 ''[[Main Page]]''
7706 !! html
7707 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7708 </p>
7709 !! end
7710
7711 !! test
7712 Internal link with en linktrail: no apostrophes (bug 27473)
7713 !! options
7714 language=en
7715 !! wikitext
7716 [[Something]]'nice
7717 !! html
7718 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7719 </p>
7720 !! end
7721
7722 !! test
7723 Internal link with ca linktrail with apostrophes (bug 27473)
7724 !! options
7725 language=ca
7726 !! wikitext
7727 [[Something]]'nice
7728 !! html
7729 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7730 </p>
7731 !! end
7732
7733 !! test
7734 Internal link with kaa linktrail with apostrophes (bug 27473)
7735 !! options
7736 language=kaa
7737 !! wikitext
7738 [[Something]]'nice
7739 !! html
7740 <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>
7741 </p>
7742 !! end
7743
7744 !! test
7745 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7746 !! wikitext
7747 [[User:Foo/Test/63636:Bar|Test]]
7748 !! html/php
7749 <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>
7750 </p>
7751 !! html/parsoid
7752 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7753 !! end
7754
7755 !! test
7756 Purely hash wikilink
7757 !! options
7758 title=[[User:test/123]]
7759 !! wikitext
7760 [[#a|b]]
7761 !! html/php
7762 <p><a href="#a">b</a>
7763 </p>
7764 !! html/parsoid
7765 <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>
7766 !! end
7767
7768 !! test
7769 1. Interaction of linktrail and template encapsulation
7770 !! options
7771 parsoid
7772 !! wikitext
7773 {{echo|[[Foo]]}}l
7774 !! html
7775 <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>
7776 !! end
7777
7778 !! test
7779 2. Interaction of linktrail and template encapsulation
7780 !! options
7781 parsoid
7782 !! wikitext
7783 {{echo|Some [[Fool]]}}s
7784 !! html
7785 <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>
7786 !! end
7787
7788 !! test
7789 3. Interaction of linktrail and template encapsulation
7790 !! options
7791 parsoid
7792 !! wikitext
7793 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7794 !! html
7795 <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>
7796 !! end
7797
7798 !! article
7799 Söfnuður
7800 !! text
7801 Test.
7802 !! endarticle
7803
7804 !! test
7805 Internal link with is link prefix
7806 !! options
7807 language=is
7808 !! wikitext
7809 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7810 !! html
7811 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7812 </p>
7813 !! end
7814
7815 !! article
7816 Mótmælendatrú
7817 !! text
7818 Test.
7819 !! endarticle
7820
7821 !! test
7822 Internal link with is link trail and link prefix
7823 !! options
7824 language=is
7825 !! wikitext
7826 [[mótmælendatrú|xxx]]ar
7827 [[mótmælendatrú]]ar
7828 mótmælenda[[söfnuður]]
7829 mótmælenda[[söfnuður|söfnuðir]]
7830 mótmælenda[[söfnuður|söfnuðir]]xxx
7831 !! html
7832 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7833 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7834 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7835 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7836 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7837 </p>
7838 !! end
7839
7840 !! test
7841 Parsoid link trail escaping
7842 !! options
7843 parsoid=html2wt,html2html
7844 !! html/parsoid
7845 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7846 !! wikitext
7847 [[apple]]<nowiki/>s
7848 !! end
7849
7850 !! test
7851 Parsoid link prefix escaping
7852 !! options
7853 language=is
7854 parsoid=html2wt,html2html
7855 !! html/parsoid
7856 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7857 !! wikitext
7858 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7859 !! end
7860
7861 !! test
7862 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7863 !! wikitext
7864 [[Foo| bar]]
7865
7866 [[Foo| ''bar'']]
7867
7868 [http://wp.org foo]
7869
7870 [http://wp.org ''foo'']
7871 !! html
7872 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7873 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7874 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7875 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7876 </p>
7877 !! end
7878
7879 !! test
7880 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7881 !! options
7882 parsoid
7883 !! wikitext
7884 [[Foo|{{echo|a}} b {{echo|c}}]]
7885 !! html
7886 <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>
7887 !! end
7888
7889 !! test
7890 Link with angle bracket after anchor
7891 !! wikitext
7892 [[Foo#<bar>]]
7893 !! html/php
7894 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7895 </p>
7896 !! html/parsoid
7897 <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>
7898 !! end
7899
7900 ###
7901 ### Interwiki links (see maintenance/interwiki.sql)
7902 ###
7903
7904 !! test
7905 Inline interwiki link
7906 !! options
7907 parsoid=wt2html,wt2wt,html2html
7908 !! wikitext
7909 [[MeatBall:SoftSecurity]]
7910 !! html/php
7911 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7912 </p>
7913 !! html/parsoid
7914 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7915 !! end
7916
7917 !! test
7918 Inline interwiki link with empty title (bug 2372)
7919 !! options
7920 parsoid=wt2html,wt2wt,html2html
7921 !! wikitext
7922 [[MeatBall:]]
7923 !! html/php
7924 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7925 </p>
7926 !! html/parsoid
7927 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7928 !! end
7929
7930 !! test
7931 Interwiki link encoding conversion (bug 1636)
7932 !! wikitext
7933 *[[Wikipedia:ro:Olteni&#0355;a]]
7934 *[[Wikipedia:ro:Olteni&#355;a]]
7935 !! html
7936 <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>
7937 <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>
7938
7939 !! html+tidy
7940 <ul>
7941 <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>
7942 <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>
7943 </ul>
7944 !! end
7945
7946 !! test
7947 Interwiki link with fragment (bug 2130)
7948 !! wikitext
7949 [[MeatBall:SoftSecurity#foo]]
7950 !! html
7951 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7952 </p>
7953 !! end
7954
7955 # Ideally the wikipedia: prefix here should be proto-relative too
7956 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7957 # define the 'en' prefix, and originally the test used 'wikipedia',
7958 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7959 # article.
7960 !! test
7961 Different interwiki prefixes mapping to the same URL
7962 !! wikitext
7963 [[:en:Foo]]
7964
7965 [[:en:Foo|Foo]]
7966
7967 [[wikipedia:Foo]]
7968
7969 [[:wikipedia:Foo|Foo]]
7970
7971 [[wikipedia:en:Foo]]
7972
7973 [[:wikipedia:en:Foo]]
7974
7975 [[ wikiPEdia :Foo]]
7976 !! html/parsoid
7977 <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>
7978
7979 <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>
7980
7981 <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>
7982
7983 <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>
7984
7985 <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>
7986
7987 <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>
7988
7989 <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>
7990 !! end
7991
7992 !! test
7993 Interwiki links that cannot be represented in wiki syntax
7994 !! wikitext
7995 [[meatball:ok]]
7996 [[meatball:ok#foo|ok with fragment]]
7997 [[meatball:ok_as_well?|ok ending with ? mark]]
7998 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7999 [http://de.wikipedia.org/wiki/#foo is just fragment]
8000
8001 !! html/php
8002 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8003 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8004 <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>
8005 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8006 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8007 </p>
8008 !! html/parsoid
8009 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8010 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8011 <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>
8012 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8013 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8014 !! end
8015
8016 !! test
8017 Interwiki links: trail
8018 !! wikitext
8019 [[wikipedia:Foo|Ba]]r
8020 !! html/php
8021 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8022 </p>
8023 !! html/parsoid
8024 <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>
8025 !! end
8026
8027 !! test
8028 Local interwiki link
8029 !! options
8030 parsoid=wt2html,wt2wt,html2html
8031 !! wikitext
8032 [[local:Template:Foo]]
8033 !! html/php
8034 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8035 </p>
8036 !! html/parsoid
8037 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8038 !! end
8039
8040 # Parsoid does not mark self-links, by design.
8041 !! test
8042 Local interwiki link: self-link to current page
8043 !! options
8044 title=[[Main Page]]
8045 parsoid=wt2html,wt2wt,html2html
8046 !! wikitext
8047 [[local:Main Page]]
8048 !! html/php
8049 <p><strong class="selflink">local:Main Page</strong>
8050 </p>
8051 !! html/parsoid
8052 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8053 !! end
8054
8055 !! test
8056 Local interwiki link: prefix only (bug 64167)
8057 !! options
8058 parsoid=wt2html,wt2wt,html2html
8059 !! wikitext
8060 [[local:]]
8061 !! html/php
8062 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8063 </p>
8064 !! html/parsoid
8065 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8066 !! end
8067
8068 !! test
8069 Local interwiki link: with additional interwiki prefix (bug 61357)
8070 !! options
8071 parsoid=wt2html,wt2wt,html2html
8072 !! wikitext
8073 [[local:meatball:Hello]]
8074 !! html/php
8075 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8076 </p>
8077 !! html/parsoid
8078 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8079 !! end
8080
8081 !! test
8082 Multiple local interwiki link prefixes
8083 !! wikitext
8084 [[local:local:local:local:mi:local:Foo]]
8085 !! options
8086 parsoid=wt2html,wt2wt,html2html
8087 !! html/php
8088 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8089 </p>
8090 !! html/parsoid
8091 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8092 !! end
8093
8094 ###
8095 ### Interlanguage links
8096 ### Language links (so that searching for '### language' matches..)
8097 ###
8098
8099 !! test
8100 Interlanguage link
8101 !! options
8102 parsoid=wt2html,wt2wt,html2html
8103 !! wikitext
8104 Blah blah blah
8105 [[zh:Chinese]]
8106 !! html/php
8107 <p>Blah blah blah
8108 </p>
8109 !! html/parsoid
8110 <p>Blah blah blah</p>
8111 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8112 !! end
8113
8114 !! test
8115 Interlanguage link with spacing
8116 !! options
8117 parsoid=wt2html,wt2wt,html2html
8118 !! wikitext
8119 Blah blah blah
8120 [[ zh : Chinese ]]
8121 !! html/php
8122 <p>Blah blah blah
8123 </p>
8124 !! html/parsoid
8125 <p>Blah blah blah</p>
8126 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8127 !! end
8128
8129 !! test
8130 Double interlanguage link
8131 !! options
8132 parsoid=wt2html,wt2wt,html2html
8133 !! wikitext
8134 Blah blah blah
8135 [[es:Spanish]]
8136 [[zh:Chinese]]
8137 !! html/php
8138 <p>Blah blah blah
8139 </p>
8140 !! html/parsoid
8141 <p>Blah blah blah</p>
8142 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8143 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8144 !! end
8145
8146 !! test
8147 Interlanguage link variations
8148 !! options
8149 parsoid=wt2html,wt2wt,html2html
8150 !! wikitext
8151 Blah blah blah
8152 [[ es :Spanish]]
8153 [[ ZH :Chinese]]
8154 [[es:Foo_bar]]
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 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8163 !! end
8164
8165 !! test
8166 Space and question mark encoding in interlanguage links (T95473)
8167 !! options
8168 parsoid=wt2html,wt2wt,html2html
8169 !! wikitext
8170 Blah blah blah
8171 [[es:Foo bar?]]
8172 !! html/php
8173 <p>Blah blah blah
8174 </p>
8175 !! html/parsoid
8176 <p>Blah blah blah</p>
8177 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8178 !! end
8179
8180 !! test
8181 Interlanguage link, with prefix links
8182 !! options
8183 language=ln
8184 !! wikitext
8185 Blah blah blah
8186 [[zh:Chinese]]
8187 !! html/php
8188 <p>Blah blah blah
8189 </p>
8190 !! html/parsoid
8191 <p>Blah blah blah</p>
8192 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8193 !! end
8194
8195 !! test
8196 Double interlanguage link, with prefix links (bug 8897)
8197 !! options
8198 language=ln
8199 !! wikitext
8200 Blah blah blah
8201 [[es:Spanish]]
8202 [[zh:Chinese]]
8203 !! html/php
8204 <p>Blah blah blah
8205 </p>
8206 !! html/parsoid
8207 <p>Blah blah blah</p>
8208 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8209 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8210 !! end
8211
8212 !! test
8213 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8214 !! wikitext
8215 Blah blah blah
8216 [[mul:Article]]
8217 !! html/php
8218 <p>Blah blah blah
8219 </p>
8220 !! html/parsoid
8221 <p>Blah blah blah</p>
8222 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8223 !! end
8224
8225 !! test
8226 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8227 !! options
8228 language=ln
8229 !! wikitext
8230 [[WW&nbsp;II]]
8231 !! html
8232 <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>
8233 </p>
8234 !! end
8235
8236 !! test
8237 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8238 !! options
8239 parsoid=html2wt
8240 !! html/parsoid
8241 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8242 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8243 !! wikitext
8244 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8245
8246 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8247 !! end
8248
8249 !! test
8250 Parsoid: handle constructor well
8251 !! wikitext
8252 [[constructor]]
8253
8254 [[constructor:foo]]
8255 !! html/php
8256 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8257 </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>
8258 </p>
8259 !! html/parsoid
8260 <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>
8261
8262 <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>
8263 !! end
8264
8265 !! article
8266 ko:
8267 !! text
8268 Test.
8269 !! endarticle
8270
8271 # Note that `ko` isn't a known interlanguage prefix
8272 !! test
8273 Parsoid: recognize interlanguage links without a target page
8274 !! options
8275 ill
8276 !! wikitext
8277 [[es:]]
8278
8279 [[ko:]]
8280 !! html/php
8281 es:
8282 !! html/parsoid
8283 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8284
8285 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8286 !! end
8287
8288 # Note that `ko` isn't a known interwiki prefix
8289 !! test
8290 Parsoid: recognize interwiki links without a target page
8291 !! options
8292 parsoid=wt2html,wt2wt,html2html
8293 !! wikitext
8294 [[:es:]]
8295
8296 [[:ko:]]
8297 !! html/php
8298 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8299 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8300 </p>
8301 !! html/parsoid
8302 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8303 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8304 !! end
8305
8306 !! test
8307 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8308 !! wikitext
8309 [[mi:Foo]]
8310 !! html/php
8311 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8312 </p>
8313 !! html/parsoid
8314 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8315 !! end
8316
8317 !! test
8318 Interlanguage link with preceding local interwiki link (bug 68085)
8319 !! options
8320 parsoid=wt2html,wt2wt,html2html
8321 !! wikitext
8322 Blah blah blah
8323 [[local:es:Spanish]]
8324 !! html/php
8325 <p>Blah blah blah
8326 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8327 </p>
8328 !! html/parsoid
8329 <p>Blah blah blah
8330 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8331 !! end
8332
8333 !! test
8334 Looks like an interlanguage link, but is actually a local interwiki
8335 !! options
8336 parsoid=wt2html,wt2wt,html2html
8337 !! wikitext
8338 Blah blah blah
8339 [[mi:Template:Foo]]
8340 !! html/php
8341 <p>Blah blah blah
8342 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8343 </p>
8344 !! html/parsoid
8345 <p>Blah blah blah
8346 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8347 !! end
8348
8349 ###
8350 ### Redirects, Parsoid-only
8351 ###
8352
8353 !! test
8354 1. Simple redirect to page
8355 !! wikitext
8356 #REDIRECT [[Main Page]]
8357 !! html/parsoid
8358 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8359 !! end
8360
8361 !! test
8362 2. Other redirect variants
8363 !! wikitext
8364 #REDIRECT [[Main_Page]]
8365 !! html/parsoid
8366 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8367 !! end
8368
8369 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8370 # This tests the Parsoid bail-out code.
8371 !! test
8372 3. Other redirect variants
8373 !! wikitext
8374 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8375 !! html/parsoid
8376 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8377 !! end
8378
8379 !! test
8380 4. Redirect to a templated destination
8381 !! wikitext
8382 #REDIRECT [[{{echo|Foo}}bar]]
8383 !! html/parsoid
8384 <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"}]]}'/>
8385 !! end
8386
8387 !! test
8388 Empty redirect
8389 !! options
8390 parsoid=wt2html,wt2wt
8391 !! wikitext
8392 #REDIRECT [[]]
8393 !! html/parsoid
8394 <ol>
8395 <li>REDIRECT [[]]</li></ol>
8396 !! end
8397
8398 !! test
8399 Optional colon in #REDIRECT
8400 !! options
8401 # the colon is archaic syntax. we support it for wt2html, but we
8402 # don't care that it roundtrips back to the modern syntax.
8403 parsoid=wt2html,html2html
8404 !! wikitext
8405 #REDIRECT:[[Main Page]]
8406 !! html/parsoid
8407 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8408 !! end
8409
8410 !! test
8411 Whitespace in #REDIRECT with optional colon
8412 !! options
8413 # the colon and gratuitous whitespace is archaic syntax. we support
8414 # it for wt2html, but we don't care that it roundtrips back to the
8415 # modern syntax (without extra whitespace)
8416 parsoid=wt2html,html2html
8417 !! wikitext
8418
8419 #REDIRECT
8420 :
8421 [[Main Page]]
8422 !! html/parsoid
8423 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8424 !! end
8425
8426 !! test
8427 Piped link in #REDIRECT
8428 !! options
8429 # content after piped link is ignored. we support this syntax,
8430 # but don't care that the piped link is lost when we roundtrip this.
8431 parsoid=wt2html
8432 !! wikitext
8433 #REDIRECT [[Main Page|bar]]
8434 !! html/parsoid
8435 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8436 !! end
8437
8438 !! test
8439 Redirect to category (T104502)
8440 !! options
8441 parsoid=wt2html,wt2wt
8442 !! wikitext
8443 #REDIRECT [[Category:Foo]]
8444 !! html/parsoid
8445 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8446 !! end
8447
8448 !! test
8449 Redirect to category with URL encoding (T104502)
8450 !! options
8451 parsoid=wt2html
8452 !! wikitext
8453 #REDIRECT [[Category%3AFoo]]
8454 !! html/parsoid
8455 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8456 !! end
8457
8458 !! test
8459 Redirect to category page
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 image page (1)
8468 !! wikitext
8469 #REDIRECT [[File:Wiki.png]]
8470 !! html/parsoid
8471 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8472 !! end
8473
8474 !! test
8475 Redirect to image page (2)
8476 !! wikitext
8477 #REDIRECT [[Image:Wiki.png]]
8478 !! html/parsoid
8479 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8480 !! end
8481
8482 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8483 # Next test confirms this.
8484 !! test
8485 Redirect to language (1) (T104918)
8486 !! options
8487 parsoid=wt2html,wt2wt,html2html
8488 !! wikitext
8489 #REDIRECT [[en:File:Wiki.png]]
8490 !! html/parsoid
8491 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8492 !! end
8493
8494 !! test
8495 Redirect to language (2) (T104918)
8496 !! wikitext
8497 #REDIRECT [[:en:File:Wiki.png]]
8498 !! html/parsoid
8499 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8500 !! end
8501
8502 !! test
8503 Redirect to interwiki (T104918)
8504 !! wikitext
8505 #REDIRECT [[meatball:File:Wiki.png]]
8506 !! html/parsoid
8507 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8508 !! end
8509
8510 !! test
8511 Non-English #REDIRECT
8512 !! options
8513 language=is
8514 !! wikitext
8515 #TILVÍSUN [[Main Page]]
8516 !! html/parsoid
8517 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8518 !! end
8519
8520 !! test
8521 Redirect syntax under text isn't considered a redirect
8522 !! wikitext
8523 some text
8524 #redirect [[Main Page]]
8525 !! html/parsoid
8526 <p>some text</p>
8527 <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>
8528 !! end
8529
8530 # FIXME: Should hoist the redirect to the top of the page and ensure there
8531 # is only one.
8532 !! test
8533 New redirect
8534 !! options
8535 parsoid=html2wt
8536 !! html/parsoid
8537 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8538 !! wikitext
8539 Foo
8540 #REDIRECT [[Foo]]
8541 !! end
8542
8543 ##
8544 ## XHTML tidiness
8545 ###
8546
8547 !! test
8548 <br> to <br />
8549 !! wikitext
8550 1<br>2<br />3
8551 !! html
8552 <p>1<br />2<br />3
8553 </p>
8554 !! end
8555
8556 !! test
8557 Broken br tag sanitization
8558 !! wikitext
8559 </br>
8560 !! html/php
8561 <p>&lt;/br&gt;
8562 </p>
8563 !! end
8564
8565 # TODO: Fix html2html mode (bug 51055)!
8566 !! test
8567 Parsoid: Broken br tag recognition
8568 !! options
8569 parsoid=wt2html
8570 !! wikitext
8571 </br>
8572
8573 <br/ >
8574 !! html+tidy
8575 <p><br /></p>
8576 <p><br /></p>
8577 !! end
8578
8579 !! test
8580 Incorrecly removing closing slashes from correctly formed XHTML
8581 !! wikitext
8582 <br style="clear:both;" />
8583 !! html
8584 <p><br style="clear:both;" />
8585 </p>
8586 !! end
8587
8588 !! test
8589 Failing to transform badly formed HTML into correct XHTML
8590 !! wikitext
8591 <br style="clear: left;">
8592 <br style="clear: right;">
8593 <br style="clear: both;">
8594 !! html
8595 <p><br style="clear: left;" />
8596 <br style="clear: right;" />
8597 <br style="clear: both;" />
8598 </p>
8599 !!end
8600
8601 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8602 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8603 !! test
8604 Handling html with a div self-closing tag
8605 !! wikitext
8606 <div title />
8607 <div title/>
8608 <div title/ >
8609 <div title=bar />
8610 <div title=bar/>
8611 <div title=bar/ >
8612 !! html/php
8613 <p>&lt;div title /&gt;
8614 &lt;div title/&gt;
8615 </p>
8616 <div>
8617 <p>&lt;div title=bar /&gt;
8618 &lt;div title=bar/&gt;
8619 </p>
8620 <div title="bar/"></div>
8621 </div>
8622
8623 !! html/parsoid
8624 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8625 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8626 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8627 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8628 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8629 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8630 !! end
8631
8632 !! test
8633 Handling html with a br self-closing tag
8634 !! wikitext
8635 <br title />
8636 <br title/>
8637 <br title/ >
8638 <br title=bar />
8639 <br title=bar/>
8640 <br title=bar/ >
8641 !! html/php
8642 <p><br title="" />
8643 <br title="" />
8644 <br />
8645 <br title="bar" />
8646 <br title="bar" />
8647 <br title="bar/" />
8648 </p>
8649 !! html/parsoid
8650 <p><br title="" />
8651 <br title="" />
8652 <br title="" />
8653 <br title="bar" />
8654 <br title="bar" />
8655 <br title="bar/" />
8656 </p>
8657 !! end
8658
8659 !! test
8660 Horizontal ruler (should it add that extra space?)
8661 !! wikitext
8662 <hr>
8663 <hr >
8664 foo <hr
8665 > bar
8666 !! html+tidy
8667 <hr />
8668 <hr />
8669 <p>foo</p>
8670 <hr />
8671 <p>bar</p>
8672 !! end
8673
8674 !! test
8675 Horizontal ruler -- 4+ dashes render hr
8676 !! wikitext
8677 ----
8678 !! html
8679 <hr />
8680
8681 !! end
8682
8683 !! test
8684 Horizontal ruler -- eats additional dashes on the same line
8685 !! wikitext
8686 ---------
8687 !! html
8688 <hr />
8689
8690 !! end
8691
8692 !! test
8693 Horizontal ruler -- does not collapse dashes on consecutive lines
8694 !! wikitext
8695 ----
8696 ----
8697 !! html
8698 <hr />
8699 <hr />
8700
8701 !! end
8702
8703 !! test
8704 Horizontal ruler -- <4 dashes render as plain text
8705 !! wikitext
8706 ---
8707 !! html
8708 <p>---
8709 </p>
8710 !! end
8711
8712 !! test
8713 Horizontal ruler -- Supports content following dashes on same line
8714 !! wikitext
8715 ---- Foo
8716 !! html
8717 <hr /> Foo
8718
8719 !! html+tidy
8720 <hr />
8721 <p>Foo</p>
8722 !! end
8723
8724 ###
8725 ### Block-level elements
8726 ###
8727 !! test
8728 Common list
8729 !! wikitext
8730 *Common list
8731 * item 2
8732 *item 3
8733 !! html
8734 <ul><li>Common list</li>
8735 <li> item 2</li>
8736 <li>item 3</li></ul>
8737
8738 !! end
8739
8740 !! test
8741 Numbered list
8742 !! wikitext
8743 #Numbered list
8744 #item 2
8745 # item 3
8746 !! html
8747 <ol><li>Numbered list</li>
8748 <li>item 2</li>
8749 <li> item 3</li></ol>
8750
8751 !! end
8752
8753 !! test
8754 Mixed list
8755 !! wikitext
8756 *Mixed list
8757 *# with numbers
8758 ** and bullets
8759 *# and numbers
8760 *bullets again
8761 **bullet level 2
8762 ***bullet level 3
8763 ***#Number on level 4
8764 **bullet level 2
8765 **#Number on level 3
8766 **#Number on level 3
8767 *#number level 2
8768 *Level 1
8769 *** Level 3
8770 #** Level 3, but ordered
8771 !! html
8772 <ul><li>Mixed list
8773 <ol><li> with numbers</li></ol>
8774 <ul><li> and bullets</li></ul>
8775 <ol><li> and numbers</li></ol></li>
8776 <li>bullets again
8777 <ul><li>bullet level 2
8778 <ul><li>bullet level 3
8779 <ol><li>Number on level 4</li></ol></li></ul></li>
8780 <li>bullet level 2
8781 <ol><li>Number on level 3</li>
8782 <li>Number on level 3</li></ol></li></ul>
8783 <ol><li>number level 2</li></ol></li>
8784 <li>Level 1
8785 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8786 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8787
8788 !! end
8789
8790 !! test
8791 1. Nested mixed wikitext and html list
8792 !! wikitext
8793 * hi
8794 * <ul><li>ho</li></ul>
8795 * hi
8796 ** ho
8797 !! html/php
8798 <ul><li> hi</li>
8799 <li> <ul><li>ho</li></ul></li>
8800 <li> hi
8801 <ul><li> ho</li></ul></li></ul>
8802
8803 !! html/parsoid
8804 <ul><li> hi</li>
8805 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8806 <li> hi
8807 <ul><li> ho</li></ul></li></ul>
8808 !! end
8809
8810 !! test
8811 2. Nested mixed wikitext and html list (incompatible)
8812 !! wikitext
8813 ; hi
8814 : {{echo|<li>ho</li>}}
8815 !! html/php
8816 <dl><dt> hi</dt>
8817 <dd> <li>ho</li></dd></dl>
8818
8819 !! html/parsoid
8820 <dl><dt> hi</dt>
8821 <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>
8822 !! end
8823
8824 !! test
8825 Nested lists 1
8826 !! wikitext
8827 *foo
8828 **bar
8829 !! html
8830 <ul><li>foo
8831 <ul><li>bar</li></ul></li></ul>
8832
8833 !! end
8834
8835 !! test
8836 Nested lists 2
8837 !! wikitext
8838 **foo
8839 *bar
8840 !! html
8841 <ul><li><ul><li>foo</li></ul></li>
8842 <li>bar</li></ul>
8843
8844 !! end
8845
8846 !! test
8847 Nested lists 3 (first element empty)
8848 !! wikitext
8849 *
8850 **bar
8851 !! html
8852 <ul><li>
8853 <ul><li>bar</li></ul></li></ul>
8854
8855 !! end
8856
8857 !! test
8858 Nested lists 4 (first element empty)
8859 !! wikitext
8860 **
8861 *bar
8862 !! html
8863 <ul><li><ul><li></li></ul></li>
8864 <li>bar</li></ul>
8865
8866 !! end
8867
8868 !! test
8869 Nested lists 5 (both elements empty)
8870 !! wikitext
8871 **
8872 *
8873 !! html
8874 <ul><li><ul><li></li></ul></li>
8875 <li></li></ul>
8876
8877 !! end
8878
8879 !! test
8880 Nested lists 6 (both elements empty)
8881 !! wikitext
8882 *
8883 **
8884 !! html
8885 <ul><li>
8886 <ul><li></li></ul></li></ul>
8887
8888 !! end
8889
8890 !! test
8891 Nested lists 7 (skip initial nesting levels)
8892 !! wikitext
8893 *** foo
8894 !! html
8895 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8896
8897 !! end
8898
8899 !! test
8900 Nested lists 8 (multiple nesting transitions)
8901 !! wikitext
8902 * foo
8903 *** bar
8904 ** baz
8905 * boo
8906 !! html
8907 <ul><li> foo
8908 <ul><li><ul><li> bar</li></ul></li>
8909 <li> baz</li></ul></li>
8910 <li> boo</li></ul>
8911
8912 !! end
8913
8914 !! test
8915 Nested lists 9 (extension interaction)
8916 !! options
8917 parsoid
8918 !! wikitext
8919 *<references />
8920 !! html/parsoid
8921 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8922 !! end
8923
8924 !! test
8925 1. Lists with start-of-line-transparent tokens before bullets: Comments
8926 !! wikitext
8927 *foo
8928 *<!--cmt-->bar
8929 <!--cmt-->*baz
8930 !! html
8931 <ul><li>foo</li>
8932 <li>bar</li>
8933 <li>baz</li></ul>
8934
8935 !! end
8936
8937 !! test
8938 2. Lists with start-of-line-transparent tokens before bullets: Template close
8939 !! wikitext
8940 *foo {{echo|bar
8941 }}*baz
8942 !! html
8943 <ul><li>foo bar</li>
8944 <li>baz</li></ul>
8945
8946 !! end
8947
8948 !! test
8949 List items are not parsed correctly following a <pre> block (bug 785)
8950 !! wikitext
8951 * <pre>foo</pre>
8952 * <pre>bar</pre>
8953 * zar
8954 !! html/php
8955 <ul><li> <pre>foo</pre></li>
8956 <li> <pre>bar</pre></li>
8957 <li> zar</li></ul>
8958
8959 !! html/parsoid
8960 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8961 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8962 <li> zar</li></ul>
8963 !! end
8964
8965 !! test
8966 List items from template
8967 !! wikitext
8968
8969 {{inner list}}
8970 * item 2
8971
8972 * item 0
8973 {{inner list}}
8974 * item 2
8975
8976 * item 0
8977 * notSOL{{inner list}}
8978 * item 2
8979 !! html
8980 <ul><li> item 1</li>
8981 <li> item 2</li></ul>
8982 <ul><li> item 0</li>
8983 <li> item 1</li>
8984 <li> item 2</li></ul>
8985 <ul><li> item 0</li>
8986 <li> notSOL</li>
8987 <li> item 1</li>
8988 <li> item 2</li></ul>
8989
8990 !! end
8991
8992 !! test
8993 List interrupted by empty line or heading
8994 !! wikitext
8995 * foo
8996
8997 ** bar
8998 == A heading ==
8999 * Another list item
9000 !! html
9001 <ul><li> foo</li></ul>
9002 <ul><li><ul><li> bar</li></ul></li></ul>
9003 <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>
9004 <ul><li> Another list item</li></ul>
9005
9006 !!end
9007
9008 !!test
9009 Multiple list tags generated by templates
9010 !! wikitext
9011 {{echo|<li>}}a
9012 {{echo|<li>}}b
9013 {{echo|<li>}}c
9014 !! html
9015 <li>a
9016 <li>b
9017 <li>c</li>
9018 </li>
9019 </li>
9020
9021 !! html+tidy
9022 <ul>
9023 <li>a</li>
9024 <li>b</li>
9025 <li>c</li>
9026 </ul>
9027 !!end
9028
9029 !!test
9030 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9031 !! wikitext
9032 *a
9033 <!--This line will NOT split the list-->
9034 *b
9035 <!--This line will NOT split the list either-->
9036 *c
9037 <!--foo--> <!----> <!--This line NOT split the list either-->
9038 *d
9039 !! html
9040 <ul><li>a</li>
9041 <li>b</li>
9042 <li>c</li>
9043 <li>d</li></ul>
9044
9045 !!end
9046
9047 !!test
9048 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
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
9056 either-->
9057 *d
9058 !! html
9059 <ul><li>a</li>
9060 <li>b</li>
9061 <li>c</li>
9062 <li>d</li></ul>
9063
9064 !!end
9065
9066 !!test
9067 Test the li-hack
9068 (The PHP parser relies on Tidy for the hack)
9069 !!options
9070 parsoid=wt2html,wt2wt
9071 !! wikitext
9072 * foo
9073 * <li>li-hack
9074 * {{echo|<li>templated li-hack}}
9075 * <!--foo--> <li> unsupported li-hack with preceding comments
9076
9077 <ul>
9078 <li><li>not a li-hack
9079 </li>
9080 </ul>
9081 !! html+tidy
9082 <ul>
9083 <li>foo</li>
9084 <li>li-hack</li>
9085 <li>templated li-hack</li>
9086 <li>unsupported li-hack with preceding comments</li>
9087 </ul>
9088 <ul>
9089 <li>not a li-hack</li>
9090 </ul>
9091 !!end
9092
9093 !! test
9094 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9095 !! options
9096 parsoid
9097 !! wikitext
9098 # foo
9099 ## bar
9100 * foo
9101 ** bar
9102 : foo
9103 :: bar
9104 !! html
9105 <ol>
9106 <li> foo<ol>
9107 <li> bar</li>
9108 </ol></li>
9109 </ol><ul>
9110 <li> foo<ul>
9111 <li> bar</li>
9112 </ul></li>
9113 </ul><dl>
9114 <dd> foo<dl>
9115 <dd> bar</dd>
9116 </dl></dd>
9117 </dl>
9118 !! end
9119
9120 !! test
9121 Parsoid: Test of whitespace serialization with Templated bullets
9122 !! options
9123 parsoid
9124 !! wikitext
9125 * {{bullet}}
9126 !! html
9127 <ul>
9128 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9129 </ul>
9130 !! end
9131
9132 # ------------------------------------------------------------------------
9133 # The next set of tests are about Parsoid's ability to handle badly nested
9134 # tags (parse, minimize scope of fixup, and roundtrip back)
9135 # ------------------------------------------------------------------------
9136
9137 !! test
9138 Unbalanced closing block tags break a list
9139 (php parser relies on Tidy to fix up)
9140 !! wikitext
9141 <div>
9142 *a</div><div>
9143 *b</div>
9144 !! html+tidy
9145 <div>
9146 <ul>
9147 <li>a</li>
9148 </ul>
9149 </div>
9150 <div>
9151 <ul>
9152 <li>b</li>
9153 </ul>
9154 </div>
9155 !! end
9156
9157 # Parsoid fails this test, but it might be tricky to support properly.
9158 # See bug 68395.
9159 !! test
9160 Unbalanced closing non-block tags don't break a list
9161 (php parser relies on Tidy to fix up)
9162 !! wikitext
9163 <span>
9164 *a</span><span>
9165 *b</span>
9166 !! html/php+tidy
9167 <ul>
9168 <li><span>a</span></li>
9169 <li><span>b</span></li>
9170 </ul>
9171 !! html/parsoid
9172 <span>
9173 <ul>
9174 <li>a<span></span>
9175 </li>
9176 <li>b
9177 </li>
9178 </ul>
9179 </span>
9180 !! end
9181
9182 !! test
9183 Unclosed formatting tags that straddle lists are closed and reopened
9184 (php parser relies on Tidy to fix up)
9185 !! options
9186 parsoid=wt2html,wt2wt,html2html
9187 !! wikitext
9188 # <s> a
9189 # b </s>
9190 !! html/php+tidy
9191 <ol>
9192 <li><s>a</s></li>
9193 <li><s>b</s></li>
9194 </ol>
9195 !! html/parsoid
9196 <ol><li> <s> a</s></li>
9197 <li><s> b </s></li></ol>
9198 !! end
9199
9200 # See bug 68395.
9201 !!test
9202 1. List embedded in a formatting tag
9203 !! wikitext
9204 <small>
9205 * foo
9206 </small>
9207 !! html/php+tidy
9208 <ul>
9209 <li><small>foo</small></li>
9210 </ul>
9211 !! html/parsoid
9212 <small>
9213 <ul>
9214 <li> foo</li>
9215 </ul>
9216 </small>
9217 !!end
9218
9219 ## Ugly Parsoid output here
9220 ## Not sure what the right output is.
9221 !!test
9222 2. List embedded in a formatting tag
9223 !! wikitext
9224 <small>
9225 *a
9226 *b</small>
9227 !! html/php+tidy
9228 <ul>
9229 <li><small>a</small></li>
9230 <li><small>b</small></li>
9231 </ul>
9232 !! html/parsoid
9233 <small></small>
9234 <ul><small>
9235 <li>a</li>
9236 </small>
9237 <li><small>b</small></li>
9238 </ul>
9239 !!end
9240
9241 # Ugly Parsoid and PHP parser output here
9242 # Not sure if we want to make this a test!
9243 #
9244 ## !!test
9245 ## 3. Unclosed formatting tags in list elements
9246 ## !! wikitext
9247 ## *<small>a
9248 ## *<small>b
9249 ## !! html/php+tidy
9250 ## <ul>
9251 ## <li><small>a</small></li>
9252 ## <li><small><small>b</small></small></li>
9253 ## </ul>
9254 ## !! html/parsoid
9255 ## <ul>
9256 ## <li><small>a</small></li>
9257 ## <small>
9258 ## <li><small>b</small></li>
9259 ## </small></ul>
9260 ## !!end
9261
9262 # This is a bug in the PHP parser + tidy combination.
9263 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9264 # and then fostered out of the table by tidy.)
9265 # We believe the Parsoid output to be correct.
9266 !! test
9267 Table with missing opening <tr> tag
9268 !! options
9269 parsoid=wt2html,wt2wt
9270 !! wikitext
9271 <table>
9272 <td>foo</td>
9273 </tr>
9274 </table>
9275 !! html+tidy
9276 <table>
9277 <tr>
9278 <td>foo</td>
9279 </tr>
9280 </table>
9281 !! end
9282
9283 ###
9284 ### Magic Words
9285 ###
9286
9287 # Note that the current date is hard-coded as
9288 # 1970-01-01T00:02:03Z (a Thursday)
9289 # when running parser tests. The timezone is also fixed to GMT, so
9290 # local date will be identical to current date.
9291
9292 !! test
9293 Magic Word: {{CURRENTDAY}}
9294 !! wikitext
9295 {{CURRENTDAY}}
9296 !! html
9297 <p>1
9298 </p>
9299 !! end
9300
9301 !! test
9302 Magic Word: {{CURRENTDAY2}}
9303 !! wikitext
9304 {{CURRENTDAY2}}
9305 !! html
9306 <p>01
9307 </p>
9308 !! end
9309
9310 !! test
9311 Magic Word: {{CURRENTDAYNAME}}
9312 !! wikitext
9313 {{CURRENTDAYNAME}}
9314 !! html
9315 <p>Thursday
9316 </p>
9317 !! end
9318
9319 !! test
9320 Magic Word: {{CURRENTDOW}}
9321 !! wikitext
9322 {{CURRENTDOW}}
9323 !! html
9324 <p>4
9325 </p>
9326 !! end
9327
9328 !! test
9329 Magic Word: {{CURRENTMONTH}}
9330 !! wikitext
9331 {{CURRENTMONTH}}
9332 !! html
9333 <p>01
9334 </p>
9335 !! end
9336
9337 !! test
9338 Magic Word: {{CURRENTMONTH1}}
9339 !! wikitext
9340 {{CURRENTMONTH1}}
9341 !! html
9342 <p>1
9343 </p>
9344 !! end
9345
9346 !! test
9347 Magic Word: {{CURRENTMONTHABBREV}}
9348 !! wikitext
9349 {{CURRENTMONTHABBREV}}
9350 !! html
9351 <p>Jan
9352 </p>
9353 !! end
9354
9355 !! test
9356 Magic Word: {{CURRENTMONTHNAME}}
9357 !! wikitext
9358 {{CURRENTMONTHNAME}}
9359 !! html
9360 <p>January
9361 </p>
9362 !! end
9363
9364 !! test
9365 Magic Word: {{CURRENTMONTHNAMEGEN}}
9366 !! wikitext
9367 {{CURRENTMONTHNAMEGEN}}
9368 !! html
9369 <p>January
9370 </p>
9371 !! end
9372
9373 !! test
9374 Magic Word: {{CURRENTTIME}}
9375 !! wikitext
9376 {{CURRENTTIME}}
9377 !! html
9378 <p>00:02
9379 </p>
9380 !! end
9381
9382 !! test
9383 Magic Word: {{CURRENTHOUR}}
9384 !! wikitext
9385 {{CURRENTHOUR}}
9386 !! html
9387 <p>00
9388 </p>
9389 !! end
9390
9391 !! test
9392 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9393 !! wikitext
9394 {{CURRENTWEEK}}
9395 !! html
9396 <p>1
9397 </p>
9398 !! end
9399
9400 !! test
9401 Magic Word: {{CURRENTYEAR}}
9402 !! wikitext
9403 {{CURRENTYEAR}}
9404 !! html
9405 <p>1970
9406 </p>
9407 !! end
9408
9409 !! test
9410 Magic Word: {{CURRENTTIMESTAMP}}
9411 !! wikitext
9412 {{CURRENTTIMESTAMP}}
9413 !! html
9414 <p>19700101000203
9415 </p>
9416 !! end
9417
9418 !! test
9419 Magic Words LOCAL (UTC)
9420 !! wikitext
9421 * {{LOCALMONTH}}
9422 * {{LOCALMONTH1}}
9423 * {{LOCALMONTHNAME}}
9424 * {{LOCALMONTHNAMEGEN}}
9425 * {{LOCALMONTHABBREV}}
9426 * {{LOCALDAY}}
9427 * {{LOCALDAY2}}
9428 * {{LOCALDAYNAME}}
9429 * {{LOCALYEAR}}
9430 * {{LOCALTIME}}
9431 * {{LOCALHOUR}}
9432 * {{LOCALWEEK}}
9433 * {{LOCALDOW}}
9434 * {{LOCALTIMESTAMP}}
9435 !! html
9436 <ul><li> 01</li>
9437 <li> 1</li>
9438 <li> January</li>
9439 <li> January</li>
9440 <li> Jan</li>
9441 <li> 1</li>
9442 <li> 01</li>
9443 <li> Thursday</li>
9444 <li> 1970</li>
9445 <li> 00:02</li>
9446 <li> 00</li>
9447 <li> 1</li>
9448 <li> 4</li>
9449 <li> 19700101000203</li></ul>
9450
9451 !! end
9452
9453 !! test
9454 Magic Word: {{FULLPAGENAME}}
9455 !! options
9456 title=[[User:Ævar Arnfjörð Bjarmason]]
9457 !! wikitext
9458 {{FULLPAGENAME}}
9459 !! html
9460 <p>User:Ævar Arnfjörð Bjarmason
9461 </p>
9462 !! end
9463
9464 !! test
9465 Magic Word: {{FULLPAGENAMEE}}
9466 !! options
9467 title=[[User:Ævar Arnfjörð Bjarmason]]
9468 !! wikitext
9469 {{FULLPAGENAMEE}}
9470 !! html
9471 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9472 </p>
9473 !! end
9474
9475 !! test
9476 Magic Word: {{TALKSPACE}}
9477 !! options
9478 title=[[User:Ævar Arnfjörð Bjarmason]]
9479 !! wikitext
9480 {{TALKSPACE}}
9481 !! html
9482 <p>User talk
9483 </p>
9484 !! end
9485
9486 !! test
9487 Magic Word: {{TALKSPACE}}, same namespace
9488 !! options
9489 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9490 !! wikitext
9491 {{TALKSPACE}}
9492 !! html
9493 <p>User talk
9494 </p>
9495 !! end
9496
9497 !! test
9498 Magic Word: {{TALKSPACE}}, main namespace
9499 !! options
9500 title=[[Parser Test]]
9501 !! wikitext
9502 {{TALKSPACE}}
9503 !! html
9504 <p>Talk
9505 </p>
9506 !! end
9507
9508 !! test
9509 Magic Word: {{TALKSPACEE}}
9510 !! options
9511 title=[[User:Ævar Arnfjörð Bjarmason]]
9512 !! wikitext
9513 {{TALKSPACEE}}
9514 !! html
9515 <p>User_talk
9516 </p>
9517 !! end
9518
9519 !! test
9520 Magic Word: {{SUBJECTSPACE}}
9521 !! options
9522 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9523 !! wikitext
9524 {{SUBJECTSPACE}}
9525 !! html
9526 <p>User
9527 </p>
9528 !! end
9529
9530 !! test
9531 Magic Word: {{SUBJECTSPACE}}, same namespace
9532 !! options
9533 title=[[User:Ævar Arnfjörð Bjarmason]]
9534 !! wikitext
9535 {{SUBJECTSPACE}}
9536 !! html
9537 <p>User
9538 </p>
9539 !! end
9540
9541 !! test
9542 Magic Word: {{SUBJECTSPACE}}, main namespace
9543 !! options
9544 title=[[Parser Test]]
9545 !! wikitext
9546 {{SUBJECTSPACE}}
9547 !! html
9548
9549 !! end
9550
9551 !! test
9552 Magic Word: {{SUBJECTSPACEE}}
9553 !! options
9554 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9555 !! wikitext
9556 {{SUBJECTSPACEE}}
9557 !! html
9558 <p>User
9559 </p>
9560 !! end
9561
9562 !! test
9563 Magic Word: {{NAMESPACE}}
9564 !! options
9565 title=[[User:Ævar Arnfjörð Bjarmason]]
9566 !! wikitext
9567 {{NAMESPACE}}
9568 !! html
9569 <p>User
9570 </p>
9571 !! end
9572
9573 !! test
9574 Magic Word: {{NAMESPACEE}}
9575 !! options
9576 title=[[User:Ævar Arnfjörð Bjarmason]]
9577 !! wikitext
9578 {{NAMESPACEE}}
9579 !! html
9580 <p>User
9581 </p>
9582 !! end
9583
9584 !! test
9585 Magic Word: {{NAMESPACENUMBER}}
9586 !! options
9587 title=[[User:Ævar Arnfjörð Bjarmason]]
9588 !! wikitext
9589 {{NAMESPACENUMBER}}
9590 !! html
9591 <p>2
9592 </p>
9593 !! end
9594
9595 !! test
9596 Magic Word: {{SUBPAGENAME}}
9597 !! options
9598 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9599 !! wikitext
9600 {{SUBPAGENAME}}
9601 !! html
9602 <p>sub ö
9603 </p>
9604 !! end
9605
9606 !! test
9607 Magic Word: {{SUBPAGENAMEE}}
9608 !! options
9609 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9610 !! wikitext
9611 {{SUBPAGENAMEE}}
9612 !! html
9613 <p>sub_%C3%B6
9614 </p>
9615 !! end
9616
9617 !! test
9618 Magic Word: {{ROOTPAGENAME}}
9619 !! options
9620 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9621 !! wikitext
9622 {{ROOTPAGENAME}}
9623 !! html
9624 <p>Ævar Arnfjörð Bjarmason
9625 </p>
9626 !! end
9627
9628 !! test
9629 Magic Word: {{ROOTPAGENAMEE}}
9630 !! options
9631 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9632 !! wikitext
9633 {{ROOTPAGENAMEE}}
9634 !! html
9635 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9636 </p>
9637 !! end
9638
9639 !! test
9640 Magic Word: {{BASEPAGENAME}}
9641 !! options
9642 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9643 !! wikitext
9644 {{BASEPAGENAME}}
9645 !! html
9646 <p>Ævar Arnfjörð Bjarmason
9647 </p>
9648 !! end
9649
9650 !! test
9651 Magic Word: {{BASEPAGENAMEE}}
9652 !! options
9653 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9654 !! wikitext
9655 {{BASEPAGENAMEE}}
9656 !! html
9657 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9658 </p>
9659 !! end
9660
9661 !! test
9662 Magic Word: {{TALKPAGENAME}}
9663 !! options
9664 title=[[User:Ævar Arnfjörð Bjarmason]]
9665 !! wikitext
9666 {{TALKPAGENAME}}
9667 !! html
9668 <p>User talk:Ævar Arnfjörð Bjarmason
9669 </p>
9670 !! end
9671
9672 !! test
9673 Magic Word: {{TALKPAGENAMEE}}
9674 !! options
9675 title=[[User:Ævar Arnfjörð Bjarmason]]
9676 !! wikitext
9677 {{TALKPAGENAMEE}}
9678 !! html
9679 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9680 </p>
9681 !! end
9682
9683 !! test
9684 Magic Word: {{SUBJECTPAGENAME}}
9685 !! options
9686 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9687 !! wikitext
9688 {{SUBJECTPAGENAME}}
9689 !! html
9690 <p>User:Ævar Arnfjörð Bjarmason
9691 </p>
9692 !! end
9693
9694 !! test
9695 Magic Word: {{SUBJECTPAGENAMEE}}
9696 !! options
9697 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9698 !! wikitext
9699 {{SUBJECTPAGENAMEE}}
9700 !! html
9701 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9702 </p>
9703 !! end
9704
9705 !! test
9706 Magic Word: {{NUMBEROFFILES}}
9707 !! wikitext
9708 {{NUMBEROFFILES}}
9709 !! html
9710 <p>6
9711 </p>
9712 !! end
9713
9714 !! test
9715 Magic Word: {{PAGENAME}}
9716 !! options
9717 title=[[User:Ævar Arnfjörð Bjarmason]]
9718 !! wikitext
9719 {{PAGENAME}}
9720 !! html
9721 <p>Ævar Arnfjörð Bjarmason
9722 </p>
9723 !! end
9724
9725 !! test
9726 Magic Word: {{PAGENAME}} with metacharacters
9727 !! options
9728 title=[['foo & bar = baz']]
9729 !! wikitext
9730 ''{{PAGENAME}}''
9731 !! html/php
9732 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9733 </p>
9734 !! html+tidy
9735 <p><i>'foo &amp; bar = baz'</i></p>
9736 !! end
9737
9738 !! test
9739 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9740 !! options
9741 title=[[*RFC 1234 http://example.com/]]
9742 !! wikitext
9743 {{PAGENAME}}
9744 !! html/php
9745 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9746 </p>
9747 !! html+tidy
9748 <p>*RFC 1234 http://example.com/</p>
9749 !! end
9750
9751 !! test
9752 Magic Word: {{PAGENAMEE}}
9753 !! options
9754 title=[[User:Ævar Arnfjörð Bjarmason]]
9755 !! wikitext
9756 {{PAGENAMEE}}
9757 !! html
9758 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9759 </p>
9760 !! end
9761
9762 !! test
9763 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9764 !! options
9765 title=[[*RFC 1234 http://example.com/]]
9766 !! wikitext
9767 {{PAGENAMEE}}
9768 !! html/php
9769 <p>&#42;RFC_1234_http&#58;//example.com/
9770 </p>
9771 !! html+tidy
9772 <p>*RFC_1234_http://example.com/</p>
9773 !! end
9774
9775 !! test
9776 Magic Word: {{REVISIONID}}
9777 !! wikitext
9778 {{REVISIONID}}
9779 !! html
9780 <p>1337
9781 </p>
9782 !! end
9783
9784 !! test
9785 Magic Word: {{SCRIPTPATH}}
9786 !! wikitext
9787 {{SCRIPTPATH}}
9788 !! html
9789 <p>/
9790 </p>
9791 !! end
9792
9793 !! test
9794 Magic Word: {{STYLEPATH}}
9795 !! wikitext
9796 {{STYLEPATH}}
9797 !! html
9798 <p>/skins
9799 </p>
9800 !! end
9801
9802 !! test
9803 Magic Word: {{SERVER}}
9804 !! wikitext
9805 {{SERVER}}
9806 !! html
9807 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9808 </p>
9809 !! end
9810
9811 !! test
9812 Magic Word: {{SERVERNAME}}
9813 !! wikitext
9814 {{SERVERNAME}}
9815 !! html
9816 <p>example.org
9817 </p>
9818 !! end
9819
9820 !! test
9821 Magic Word: {{SITENAME}}
9822 !! wikitext
9823 {{SITENAME}}
9824 !! html
9825 <p>MediaWiki
9826 </p>
9827 !! end
9828
9829 !! test
9830 Case-sensitive magic words, when cased differently, should just be template transclusions
9831 !! wikitext
9832 {{CurrentMonth}}
9833 {{currentday}}
9834 {{cURreNTweEK}}
9835 {{currentHour}}
9836 !! html
9837 <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>
9838 <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>
9839 <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>
9840 <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>
9841 </p>
9842 !! end
9843
9844 !! test
9845 Case-insensitive magic words should still work with weird casing.
9846 !! wikitext
9847 {{sErVeRNaMe}}
9848 {{LCFirst:AOEU}}
9849 {{ucFIRST:aoeu}}
9850 {{SERver}}
9851 !! html
9852 <p>example.org
9853 aOEU
9854 Aoeu
9855 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9856 </p>
9857 !! end
9858
9859 # From plwiki:PLOS_ONE
9860 !! test
9861 Parsoid: Page property magic word with magic word contents
9862 !! wikitext
9863 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9864 !! html/parsoid
9865 <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>"}]]}'/>
9866 !! end
9867
9868 !! test
9869 Parsoid: Template-generated DISPLAYTITLE
9870 !! wikitext
9871 {{{{echo|DISPLAYTITLE}}:Foo}}
9872 !! html/parsoid
9873 <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}}]}'/>
9874 !! end
9875
9876 !! test
9877 Namespace 1 {{ns:1}}
9878 !! wikitext
9879 {{ns:1}}
9880 !! html
9881 <p>Talk
9882 </p>
9883 !! end
9884
9885 !! test
9886 Namespace 1 {{ns:01}}
9887 !! wikitext
9888 {{ns:01}}
9889 !! html
9890 <p>Talk
9891 </p>
9892 !! end
9893
9894 !! test
9895 Namespace 0 {{ns:0}} (bug 4783)
9896 !! wikitext
9897 {{ns:0}}
9898 !! html
9899
9900 !! end
9901
9902 !! test
9903 Namespace 0 {{ns:00}} (bug 4783)
9904 !! wikitext
9905 {{ns:00}}
9906 !! html
9907
9908 !! end
9909
9910 !! test
9911 Namespace -1 {{ns:-1}}
9912 !! wikitext
9913 {{ns:-1}}
9914 !! html
9915 <p>Special
9916 </p>
9917 !! end
9918
9919 !! test
9920 Namespace User {{ns:User}}
9921 !! wikitext
9922 {{ns:User}}
9923 !! html
9924 <p>User
9925 </p>
9926 !! end
9927
9928 !! test
9929 Namespace User talk {{ns:User_talk}}
9930 !! wikitext
9931 {{ns:User_talk}}
9932 !! html
9933 <p>User talk
9934 </p>
9935 !! end
9936
9937 !! test
9938 Namespace User talk {{ns:uSeR tAlK}}
9939 !! wikitext
9940 {{ns:uSeR tAlK}}
9941 !! html
9942 <p>User talk
9943 </p>
9944 !! end
9945
9946 !! test
9947 Namespace File {{ns:File}}
9948 !! wikitext
9949 {{ns:File}}
9950 !! html
9951 <p>File
9952 </p>
9953 !! end
9954
9955 !! test
9956 Namespace File {{ns:Image}}
9957 !! wikitext
9958 {{ns:Image}}
9959 !! html
9960 <p>File
9961 </p>
9962 !! end
9963
9964 !! test
9965 Namespace (lang=de) Benutzer {{ns:User}}
9966 !! options
9967 language=de
9968 !! wikitext
9969 {{ns:User}}
9970 !! html
9971 <p>Benutzer
9972 </p>
9973 !! end
9974
9975 !! test
9976 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9977 !! options
9978 language=de
9979 !! wikitext
9980 {{ns:3}}
9981 !! html
9982 <p>Benutzer Diskussion
9983 </p>
9984 !! end
9985
9986
9987 !! test
9988 Urlencode
9989 !! wikitext
9990 {{urlencode:hi world?!}}
9991 {{urlencode:hi world?!|WIKI}}
9992 {{urlencode:hi world?!|PATH}}
9993 {{urlencode:hi world?!|QUERY}}
9994 !! html
9995 <p>hi+world%3F%21
9996 hi_world%3F!
9997 hi%20world%3F%21
9998 hi+world%3F%21
9999 </p>
10000 !! end
10001
10002 !! test
10003 Magic Word: prioritize type info over data-parsoid
10004 !! options
10005 parsoid=html2wt
10006 !! html/parsoid
10007 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10008 !! wikitext
10009 __FORCETOC__
10010 !! end
10011
10012 !! test
10013 Magic Word: serialize on separate line (parsoid)
10014 !! options
10015 parsoid=wt2wt,html2wt
10016 !! wikitext
10017 foo
10018 __NOTOC__
10019 bar
10020 !! html/parsoid
10021 foo<meta property="mw:PageProp/notoc"/>bar
10022 !! end
10023
10024 !! test
10025 Magic Word: rt non-english wikis
10026 !! options
10027 parsoid=wt2wt
10028 language=de
10029 !! wikitext
10030 __NOEDITSECTION__
10031 !! html/parsoid
10032 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10033 !! end
10034
10035 !!test
10036 __proto__ is treated as normal wikitext (T105997)
10037 !!wikitext
10038 __proto__
10039 !!html
10040 <p>__proto__
10041 </p>
10042 !!end
10043
10044 ###
10045 ### Magic links
10046 ###
10047 !! test
10048 Magic links: internal link to RFC (bug 479)
10049 !! wikitext
10050 [[RFC 123]]
10051 !! html/php
10052 <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>
10053 </p>
10054 !! html/parsoid
10055 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10056 !! end
10057
10058 !! test
10059 Magic links: RFC (bug 479)
10060 !! wikitext
10061 RFC 822
10062 !! html/php
10063 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10064 </p>
10065 !! html/parsoid
10066 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10067 !! end
10068
10069 !! test
10070 Magic links: RFC (bug 65278)
10071 !! wikitext
10072 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10073 !! html/php
10074 <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.
10075 </p>
10076 !! html/parsoid
10077 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10078 !! end
10079
10080 !! test
10081 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10082 !! wikitext
10083 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10084 RFC
10085 822
10086 !! html/php
10087 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10088 RFC
10089 822
10090 </p>
10091 !! html/parsoid
10092 <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>
10093 RFC
10094 822</p>
10095 !! end
10096
10097 !! test
10098 Magic links: ISBN (bug 1937)
10099 !! wikitext
10100 ISBN 0-306-40615-2
10101 !! html/php
10102 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10103 </p>
10104 !! html/parsoid
10105 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10106 !! end
10107
10108 !! test
10109 Magic links: ISBN (bug 65278)
10110 !! wikitext
10111 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10112 !! html/php
10113 <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.
10114 </p>
10115 !! html/parsoid
10116 <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>
10117 !! end
10118
10119 !! test
10120 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10121 !! wikitext
10122 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10123 ISBN
10124 9780316098113
10125 ISBN 978
10126 0316098113
10127 !! html/php
10128 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10129 ISBN
10130 9780316098113
10131 ISBN 978
10132 0316098113
10133 </p>
10134 !! html/parsoid
10135 <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>
10136 ISBN
10137 9780316098113
10138 ISBN 978
10139 0316098113</p>
10140 !! end
10141
10142 !! test
10143 Magic links: PMID incorrectly converts space to underscore
10144 !! wikitext
10145 PMID 1234
10146 !! html/php
10147 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10148 </p>
10149 !! html/parsoid
10150 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10151 !! end
10152
10153 !! test
10154 Magic links: PMID (bug 65278)
10155 !! wikitext
10156 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10157 !! html/php
10158 <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.
10159 </p>
10160 !! html/parsoid
10161 <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>
10162 !! end
10163
10164 !! test
10165 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10166 !! wikitext
10167 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10168 PMID
10169 1234
10170 !! html/php
10171 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10172 PMID
10173 1234
10174 </p>
10175 !! html/parsoid
10176 <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>
10177 PMID
10178 1234</p>
10179 !! end
10180
10181 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10182 # since these are ExtLinkText, not MagicLinkText
10183 !! test
10184 Magic links: use appropriate serialization for "almost" magic links.
10185 !! wikitext
10186 X[[Special:BookSources/0978739256|foo]]
10187
10188 X[//tools.ietf.org/html/rfc1234 foo]
10189 !! html/php
10190 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10191 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10192 </p>
10193 !! html/parsoid
10194 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10195 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10196 !! end
10197
10198 ###
10199 ### Templates
10200 ####
10201
10202 !! test
10203 Nonexistent template
10204 !! wikitext
10205 {{thistemplatedoesnotexist}}
10206 !! html
10207 <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>
10208 </p>
10209 !! end
10210
10211 !! test
10212 Template with invalid target containing tags
10213 !! wikitext
10214 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10215 !! html
10216 <p>{{a<b>b</b>|foo|a=b|a = b}}
10217 </p>
10218 !! end
10219
10220 !! test
10221 Template with invalid target containing unclosed tag
10222 !! wikitext
10223 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10224 !! html
10225 <p>{{a<b>|foo|a=b|a = b}}</b>
10226 </p>
10227 !! end
10228
10229 !! test
10230 Template with invalid target containing wikilink
10231 !! wikitext
10232 {{[[Main Page]]}}
10233 !! html/php
10234 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10235 </p>
10236 !! html/parsoid
10237 <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>
10238 !! end
10239
10240 !! test
10241 Template with just whitespace in it, bug #68421
10242 !! wikitext
10243 {{echo|{{ }}}}
10244 !! html/parsoid
10245 <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>
10246 !! end
10247
10248 !! article
10249 Template:test
10250 !! text
10251 This is a test template
10252 !! endarticle
10253
10254 !! test
10255 Simple template
10256 !! wikitext
10257 {{test}}
10258 !! html
10259 <p>This is a test template
10260 </p>
10261 !! end
10262
10263 !! test
10264 Template with explicit namespace
10265 !! wikitext
10266 {{Template:test}}
10267 !! html
10268 <p>This is a test template
10269 </p>
10270 !! end
10271
10272
10273 !! article
10274 Template:paramtest
10275 !! text
10276 This is a test template with parameter {{{param}}}
10277 !! endarticle
10278
10279 !! test
10280 Template parameter
10281 !! wikitext
10282 {{paramtest|param=foo}}
10283 !! html
10284 <p>This is a test template with parameter foo
10285 </p>
10286 !! end
10287
10288 !! article
10289 Template:paramtestnum
10290 !! text
10291 [[{{{1}}}|{{{2}}}]]
10292 !! endarticle
10293
10294 !! test
10295 Template unnamed parameter
10296 !! wikitext
10297 {{paramtestnum|Main Page|the main page}}
10298 !! html
10299 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10300 </p>
10301 !! end
10302
10303 !! article
10304 Template:templatesimple
10305 !! text
10306 (test)
10307 !! endarticle
10308
10309 !! article
10310 Template:templateredirect
10311 !! text
10312 #redirect [[Template:templatesimple]]
10313 !! endarticle
10314
10315 !! article
10316 Template:templateasargtestnum
10317 !! text
10318 {{{{{1}}}}}
10319 !! endarticle
10320
10321 !! article
10322 Template:templateasargtest
10323 !! text
10324 {{template{{{templ}}}}}
10325 !! endarticle
10326
10327 !! article
10328 Template:templateasargtest2
10329 !! text
10330 {{{{{templ}}}}}
10331 !! endarticle
10332
10333 !! test
10334 Template with template name as unnamed argument
10335 !! wikitext
10336 {{templateasargtestnum|templatesimple}}
10337 !! html
10338 <p>(test)
10339 </p>
10340 !! end
10341
10342 !! test
10343 Template with template name as argument
10344 !! wikitext
10345 {{templateasargtest|templ=simple}}
10346 !! html
10347 <p>(test)
10348 </p>
10349 !! end
10350
10351 !! test
10352 Template with template name as argument (2)
10353 !! wikitext
10354 {{templateasargtest2|templ=templatesimple}}
10355 !! html
10356 <p>(test)
10357 </p>
10358 !! end
10359
10360 !! article
10361 Template:templateasargtestdefault
10362 !! text
10363 {{{{{templ|templatesimple}}}}}
10364 !! endarticle
10365
10366 !! article
10367 Template:templa
10368 !! text
10369 '''templ'''
10370 !! endarticle
10371
10372 !! test
10373 Template with default value
10374 !! wikitext
10375 {{templateasargtestdefault}}
10376 !! html
10377 <p>(test)
10378 </p>
10379 !! end
10380
10381 !! test
10382 Template with default value (value set)
10383 !! wikitext
10384 {{templateasargtestdefault|templ=templa}}
10385 !! html
10386 <p><b>templ</b>
10387 </p>
10388 !! end
10389
10390 !! test
10391 Template redirect
10392 !! wikitext
10393 {{templateredirect}}
10394 !! html/php
10395 <p>(test)
10396 </p>
10397 !! html/parsoid
10398 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10399 !! end
10400
10401 !! test
10402 Template with argument in separate line
10403 !! wikitext
10404 {{ templateasargtest |
10405 templ = simple }}
10406 !! html
10407 <p>(test)
10408 </p>
10409 !! end
10410
10411 !! test
10412 Template with complex template as argument
10413 !! wikitext
10414 {{paramtest|
10415 param ={{ templateasargtest |
10416 templ = simple }}}}
10417 !! html
10418 <p>This is a test template with parameter (test)
10419 </p>
10420 !! end
10421
10422 !! test
10423 Template with thumb image (with link in description)
10424 !! wikitext
10425 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10426 !! html/php
10427 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>
10428
10429 !! html+tidy
10430 <p>This is a test template with parameter</p>
10431 <div class="thumb tright">
10432 <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>
10433 <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>
10434 </div>
10435 </div>
10436 !! html/parsoid
10437 <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>
10438 !! end
10439
10440 !! article
10441 Template:complextemplate
10442 !! text
10443 {{{1}}} {{paramtest|
10444 param ={{{param}}}}}
10445 !! endarticle
10446
10447 !! test
10448 Template with complex arguments
10449 !! wikitext
10450 {{complextemplate|
10451 param ={{ templateasargtest |
10452 templ = simple }}|[[Template:complextemplate|link]]}}
10453 !! html
10454 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10455 </p>
10456 !! end
10457
10458 !! test
10459 BUG 553: link with two variables in a piped link
10460 !! wikitext
10461 {|
10462 |[[{{{1}}}|{{{2}}}]]
10463 |}
10464 !! html/php
10465 <table>
10466 <tr>
10467 <td>[[{{{1}}}|{{{2}}}]]
10468 </td></tr></table>
10469
10470 !! html/parsoid
10471 <table>
10472 <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>
10473 !! end
10474
10475 # See: T2553
10476 !! test
10477 Abort table cell attribute parsing on wikilink
10478 !! wikitext
10479 {|
10480 | testing [[one|two]] | three || four
10481 | testing one two | three || four
10482 |}
10483 !! html/php
10484 <table>
10485 <tr>
10486 <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>
10487 <td> four
10488 </td>
10489 <td> three </td>
10490 <td> four
10491 </td></tr></table>
10492
10493 !! html/parsoid
10494 <table>
10495 <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>
10496 <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>
10497 </tbody></table>
10498 !! end
10499
10500 !! test
10501 Don't abort table cell attribute parsing if wikilink is found in template arg
10502 !! wikitext
10503 {|
10504 | Test {{#tag:ref|One two "[[three]]" four}}
10505 |}
10506 !! html/parsoid
10507 <table>
10508 <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>
10509 </tbody></table>
10510 !! end
10511
10512 !! test
10513 Magic variable as template parameter
10514 !! wikitext
10515 {{paramtest|param={{SITENAME}}}}
10516 !! html
10517 <p>This is a test template with parameter MediaWiki
10518 </p>
10519 !! end
10520
10521 !! article
10522 Template:linktest
10523 !! text
10524 [[{{{param}}}|link]]
10525 !! endarticle
10526
10527 !! test
10528 Template parameter as link source
10529 !! wikitext
10530 {{linktest|param=Main Page}}
10531 !! html
10532 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10533 </p>
10534 !! end
10535
10536 !!article
10537 Template:paramtest2
10538 !! text
10539 including another template, {{paramtest|param={{{arg}}}}}
10540 !! endarticle
10541
10542 !! test
10543 Template passing argument to another template
10544 !! wikitext
10545 {{paramtest2|arg='hmm'}}
10546 !! html
10547 <p>including another template, This is a test template with parameter 'hmm'
10548 </p>
10549 !! end
10550
10551 !! article
10552 Template:Linktest2
10553 !! text
10554 Main Page
10555 !! endarticle
10556
10557 !! test
10558 Template as link source
10559 !! wikitext
10560 [[{{linktest2}}]]
10561
10562 [[{{linktest2}}|Main Page]]
10563
10564 [[{{linktest2}}]]Page
10565 !! html
10566 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10567 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10568 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10569 </p>
10570 !! end
10571
10572
10573 !! article
10574 Template:loop1
10575 !! text
10576 {{loop2}}
10577 !! endarticle
10578
10579 !! article
10580 Template:loop2
10581 !! text
10582 {{loop1}}
10583 !! endarticle
10584
10585 !! test
10586 Template infinite loop
10587 !! wikitext
10588 {{loop1}}
10589 !! html
10590 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10591 </p>
10592 !! end
10593
10594 !! test
10595 Template from main namespace
10596 !! wikitext
10597 {{:Main Page}}
10598 !! html
10599 <p>blah blah
10600 </p>
10601 !! end
10602
10603 !! article
10604 Template:table
10605 !! text
10606 {|
10607 | 1 || 2
10608 |-
10609 | 3 || 4
10610 |}
10611 !! endarticle
10612
10613 !! test
10614 BUG 529: Template with table, not included at beginning of line
10615 !! wikitext
10616 foo {{table}}
10617 !! html
10618 <p>foo
10619 </p>
10620 <table>
10621 <tr>
10622 <td> 1 </td>
10623 <td> 2
10624 </td></tr>
10625 <tr>
10626 <td> 3 </td>
10627 <td> 4
10628 </td></tr></table>
10629
10630 !! end
10631
10632 !! test
10633 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10634 !! wikitext
10635 foo
10636 {{table}}
10637 !! html
10638 <p>foo
10639 </p>
10640 <table>
10641 <tr>
10642 <td> 1 </td>
10643 <td> 2
10644 </td></tr>
10645 <tr>
10646 <td> 3 </td>
10647 <td> 4
10648 </td></tr></table>
10649
10650 !! end
10651
10652 !! test
10653 BUG 41: Template parameters shown as broken links
10654 !! wikitext
10655 {{{parameter}}}
10656 !! html
10657 <p>{{{parameter}}}
10658 </p>
10659 !! end
10660
10661 !! test
10662 Template with targets containing wikilinks
10663 !! wikitext
10664 {{[[foo]]}}
10665
10666 {{[[{{echo|foo}}]]}}
10667
10668 {{{{echo|[[foo}}]]}}
10669 !! html
10670 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10671 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10672 </p><p>{{[[foo}}]]
10673 </p>
10674 !! end
10675
10676 !! article
10677 Template:''
10678 !! text
10679 bar
10680 !! endarticle
10681
10682 !! test
10683 Templates: Double quotes as template target
10684 !! wikitext
10685 foo {{''}} baz
10686 !! html/php
10687 <p>foo bar baz
10688 </p>
10689 !! html/parsoid
10690 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10691 </p>
10692 !! end
10693
10694 ## This test is about making sure Parsoid's data-mw is well formed in the
10695 ## face of multiple templates with intersecting and overlapping ranges. The
10696 ## wikitext itself is wretched.
10697 !! test
10698 Templates with intersecting and overlapping ranges
10699 !! wikitext
10700 {|{{echo|
10701 <p>ha</p>}}
10702 {|{{echo|
10703 <p>ho</p>}}
10704 {{echo|{{!}}hi}}
10705 |}
10706 !! html/php+tidy
10707 <p>ha</p>
10708 <p>ho</p>
10709 <table>
10710 <tr>
10711 <td></td>
10712 </tr>
10713 <tr>
10714 <td>hi</td>
10715 </tr>
10716 </table>
10717 <table>
10718 <tr>
10719 <td></td>
10720 </tr>
10721 </table>
10722 !! html/parsoid
10723 <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":""}]]}'>
10724
10725 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10726
10727 <tbody><tr><td>hi</td></tr>
10728 </tbody></table>
10729 !! end
10730
10731 !! article
10732 Template:MSGNW test
10733 !! text
10734 ''None'' of '''this''' should be
10735 * interpreted
10736 but rather passed unmodified
10737 {{test}}
10738 <gallery>
10739 File:Foobar.jpg
10740 </gallery>
10741 <!-- comment -->
10742 !! endarticle
10743
10744 # hmm, fix this or just deprecate msgnw and document its behavior?
10745 !! test
10746 msgnw keyword
10747 !! wikitext
10748 {{msgnw:MSGNW test}}
10749 !! html/php
10750 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10751 &#42; interpreted
10752 &#32;but rather passed unmodified
10753 &#123;&#123;test&#125;&#125;
10754 &#60;gallery&#62;
10755 File:Foobar.jpg
10756 &#60;/gallery&#62;
10757 &#60;!-- comment --&#62;
10758 </p>
10759 !! end
10760
10761 !! test
10762 int keyword
10763 !! wikitext
10764 {{int:youhavenewmessages|lots of money|not!}}
10765 !! html
10766 <p>You have lots of money (not!).
10767 </p>
10768 !! end
10769
10770 !! test
10771 int keyword - non-existing message
10772 !! wikitext
10773 {{int:var}}
10774 !! html
10775 <p>&lt;var&gt;
10776 </p>
10777 !! end
10778
10779 !! article
10780 Template:Includes
10781 !! text
10782 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10783 !! endarticle
10784
10785 !! test
10786 <includeonly> and <noinclude> being included
10787 !! wikitext
10788 {{Includes}}
10789 !! html
10790 <p>Foobar
10791 </p>
10792 !! end
10793
10794 !! article
10795 Template:Includes2
10796 !! text
10797 <onlyinclude>Foo</onlyinclude>bar
10798 !! endarticle
10799
10800 !! test
10801 <onlyinclude> being included
10802 !! wikitext
10803 {{Includes2}}
10804 !! html
10805 <p>Foo
10806 </p>
10807 !! end
10808
10809
10810 !! article
10811 Template:Includes3
10812 !! text
10813 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10814 !! endarticle
10815
10816 !! test
10817 <onlyinclude> and <includeonly> being included
10818 !! wikitext
10819 {{Includes3}}
10820 !! html
10821 <p>Foo
10822 </p>
10823 !! end
10824
10825 !! test
10826 <includeonly> and <noinclude> on a page
10827 !! wikitext
10828 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10829 !! html
10830 <p>Foozar
10831 </p>
10832 !! end
10833
10834 !! test
10835 Un-closed <noinclude>
10836 !! wikitext
10837 <noinclude>
10838 !! html
10839 !! end
10840
10841 !! test
10842 <onlyinclude> on a page
10843 !! wikitext
10844 <onlyinclude>Foo</onlyinclude>bar
10845 !! html
10846 <p>Foobar
10847 </p>
10848 !! end
10849
10850 !! test
10851 Un-closed <onlyinclude>
10852 !! wikitext
10853 <onlyinclude>
10854 !! html
10855 !! end
10856
10857 !!test
10858 Self-closed noinclude, includeonly, onlyinclude tags
10859 !! wikitext
10860 <noinclude />
10861 <includeonly />
10862 <onlyinclude />
10863 !! html
10864 <p><br />
10865 </p>
10866 !!end
10867
10868 !!test
10869 Unbalanced includeonly and noinclude tags
10870 !! wikitext
10871 {|
10872 |a</noinclude>
10873 |b</noinclude></noinclude>
10874 |c</noinclude></includeonly>
10875 |d</includeonly></includeonly>
10876 |}
10877 !! html
10878 <table>
10879 <tr>
10880 <td>a
10881 </td>
10882 <td>b
10883 </td>
10884 <td>c&lt;/includeonly&gt;
10885 </td>
10886 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10887 </td></tr></table>
10888
10889 !!end
10890
10891 !! article
10892 Template:Includeonly section
10893 !! text
10894 <includeonly>
10895 ==Includeonly section==
10896 </includeonly>
10897 ==Section T-1==
10898 !!endarticle
10899
10900 !! test
10901 Bug 6563: Edit link generation for section shown by <includeonly>
10902 !! wikitext
10903 {{includeonly section}}
10904 !! html
10905 <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>
10906 <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>
10907
10908 !! end
10909
10910 # Uses same input as the contents of [[Template:Includeonly section]]
10911 !! test
10912 Bug 6563: Section extraction for section shown by <includeonly>
10913 !! options
10914 section=T-2
10915 !! wikitext
10916 <includeonly>
10917 ==Includeonly section==
10918 </includeonly>
10919 ==Section T-2==
10920 !! html
10921 ==Section T-2==
10922 !! end
10923
10924 !! test
10925 Bug 6563: Edit link generation for section suppressed by <includeonly>
10926 !! wikitext
10927 <includeonly>
10928 ==Includeonly section==
10929 </includeonly>
10930 ==Section 1==
10931 !! html
10932 <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>
10933
10934 !! end
10935
10936 !! test
10937 Bug 6563: Section extraction for section suppressed by <includeonly>
10938 !! options
10939 section=1
10940 !! wikitext
10941 <includeonly>
10942 ==Includeonly section==
10943 </includeonly>
10944 ==Section 1==
10945 !! html
10946 ==Section 1==
10947 !! end
10948
10949 !! test
10950 Un-closed <includeonly>
10951 !! wikitext
10952 <includeonly>
10953 !! html
10954 <p>&lt;includeonly&gt;
10955 </p>
10956 !! end
10957
10958 ## We used to, but no longer wt2wt this test since the default serializer
10959 ## will normalize the include directives to serialize on their own line.
10960 ## Selser will take care of preserving formatting in scenarios where they
10961 ## intermingled with other wikitext.
10962 !! test
10963 Includes and comments at SOL
10964 !! options
10965 parsoid=wt2html,html2html
10966 !! wikitext
10967 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10968
10969 <noinclude>
10970 some
10971 </noinclude>* stuff
10972 * here
10973
10974 <includeonly>can have stuff</includeonly>=== here ===
10975
10976 !! html/php
10977 <h2><span class="mw-headline" id="hu">hu</span></h2>
10978 <p>some
10979 </p>
10980 <ul><li> stuff</li>
10981 <li> here</li></ul>
10982 <h3><span class="mw-headline" id="here">here</span></h3>
10983
10984 !! html/parsoid
10985 <!-- 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>
10986
10987 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10988 <p>some</p>
10989 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10990 <li> here</li></ul>
10991
10992 <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>
10993
10994 !! end
10995
10996 # TODO: test with DOM fragment reuse!
10997 !! test
10998 Parsoid: DOM fragment reuse
10999 !! options
11000 parsoid=wt2wt,wt2html
11001 !! wikitext
11002 a{{echo|b<table></table>c}}d
11003
11004 a{{echo|b
11005 <table></table>
11006 c}}d
11007
11008 {{echo|a
11009
11010 <table></table>
11011
11012 b}}
11013 !! html
11014 <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>
11015
11016 <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">
11017 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11018 </span><p about="#mwt2">cd</p>
11019
11020 <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">
11021
11022 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11023
11024 </span><p about="#mwt3">b</p>
11025 !! end
11026
11027 !! test
11028 Parsoid: Merge double tds (T52603)
11029 !! options
11030 parsoid
11031 !! wikitext
11032 {|
11033 |{{echo|{{!}} foo}}
11034 |}
11035 !! html
11036 <table><tbody>
11037 <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>
11038 </tbody></table>
11039 !! end
11040
11041 !! test
11042 Parsoid: Merge double tds in nested transclusion content (T52603)
11043 !! options
11044 parsoid
11045 !! wikitext
11046 {{echo|<div>}}
11047 {|
11048 |{{echo|{{!}} foo}}
11049 |}
11050 {{echo|</div>}}
11051 !! html
11052 <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}}]}'>
11053 <table><tbody>
11054 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11055 </tbody></table>
11056 </div>
11057 !! end
11058
11059 ###
11060 ### <includeonly> and <noinclude> in attributes
11061 ###
11062 !!test
11063 0. includeonly around the entire attribute
11064 !! wikitext
11065 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11066 !! html
11067 <p><span id="v2">bar</span>
11068 </p>
11069 !!end
11070
11071 !!test
11072 1. includeonly in html attr key
11073 !! wikitext
11074 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11075 !! html
11076 <p><span id="foo">bar</span>
11077 </p>
11078 !!end
11079
11080 !!test
11081 2. includeonly in html attr value
11082 !! wikitext
11083 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11084 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11085 !! html
11086 <p><span id="v1">bar</span>
11087 <span id="v1">bar</span>
11088 </p>
11089 !!end
11090
11091 !!test
11092 3. includeonly in part of an attr value
11093 !! wikitext
11094 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11095 !! html
11096 <p><span style="color:red;">bar</span>
11097 </p>
11098 !!end
11099
11100 !!test
11101 4. includeonly in table attributes
11102 !! wikitext
11103 {|
11104 |- <noinclude>
11105 |-
11106 |a
11107 </noinclude>
11108 |- <includeonly>
11109 |-
11110 |b
11111 </includeonly>
11112 |}
11113 !! html
11114 <table>
11115
11116
11117 <tr>
11118 <td>a
11119 </td></tr>
11120 </table>
11121
11122 !!end
11123
11124 ###
11125 ### Token Stream Patcher tests
11126 ###
11127 ### These tests won't always pass wt2wt and other modes because
11128 ### on serialization, the table will be output on a new line.
11129 ### For now, we are blacklisting them, and using this to test selser.
11130 ###
11131
11132 !!test
11133 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11134 !!options
11135 parsoid=wt2html,wt2wt
11136 !!wikitext
11137 {{echo|}}{| width = '100%'
11138 |foo
11139 |}
11140 !!html/parsoid
11141 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11142 <tbody><tr><td>foo</td></tr>
11143 </tbody></table>
11144 !!end
11145
11146 ## We used to, but no longer wt2wt this test since the default serializer
11147 ## will normalize the include directives to serialize on their own line.
11148 ## Selser will take care of preserving formatting in scenarios where they
11149 ## intermingled with other wikitext.
11150 !!test
11151 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11152 !!options
11153 parsoid=wt2html
11154 !!wikitext
11155 <includeonly>a</includeonly>{| {{{b}}}
11156 |c
11157 |}
11158 !!html/parsoid
11159 <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}}}":""}}'>
11160 <tbody><tr><td>c</td></tr>
11161 </tbody></table>
11162
11163 !!end
11164
11165 ###
11166 ### Testing parsing of templates where a template arg
11167 ### has the same name as the template itself.
11168 ###
11169
11170 !! article
11171 Template:quote
11172 !! text
11173 {{{quote|{{{1}}}}}}
11174 !! endarticle
11175
11176 !!test
11177 Templates: Template Name/Arg clash: 1. Use of positional param
11178 !! wikitext
11179 {{quote|foo}}
11180 !! html
11181 <p>foo
11182 </p>
11183 !!end
11184
11185 !!test
11186 Templates: Template Name/Arg clash: 2. Use of named param
11187 !! wikitext
11188 {{quote|quote=foo}}
11189 !! html
11190 <p>foo
11191 </p>
11192 !!end
11193
11194 !!test
11195 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11196 !! wikitext
11197 {{quote|quote}}
11198 !! html
11199 <p>quote
11200 </p>
11201 !!end
11202
11203 ###
11204 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11205 ###
11206
11207 !!test
11208 Templates: 1. Simple use
11209 !! wikitext
11210 {{echo|Foo}}
11211 !! html
11212 <p>Foo
11213 </p>
11214 !!end
11215
11216 !!test
11217 Templates: 2. Inside a block tag
11218 !! wikitext
11219 <div>{{echo|Foo}}</div>
11220 <blockquote>{{echo|Foo}}</blockquote>
11221 !! html
11222 <div>Foo</div>
11223 <blockquote>Foo</blockquote>
11224
11225 !! html+tidy
11226 <div>Foo</div>
11227 <blockquote>
11228 <p>Foo</p>
11229 </blockquote>
11230 !!end
11231
11232 !!test
11233 Templates: P-wrapping: 1a. Templates on consecutive lines
11234 !! wikitext
11235 {{echo|Foo}}
11236 {{echo|bar}}
11237 !! html
11238 <p>Foo
11239 bar
11240 </p>
11241 !!end
11242
11243 !!test
11244 Templates: P-wrapping: 1b. Templates on consecutive lines
11245 !! wikitext
11246 Foo
11247
11248 {{echo|bar}}
11249 {{echo|baz}}
11250 !! html
11251 <p>Foo
11252 </p><p>bar
11253 baz
11254 </p>
11255 !!end
11256
11257 !!test
11258 Templates: P-wrapping: 1c. Templates on consecutive lines
11259 !! wikitext
11260 {{echo|Foo}}
11261 {{echo|bar}} <div>baz</div>
11262 !! html
11263 <p>Foo
11264 </p>
11265 bar <div>baz</div>
11266
11267 !! html+tidy
11268 <p>Foo</p>
11269 <p>bar</p>
11270 <div>baz</div>
11271 !! end
11272
11273 !!test
11274 Templates: P-wrapping: 1d. Template preceded by comment-only line
11275 !!options
11276 parsoid
11277 !! wikitext
11278 <!-- foo -->
11279 {{echo|Bar}}
11280 !! html
11281 <!-- foo -->
11282
11283 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11284 !!end
11285
11286 !!test
11287 Templates: Inline Text: 1. Multiple template uses
11288 !! wikitext
11289 {{echo|Foo}}bar{{echo|baz}}
11290 !! html
11291 <p>Foobarbaz
11292 </p>
11293 !!end
11294
11295 !!test
11296 Templates: Inline Text: 2. Back-to-back template uses
11297 !! wikitext
11298 {{echo|Foo}}{{echo|bar}}
11299 !! html
11300 <p>Foobar
11301 </p>
11302 !!end
11303
11304 !!test
11305 Templates: Block Tags: 1. Multiple template uses
11306 !! wikitext
11307 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11308 !! html
11309 <div>Foo</div><div>bar</div><div>baz</div>
11310
11311 !!end
11312
11313 !!test
11314 Templates: Block Tags: 2. Back-to-back template uses
11315 !! wikitext
11316 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11317 !! html
11318 <div>Foo</div><div>bar</div>
11319
11320 !!end
11321
11322 # This is an edge case relating to paragraph wrapping.
11323 !!test
11324 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11325 !! wikitext
11326 {{echo|a
11327 b</p>}}
11328 !! html/parsoid
11329 <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
11330 b</p>
11331 !!end
11332
11333 !!test
11334 Templates: Links: 1. Simple example
11335 !! wikitext
11336 {{echo|[[Foo|bar]]}}
11337 !! html
11338 <p><a href="/wiki/Foo" title="Foo">bar</a>
11339 </p>
11340 !!end
11341
11342 !!test
11343 Templates: Links: 2. Generation of link href
11344 !! wikitext
11345 [[{{echo|Foo}}|bar]]
11346 !! html
11347 <p><a href="/wiki/Foo" title="Foo">bar</a>
11348 </p>
11349 !!end
11350
11351 !!test
11352 Templates: Links: 3. Generation of part of a link href
11353 !! wikitext
11354 [[Fo{{echo|o}}|bar]]
11355
11356 [[Foo{{echo|bar}}]]
11357
11358 [[Foo{{echo|bar}}baz]]
11359
11360 [[Foo{{echo|bar}}|bar]]
11361
11362 [[:Foo{{echo|bar}}]]
11363
11364 [[:Foo{{echo|bar}}|bar]]
11365 !! html
11366 <p><a href="/wiki/Foo" title="Foo">bar</a>
11367 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11368 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11369 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11370 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11371 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11372 </p>
11373 !!end
11374
11375 !!test
11376 Templates: Links: 4. Multiple templates generating link href
11377 !! wikitext
11378 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11379 !! html
11380 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11381 </p>
11382 !!end
11383
11384 !!test
11385 Templates: Links: 5. Generation of link text
11386 !! wikitext
11387 [[Foo|{{echo|bar}}]]
11388 !! html
11389 <p><a href="/wiki/Foo" title="Foo">bar</a>
11390 </p>
11391 !!end
11392
11393 !!test
11394 Templates: Links: 5. Nested templates (only outermost template should be marked)
11395 !! wikitext
11396 {{echo|[[{{echo|Foo}}|bar]]}}
11397 !! html
11398 <p><a href="/wiki/Foo" title="Foo">bar</a>
11399 </p>
11400 !!end
11401
11402 !!test
11403 Templates: HTML Tag: 1. Generation of HTML attr. key
11404 !! wikitext
11405 <div {{echo|style}}="color:red;">foo</div>
11406 !! html
11407 <div style="color:red;">foo</div>
11408
11409 !!end
11410
11411 !!test
11412 Templates: HTML Tag: 2. Generation of HTML attr. value
11413 !! wikitext
11414 <div style={{echo|'color:red;'}}>foo</div>
11415 !! html
11416 <div style="color:red;">foo</div>
11417
11418 !!end
11419
11420 !!test
11421 Templates: HTML Tag: 3. Generation of HTML attr key and value
11422 !! wikitext
11423 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11424 !! html
11425 <div style="color:red;">foo</div>
11426
11427 !!end
11428
11429 !!test
11430 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11431 !! wikitext
11432 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11433 !! html
11434 <div title="This is a long title with just one piece templated">foo</div>
11435
11436 !!end
11437
11438 !!test
11439 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11440 !! wikitext
11441 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11442 !! html
11443 <div title="This is a long title with just one piece templated">foo</div>
11444
11445 !!end
11446
11447 !!test
11448 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11449 !! wikitext
11450 <div title="This is a long title with just one piece {{echo|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 # SSS FIXME: While it is great we added support for all this,
11457 # do we want to make this part of the spec? Maybe we want to
11458 # deprecate this kind of usage in the future?
11459 !!test
11460 Templates: HTML Tag: 7. Generation of partial attribute key string
11461 !! wikitext
11462 <div st{{echo|yle}}="color:red;">foo</div>
11463 !! html
11464 <div style="color:red;">foo</div>
11465
11466 !!end
11467
11468 !! test
11469 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11470 !! wikitext
11471 <div {{echo|1=id="v1"}}>bar</div>
11472 !! html
11473 <div id="v1">bar</div>
11474
11475 !!end
11476
11477 !! test
11478 Templates: HTML Tag: 9. Multiple template-generated attributes
11479 !! wikitext
11480 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11481 !! html
11482 <div id="v1" title="foo">bar</div>
11483
11484 !!end
11485
11486 !! test
11487 Templates: Support for templates generating attributes and content
11488 !! wikitext
11489 {| {{mixed_attr_content_template}}
11490 |-
11491 |bar
11492 |}
11493 !! html/php
11494 <table style="color:red;" title="T48811">
11495
11496 <tr>
11497 <td>foo
11498 </td></tr>
11499 <tr>
11500 <td>bar
11501 </td></tr></table>
11502
11503 !! html/parsoid
11504 <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|}"]}'>
11505 <tbody><tr>
11506 <td>foo</td></tr>
11507 <tr>
11508 <td>bar</td></tr>
11509 </tbody></table>
11510 !!end
11511
11512 !! test
11513 1. Entities and nowikis inside templated attributes should be handled correctly
11514 !! wikitext
11515 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11516 !! html/php
11517 <div style="background:#f9f9f9;">foo</div>
11518
11519 !! html/parsoid
11520 <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>
11521 !! end
11522
11523 !! test
11524 2. Entities and nowikis inside templated attributes should be handled correctly
11525 !! wikitext
11526 {|
11527 |{{table_attribs_3}}
11528 |}
11529 !! html/php
11530 <table>
11531 <tr>
11532 <td style="background:#f9f9f9;">Foo
11533 </td></tr></table>
11534
11535 !! html/parsoid
11536 <table>
11537 <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>
11538 </tbody></table>
11539 !! end
11540
11541 !! test
11542 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11543 !! wikitext
11544 {{tbl-start}}
11545 |{{table_attribs_3}}
11546 {{tbl-end}}
11547 !! html/php
11548 <table>
11549 <tr>
11550 <td style="background:#f9f9f9;">Foo
11551 </td></tr></table>
11552
11553 !! html/parsoid
11554 <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}}]}'>
11555 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11556 </tbody></table>
11557 !! end
11558
11559 # T107622
11560 !! test
11561 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11562 !! wikitext
11563 {|
11564 | {{table_attribs_6}} hi
11565 |}
11566 !! html/php
11567 <table>
11568 <tr>
11569 <td style="background: red;"> hi
11570 </td></tr></table>
11571
11572 !! html/parsoid
11573 <table>
11574 <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>
11575 </tbody></table>
11576 !! end
11577
11578 !!test
11579 Templates: HTML Tables: 1. Generating start of a HTML table
11580 !! wikitext
11581 {{echo|<table><tr><td>foo</td>}}</tr></table>
11582 !! html
11583 <table><tr><td>foo</td></tr></table>
11584
11585 !!end
11586
11587 !!test
11588 Templates: HTML Tables: 2a. Generating middle of a HTML table
11589 !! wikitext
11590 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11591 !! html
11592 <table><tr><td>foo</td></tr></table>
11593
11594 !!end
11595
11596 !!test
11597 Templates: HTML Tables: 2b. Generating middle of a HTML table
11598 !! wikitext
11599 <table>{{echo|<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: 3. Generating end 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: 4a. Generating a single tag of a HTML table
11616 !! wikitext
11617 {{echo|<table>}}<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: 4b. Generating a single tag of a HTML table
11625 !! wikitext
11626 <table>{{echo|<tr>}}<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: 4c. Generating a single tag of a HTML table
11634 !! wikitext
11635 <table><tr>{{echo|<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: 4d. Generating a single tag of a HTML table
11643 !! wikitext
11644 <table><tr><td>foo{{echo|</td>}}</tr></table>
11645 !! html
11646 <table><tr><td>foo</td></tr></table>
11647
11648 !!end
11649
11650 !!test
11651 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11652 !! wikitext
11653 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11654 !! html
11655 <table><tr><td>foo</td></tr></table>
11656
11657 !!end
11658
11659 !!test
11660 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11661 !! wikitext
11662 <table><tr><td>foo</td></tr>{{echo|</table>}}
11663 !! html
11664 <table><tr><td>foo</td></tr></table>
11665
11666 !!end
11667
11668 !!test
11669 Templates: HTML Tables: 5. Proper fostering of categories from inside
11670 !!options
11671 parsoid=wt2html,wt2wt
11672 !! wikitext
11673 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11674 <!--Two categories (Bug 50330)-->
11675 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11676 !! html
11677 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11678 <!--Two categories (Bug 50330)-->
11679 <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>
11680 !!end
11681
11682 !!test
11683 Templates: Wiki Tables: 1a. Fostering of entire template content
11684 !! wikitext
11685 {|
11686 {{echo|a}}
11687 |}
11688 !! html
11689 <table>
11690 a
11691 <tr><td></td></tr></table>
11692
11693 !! html+tidy
11694 <p>a</p>
11695 <table>
11696 <tr>
11697 <td></td>
11698 </tr>
11699 </table>
11700 !! end
11701
11702 !!test
11703 Templates: Wiki Tables: 1b. Fostering of entire template content
11704 !! wikitext
11705 {|
11706 {{echo|<div>}}
11707 foo
11708 {{echo|</div>}}
11709 |}
11710 !! html
11711 <table>
11712 <div>
11713 <p>foo
11714 </p>
11715 </div>
11716 <tr><td></td></tr></table>
11717
11718 !! html+tidy
11719 <div>
11720 <p>foo</p>
11721 </div>
11722 <table>
11723 <tr>
11724 <td></td>
11725 </tr>
11726 </table>
11727 !! end
11728
11729 !!test
11730 Templates: Wiki Tables: 2. Fostering of partial template content
11731 !! wikitext
11732 {|
11733 {{echo|a
11734 <div>b</div>}}
11735 |}
11736 !! html
11737 <table>
11738 a
11739 <div>b</div>
11740 <tr><td></td></tr></table>
11741
11742 !! html+tidy
11743 <p>a</p>
11744 <div>b</div>
11745 <table>
11746 <tr>
11747 <td></td>
11748 </tr>
11749 </table>
11750 !! end
11751
11752 !!test
11753 Templates: Wiki Tables: 3. td-content via multiple templates
11754 !! wikitext
11755 {|
11756 {{echo|{{pipe}}a}}{{echo|b}}
11757 |}
11758 !! html
11759 <table>
11760 <tr>
11761 <td>ab
11762 </td></tr></table>
11763
11764 !!end
11765
11766 !!test
11767 Templates: Wiki Tables: 4. Templated tags, no content
11768 !! wikitext
11769 {{tbl-start}}
11770 {{tbl-end}}
11771 !! html
11772 <table>
11773 <tr><td></td></tr></table>
11774
11775 !!end
11776
11777 !!test
11778 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11779 !! wikitext
11780 {{tbl-start}}
11781 |foo
11782 {{tbl-end}}
11783 !! html
11784 <table>
11785 <tr>
11786 <td>foo
11787 </td></tr></table>
11788
11789 !!end
11790
11791 !!test
11792 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11793 !! wikitext
11794 {{tbl-start}}
11795 {{!}}foo
11796 {{tbl-end}}
11797 !! html
11798 <table>
11799 <tr>
11800 <td>foo
11801 </td></tr></table>
11802
11803 !!end
11804
11805 ## This test case is very specific to Parsoid's internals
11806 ## and is hence only tested for Parsoid's code. Parsoid uses
11807 ## a <meta> marker tag for <ref> tags and they are expanded
11808 ## much later. We are verifying that this <meta> tag usage
11809 ## doesn't prevent foster parenting.
11810 !!test
11811 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11812 !!wikitext
11813 {{PartialTable}}<ref>foo</ref>
11814 |}
11815
11816 <references />
11817 !!html/parsoid
11818 <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">
11819 <tbody>
11820 </tbody></table>
11821
11822 <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>
11823 !!end
11824
11825 !! test
11826 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11827 !! wikitext
11828 {{echo|
11829 {{{!}}
11830 {{!}}-}}
11831 <onlyinclude>
11832 |foo
11833 </onlyinclude>
11834 {{!}}}
11835 !! html/parsoid
11836 <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{{!}}}"]}'>
11837 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11838 <tbody><tr>
11839
11840 <td>foo
11841 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11842 </tbody></table>
11843 !! end
11844
11845 !!test
11846 Templates: Lists: Multi-line list-items via templates
11847 !! wikitext
11848 *{{echo|a {{nonexistent|
11849 unused}}}}
11850 *{{echo|b {{nonexistent|
11851 unused}}}}
11852 !! html
11853 <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>
11854 <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>
11855
11856 !!end
11857
11858 !!test
11859 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11860 !! wikitext
11861 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11862 !! html
11863 <p><i>ab</i>c<i>d</i>e
11864 </p>
11865 !!end
11866
11867 !!test
11868 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11869 (PHP parser generates misnested html)
11870 !! wikitext
11871 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11872 !! html/parsoid
11873 <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>
11874 !!end
11875
11876 !!test
11877 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11878 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11879 !! options
11880 parsoid=wt2html,wt2wt
11881 !! wikitext
11882 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11883 !! html
11884 <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>
11885 <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>
11886 <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>
11887 !!end
11888
11889 !!test
11890 Templates: Ugly nesting: 4. Divs opened/closed across templates
11891 !! wikitext
11892 a<div>b{{echo|c</div>d}}e
11893 !! html
11894 a<div>bc</div>de
11895
11896 !! html+tidy
11897 <p>a</p>
11898 <div>bc</div>
11899 <p>de</p>
11900 !! end
11901
11902 !!test
11903 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11904 (Parsoid-centric)
11905 !! options
11906 parsoid
11907 !! wikitext
11908 {|
11909 |{{echo|foo</table>}}
11910 |bar
11911 |}
11912 !! html
11913 <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|}"]}'>
11914
11915 <tbody>
11916 <tr>
11917 <td>foo</td></tr></tbody></table><span about="#mwt1">
11918 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11919 |}</span>
11920 !!end
11921
11922 !!test
11923 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11924 (Parsoid-centric)
11925 !! options
11926 parsoid
11927 !! wikitext
11928 <table>
11929 <tr>
11930 <td>
11931 <table>
11932 <tr>
11933 <td>1. {{echo|foo </table>}}</td>
11934 <td> bar </td>
11935 <td>2. {{echo|baz </table>}}</td>
11936 </tr>
11937 <tr>
11938 <td>abc</td>
11939 </tr>
11940 </table>
11941 </td>
11942 </tr>
11943 <tr>
11944 <td>xyz</td>
11945 </tr>
11946 </table>
11947 !! html
11948 <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>"]}'>
11949 <tbody><tr>
11950 <td>
11951 <table>
11952 <tbody><tr>
11953 <td>1. foo </td></tr></tbody></table></td>
11954 <td> bar </td>
11955 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11956 </span><span about="#mwt2">
11957 </span><span about="#mwt2">
11958 </span><span about="#mwt2">abc</span><span about="#mwt2">
11959 </span><span about="#mwt2">
11960 </span><span about="#mwt2">
11961 </span><span about="#mwt2">
11962 </span><span about="#mwt2">
11963 </span><span about="#mwt2">
11964 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11965 </span><span about="#mwt2">
11966 </span>
11967 !!end
11968
11969 !! test
11970 Templates: Ugly templates: 3. newline-only template parameter
11971 !! wikitext
11972 foo {{echo|
11973 }}
11974 !! html
11975 <p>foo
11976 </p>
11977 !! end
11978
11979 # This looks like a bug: a single newline triggers p/br for some reason.
11980 !! test
11981 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11982 !! wikitext
11983 {{echo|
11984 }}
11985 !! html
11986 <p><br />
11987 </p>
11988 !! end
11989
11990 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11991 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11992 !! test
11993 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11994 !! wikitext
11995 {{echo|<table>}}
11996 {{echo|<div>foo}}
11997 {{echo|</table>}}
11998 !! html/parsoid
11999 <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
12000 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12001 </table>
12002 !! end
12003
12004 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12005 # that are "identical" and generate nesting cycles in the algorithm
12006 !! test
12007 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12008 !! wikitext
12009 {{echo|<table><tr><td><table>}}
12010 {{echo|<div>}}
12011 {{echo|</div>}}
12012 !! html/parsoid
12013 <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"}'>
12014 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12015 </table></td></tr></tbody></table>
12016 !! end
12017
12018 !! test
12019 Templates: Parameters substituted at the top-level
12020 !! wikitext
12021 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12022 !! html/php
12023 <p><i>who</i> me? <b>never!</b>
12024 </p>
12025 !! html/parsoid
12026 <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>
12027 !! end
12028
12029 !!test
12030 Parser Functions: 1. Simple example
12031 !! wikitext
12032 {{uc:foo}}
12033 !! html
12034 <p>FOO
12035 </p>
12036 !!end
12037
12038 !!test
12039 Parser Functions: 2. Nested use (only outermost should be marked up)
12040 !! wikitext
12041 {{uc:{{lc:FOO}}}}
12042 !! html
12043 <p>FOO
12044 </p>
12045 !!end
12046
12047 ###
12048 ### Pre-save transform tests
12049 ###
12050 !! test
12051 pre-save transform: subst:
12052 !! options
12053 pst
12054 !! wikitext
12055 {{subst:test}}
12056 !! html/php
12057 This is a test template
12058 !! end
12059
12060 !! test
12061 pre-save transform: normal template
12062 !! options
12063 pst
12064 !! wikitext
12065 {{test}}
12066 !! html/php
12067 {{test}}
12068 !! end
12069
12070 !! test
12071 pre-save transform: nonexistent template
12072 !! options
12073 pst
12074 !! wikitext
12075 {{thistemplatedoesnotexist}}
12076 !! html/php
12077 {{thistemplatedoesnotexist}}
12078 !! end
12079
12080 !! test
12081 pre-save transform: subst magic variables
12082 !! options
12083 pst
12084 !! wikitext
12085 {{subst:SITENAME}}
12086 !! html/php
12087 MediaWiki
12088 !! end
12089
12090 # This is bug 89, which I fixed. -- wtm
12091 !! test
12092 pre-save transform: subst: templates with parameters
12093 !! options
12094 pst
12095 !! wikitext
12096 {{subst:paramtest|param="something else"}}
12097 !! html/php
12098 This is a test template with parameter "something else"
12099 !! end
12100
12101 !! article
12102 Template:nowikitest
12103 !! text
12104 <nowiki>'''not wiki'''</nowiki>
12105 !! endarticle
12106
12107 !! test
12108 pre-save transform: nowiki in subst (bug 1188)
12109 !! options
12110 pst
12111 !! wikitext
12112 {{subst:nowikitest}}
12113 !! html/php
12114 <nowiki>'''not wiki'''</nowiki>
12115 !! end
12116
12117 !! article
12118 Template:commenttest
12119 !! text
12120 This template has <!-- a comment --> in it.
12121 !! endarticle
12122
12123 !! test
12124 pre-save transform: comment in subst (bug 1936)
12125 !! options
12126 pst
12127 !! wikitext
12128 {{subst:commenttest}}
12129 !! html/php
12130 This template has <!-- a comment --> in it.
12131 !! end
12132
12133 !! test
12134 pre-save transform: unclosed tag
12135 !! options
12136 pst noxml
12137 !! wikitext
12138 <nowiki>'''not wiki'''
12139 !! html/php
12140 <nowiki>'''not wiki'''
12141 !! end
12142
12143 !! test
12144 pre-save transform: mixed tag case
12145 !! options
12146 pst noxml
12147 !! wikitext
12148 <NOwiki>'''not wiki'''</noWIKI>
12149 !! html/php
12150 <NOwiki>'''not wiki'''</noWIKI>
12151 !! end
12152
12153 !! test
12154 pre-save transform: unclosed comment in <nowiki>
12155 !! options
12156 pst noxml
12157 !! wikitext
12158 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12159 !! html/php
12160 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12161 !!end
12162
12163 # Leading @ in this template definition works around a limitation
12164 # in parsoid's parserTests which otherwise strips the <span> from the
12165 # result (confusing it for a template wrapper)
12166 !! article
12167 Template:dangerous
12168 !!text
12169 @<span onmouseover="alert('crap')">Oh no</span>
12170 !!endarticle
12171
12172 !!test
12173 (confirming safety of fix for subst bug 1936)
12174 !! wikitext
12175 {{Template:dangerous}}
12176 !! html
12177 <p>@<span>Oh no</span>
12178 </p>
12179 !! end
12180
12181 !! test
12182 pre-save transform: comment containing gallery (bug 5024)
12183 !! options
12184 pst
12185 !! wikitext
12186 <!-- <gallery>data</gallery> -->
12187 !! html/php
12188 <!-- <gallery>data</gallery> -->
12189 !!end
12190
12191 !! test
12192 pre-save transform: comment containing extension
12193 !! options
12194 pst
12195 !! wikitext
12196 <!-- <tag>data</tag> -->
12197 !! html/php
12198 <!-- <tag>data</tag> -->
12199 !!end
12200
12201 !! test
12202 pre-save transform: comment containing nowiki
12203 !! options
12204 pst
12205 !! wikitext
12206 <!-- <nowiki>data</nowiki> -->
12207 !! html/php
12208 <!-- <nowiki>data</nowiki> -->
12209 !!end
12210
12211 !! test
12212 pre-save transform: <noinclude> in subst (bug 3298)
12213 !! options
12214 pst
12215 !! wikitext
12216 {{subst:Includes}}
12217 !! html/php
12218 Foobar
12219 !! end
12220
12221 !! test
12222 pre-save transform: <onlyinclude> in subst (bug 3298)
12223 !! options
12224 pst
12225 !! wikitext
12226 {{subst:Includes2}}
12227 !! html/php
12228 Foo
12229 !! end
12230
12231 !! article
12232 Template:SubstTest
12233 !!text
12234 {{<includeonly>subst:</includeonly>Includes}}
12235 !! endarticle
12236
12237 !! article
12238 Template:SafeSubstTest
12239 !! text
12240 {{<includeonly>safesubst:</includeonly>Includes}}
12241 !! endarticle
12242
12243 !! test
12244 bug 22297: safesubst: works during PST
12245 !! options
12246 pst
12247 !! wikitext
12248 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12249 !! html/php
12250 FoobarFoobar
12251 !! end
12252
12253 !! test
12254 bug 22297: safesubst: works during normal parse
12255 !! wikitext
12256 {{SafeSubstTest}}
12257 !! html
12258 <p>Foobar
12259 </p>
12260 !! end
12261
12262 !! test
12263 subst: does not work during normal parse
12264 !! wikitext
12265 {{SubstTest}}
12266 !! html
12267 <p>{{subst:Includes}}
12268 </p>
12269 !! end
12270
12271 !! test
12272 pre-save transform: context links ("pipe trick")
12273 !! options
12274 pst
12275 !! wikitext
12276 [[Article (context)|]]
12277 [[Bar:Article|]]
12278 [[:Bar:Article|]]
12279 [[Bar:Article (context)|]]
12280 [[:Bar:Article (context)|]]
12281 [[|Article]]
12282 [[|Article (context)]]
12283 [[Bar:X (Y) Z|]]
12284 [[:Bar:X (Y) Z|]]
12285 !! html/php
12286 [[Article (context)|Article]]
12287 [[Bar:Article|Article]]
12288 [[:Bar:Article|Article]]
12289 [[Bar:Article (context)|Article]]
12290 [[:Bar:Article (context)|Article]]
12291 [[Article]]
12292 [[Article (context)]]
12293 [[Bar:X (Y) Z|X (Y) Z]]
12294 [[:Bar:X (Y) Z|X (Y) Z]]
12295 !! end
12296
12297 !! test
12298 pre-save transform: context links ("pipe trick") with interwiki prefix
12299 !! options
12300 pst
12301 !! wikitext
12302 [[interwiki:Article|]]
12303 [[:interwiki:Article|]]
12304 [[interwiki:Bar:Article|]]
12305 [[:interwiki:Bar:Article|]]
12306 !! html/php
12307 [[interwiki:Article|Article]]
12308 [[:interwiki:Article|Article]]
12309 [[interwiki:Bar:Article|Bar:Article]]
12310 [[:interwiki:Bar:Article|Bar:Article]]
12311 !! end
12312
12313 !! test
12314 pre-save transform: context links ("pipe trick") with parens in title
12315 !! options
12316 pst title=[[Somearticle (context)]]
12317 !! wikitext
12318 [[|Article]]
12319 !! html/php
12320 [[Article (context)|Article]]
12321 !! end
12322
12323 !! test
12324 pre-save transform: context links ("pipe trick") with comma in title
12325 !! options
12326 pst title=[[Someplace, Somewhere]]
12327 !! wikitext
12328 [[|Otherplace]]
12329 [[Otherplace, Elsewhere|]]
12330 [[Otherplace, Elsewhere, Anywhere|]]
12331 !! html/php
12332 [[Otherplace, Somewhere|Otherplace]]
12333 [[Otherplace, Elsewhere|Otherplace]]
12334 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12335 !! end
12336
12337 !! test
12338 pre-save transform: context links ("pipe trick") with parens and comma
12339 !! options
12340 pst title=[[Someplace (IGNORED), Somewhere]]
12341 !! wikitext
12342 [[|Otherplace]]
12343 [[Otherplace (place), Elsewhere|]]
12344 !! html/php
12345 [[Otherplace, Somewhere|Otherplace]]
12346 [[Otherplace (place), Elsewhere|Otherplace]]
12347 !! end
12348
12349 !! test
12350 pre-save transform: context links ("pipe trick") with comma and parens
12351 !! options
12352 pst title=[[Who, me? (context)]]
12353 !! wikitext
12354 [[|Yes, you.]]
12355 [[Me, Myself, and I (1937 song)|]]
12356 !! html/php
12357 [[Yes, you. (context)|Yes, you.]]
12358 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12359 !! end
12360
12361 !! test
12362 pre-save transform: context links ("pipe trick") with namespace
12363 !! options
12364 pst title=[[Ns:Somearticle]]
12365 !! wikitext
12366 [[|Article]]
12367 !! html/php
12368 [[Ns:Article|Article]]
12369 !! end
12370
12371 !! test
12372 pre-save transform: context links ("pipe trick") with namespace and parens
12373 !! options
12374 pst title=[[Ns:Somearticle (context)]]
12375 !! wikitext
12376 [[|Article]]
12377 !! html/php
12378 [[Ns:Article (context)|Article]]
12379 !! end
12380
12381 !! test
12382 pre-save transform: context links ("pipe trick") with namespace and comma
12383 !! options
12384 pst title=[[Ns:Somearticle, Context, Whatever]]
12385 !! wikitext
12386 [[|Article]]
12387 !! html/php
12388 [[Ns:Article, Context, Whatever|Article]]
12389 !! end
12390
12391 !! test
12392 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12393 !! options
12394 pst title=[[Ns:Somearticle, Context (context)]]
12395 !! wikitext
12396 [[|Article]]
12397 !! html/php
12398 [[Ns:Article (context)|Article]]
12399 !! end
12400
12401 !! test
12402 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12403 !! options
12404 pst title=[[Ns:Somearticle (IGNORED), Context]]
12405 !! wikitext
12406 [[|Article]]
12407 !! html/php
12408 [[Ns:Article, Context|Article]]
12409 !! end
12410
12411 !! test
12412 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12413 !! options
12414 pst
12415 !! wikitext
12416 [[Article(context)|]]
12417 [[Bar:Article(context)|]]
12418 [[:Bar:Article(context)|]]
12419 [[|Article(context)]]
12420 [[Bar:X(Y)Z|]]
12421 [[:Bar:X(Y)Z|]]
12422 !! html/php
12423 [[Article(context)|Article]]
12424 [[Bar:Article(context)|Article]]
12425 [[:Bar:Article(context)|Article]]
12426 [[Article(context)]]
12427 [[Bar:X(Y)Z|X(Y)Z]]
12428 [[:Bar:X(Y)Z|X(Y)Z]]
12429 !! end
12430
12431 !! test
12432 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12433 !! options
12434 pst
12435 !! wikitext
12436 [[Article (context)|]]
12437 [[Bar:Article (context)|]]
12438 [[:Bar:Article (context)|]]
12439 [[|Article (context)]]
12440 [[Bar:X (Y) Z|]]
12441 [[:Bar:X (Y) Z|]]
12442 !! html/php
12443 [[Article (context)|Article]]
12444 [[Bar:Article (context)|Article]]
12445 [[:Bar:Article (context)|Article]]
12446 [[Article (context)]]
12447 [[Bar:X (Y) Z|X (Y) Z]]
12448 [[:Bar:X (Y) Z|X (Y) Z]]
12449 !! end
12450
12451 !! test
12452 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12453 !! options
12454 pst
12455 !! wikitext
12456 [[Article(context)|]]
12457 [[Bar:Article(context)|]]
12458 [[:Bar:Article(context)|]]
12459 [[|Article(context)]]
12460 [[Bar:X(Y)Z|]]
12461 [[:Bar:X(Y)Z|]]
12462 !! html/php
12463 [[Article(context)|Article]]
12464 [[Bar:Article(context)|Article]]
12465 [[:Bar:Article(context)|Article]]
12466 [[Article(context)]]
12467 [[Bar:X(Y)Z|X(Y)Z]]
12468 [[:Bar:X(Y)Z|X(Y)Z]]
12469 !! end
12470
12471 !! test
12472 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12473 !! options
12474 pst
12475 !! wikitext
12476 [[Article (context), context|]]
12477 [[Article (context),context|]]
12478 [[Bar:Article (context), context|]]
12479 [[Bar:Article (context),context|]]
12480 [[:Bar:Article (context), context|]]
12481 [[:Bar:Article (context),context|]]
12482 !! html/php
12483 [[Article (context), context|Article]]
12484 [[Article (context),context|Article]]
12485 [[Bar:Article (context), context|Article]]
12486 [[Bar:Article (context),context|Article]]
12487 [[:Bar:Article (context), context|Article]]
12488 [[:Bar:Article (context),context|Article]]
12489 !! end
12490
12491 !! test
12492 pre-save transform: trim trailing empty lines
12493 !! options
12494 pst
12495 !! wikitext
12496 Empty lines are trimmed
12497
12498
12499
12500
12501 !! html/php
12502 Empty lines are trimmed
12503 !! end
12504
12505 !! test
12506 pre-save transform: Signature expansion
12507 !! options
12508 pst
12509 !! wikitext
12510 * ~~~
12511 * <noinclude>~~~</noinclude>
12512 * <includeonly>~~~</includeonly>
12513 * <onlyinclude>~~~</onlyinclude>
12514 !! html/php
12515 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12516 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12517 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12518 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12519 !! end
12520
12521
12522 !! test
12523 pre-save transform: Signature expansion in nowiki tags (bug 93)
12524 !! options
12525 pst disabled
12526 !! wikitext
12527 Shall not expand:
12528
12529 <nowiki>~~~~</nowiki>
12530
12531 <includeonly><nowiki>~~~~</nowiki></includeonly>
12532
12533 <noinclude><nowiki>~~~~</nowiki></noinclude>
12534
12535 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12536
12537 {{subst:Foo}} shall be converted to FOO
12538
12539 As well as inside noinclude/onlyinclude
12540 <noinclude>{{subst:Foo}}</noinclude>
12541 <onlyinclude>{{subst:Foo}}</onlyinclude>
12542
12543 But not inside includeonly
12544 <includeonly>{{subst:Foo}}</includeonly>
12545 !! html/php
12546 Shall not expand:
12547
12548 <nowiki>~~~~</nowiki>
12549
12550 <includeonly><nowiki>~~~~</nowiki></includeonly>
12551
12552 <noinclude><nowiki>~~~~</nowiki></noinclude>
12553
12554 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12555
12556 FOO shall be converted to FOO
12557
12558 As well as inside noinclude/onlyinclude
12559 <noinclude>FOO</noinclude>
12560 <onlyinclude>FOO</onlyinclude>
12561
12562 But not inside includeonly
12563 <includeonly>{{subst:Foo}}</includeonly>
12564 !! end
12565
12566 !! test
12567 Parsoid: Recognize nowiki with trailing space in tags
12568 !! options
12569 parsoid=wt2html
12570 !! wikitext
12571 <nowiki ><div>[[foo]]</nowiki >
12572
12573 a<nowiki / >b
12574
12575 c<nowiki />d
12576
12577 e<nowiki/ >f
12578 !! html
12579 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12580 <p>ab</p>
12581 <p>cd</p>
12582 <p>ef</p>
12583 !! end
12584
12585 !! test
12586 Parsoid: Recognize nowiki with odd capitalization
12587 !! options
12588 parsoid=wt2html
12589 !! wikitext
12590 <noWikI ><div>[[foo]]</Nowiki >
12591 !! html
12592 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12593 !! end
12594
12595
12596 !! test
12597 Parsoid: Escape nowiki with trailing space in tags
12598 !! options
12599 parsoid=html2wt
12600 !! html/parsoid
12601 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12602 <p>a&lt;nowiki /&gt;b</p>
12603 <p>c&lt;nowiki/ &gt;d</p>
12604 !! wikitext
12605 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12606
12607 a&lt;nowiki /&gt;b
12608
12609 c&lt;nowiki/ &gt;d
12610 !! end
12611
12612 !! test
12613 Parsoid: Escape weird noWikI capitalizations
12614 !! options
12615 parsoid=html2wt
12616 !! html/parsoid
12617 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12618 !! wikitext
12619 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12620 !! end
12621
12622 ###
12623 ### Message transform tests
12624 ###
12625 !! test
12626 message transform: magic variables
12627 !! options
12628 msg
12629 !! wikitext
12630 {{SITENAME}}
12631 !! html
12632 MediaWiki
12633 !! end
12634
12635 !! test
12636 message transform: should not transform wiki markup
12637 !! options
12638 msg
12639 !! wikitext
12640 ''test''
12641 !! html
12642 ''test''
12643 !! end
12644
12645 !! test
12646 message transform: <noinclude> in transcluded template (bug 4926)
12647 !! options
12648 msg
12649 !! wikitext
12650 {{Includes}}
12651 !! html
12652 Foobar
12653 !! end
12654
12655 !! test
12656 message transform: <onlyinclude> in transcluded template (bug 4926)
12657 !! options
12658 msg
12659 !! wikitext
12660 {{Includes2}}
12661 !! html
12662 Foo
12663 !! end
12664
12665 !! test
12666 {{#special:}} page name, known
12667 !! options
12668 msg
12669 !! wikitext
12670 {{#special:Recentchanges}}
12671 !! html
12672 Special:RecentChanges
12673 !! end
12674
12675 !! test
12676 {{#special:}} page name with subpage, known
12677 !! options
12678 msg
12679 !! wikitext
12680 {{#special:Recentchanges/param}}
12681 !! html
12682 Special:RecentChanges/param
12683 !! end
12684
12685 !! test
12686 {{#special:}} page name, unknown
12687 !! options
12688 msg
12689 !! wikitext
12690 {{#special:foobar nonexistent}}
12691 !! html
12692 Special:Foobar nonexistent
12693 !! end
12694
12695 !! test
12696 {{#speciale:}} page name, known
12697 !! options
12698 msg
12699 !! wikitext
12700 {{#speciale:Recentchanges}}
12701 !! html
12702 Special:RecentChanges
12703 !! end
12704
12705 !! test
12706 {{#speciale:}} page name with subpage, known
12707 !! options
12708 msg
12709 !! wikitext
12710 {{#speciale:Recentchanges/param}}
12711 !! html
12712 Special:RecentChanges/param
12713 !! end
12714
12715 !! test
12716 {{#speciale:}} page name, unknown
12717 !! options
12718 msg
12719 !! wikitext
12720 {{#speciale:foobar nonexistent}}
12721 !! html
12722 Special:Foobar_nonexistent
12723 !! end
12724
12725 ###
12726 ### Images
12727 ###
12728 ### For Parsoid-specific tests, see
12729 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12730
12731 !! test
12732 Simple image
12733 !! options
12734 parsoid=wt2html,wt2wt,html2html
12735 !! wikitext
12736 [[Image:foobar.jpg]]
12737 !! html/php
12738 <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>
12739 </p>
12740 !! html/parsoid
12741 <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>
12742 !! end
12743
12744 !! test
12745 Simple image (using File: namespace, now canonical)
12746 !! wikitext
12747 [[File:Foobar.jpg]]
12748 !! html/php
12749 <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>
12750 </p>
12751 !! html/parsoid
12752 <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>
12753 !! end
12754
12755 !! test
12756 Right-aligned image
12757 !! wikitext
12758 [[File:Foobar.jpg|right]]
12759 !! html/php
12760 <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>
12761
12762 !! html/parsoid
12763 <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>
12764 !! end
12765
12766 !! test
12767 Image with caption
12768 !! wikitext
12769 [[File:Foobar.jpg|right|Caption text]]
12770 !! html/php
12771 <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>
12772
12773 !! html/parsoid
12774 <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>
12775 !! end
12776
12777 !! test
12778 Image with caption, bug 53312 #1
12779 !! wikitext
12780 [[File:Foobar.jpg|right|Caption page stuff]]
12781 !! html/php
12782 <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>
12783
12784 !! html/parsoid
12785 <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>
12786 !! end
12787
12788 !! test
12789 Image with caption, bug 53312 #2
12790 !! wikitext
12791 [[File:Foobar.jpg|right|Caption page=]]
12792 !! html/php
12793 <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>
12794
12795 !! html/parsoid
12796 <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>
12797 !! end
12798
12799 !! test
12800 Image with caption, bug 53312 #3
12801 !! wikitext
12802 [[File:Foobar.jpg|right|Caption page=stuff]]
12803 !! html/php
12804 <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>
12805
12806 !! html/parsoid
12807 <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>
12808 !! end
12809
12810 !! test
12811 Allow empty links in image captions (Bug 60753)
12812 !! options
12813 thumbsize=220
12814 !! wikitext
12815 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12816 [[]]
12817 [[Link2]]
12818 ]]
12819 !! html/php
12820 <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>
12821
12822 !! html/parsoid
12823 <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>
12824 [[]]
12825 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12826 </figcaption></figure>
12827 !! end
12828
12829 !! test
12830 Titles in unlinked images (T23454)
12831 !! wikitext
12832 [[File:Foobar.jpg|link=|stuff]]
12833 !! html/php
12834 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12835 </p>
12836 !! end
12837
12838 !! test
12839 Link with empty target
12840 !! wikitext
12841 [[]]
12842 !! html
12843 <p>[[]]
12844 </p>
12845 !! end
12846
12847 !! test
12848 Image with link trail
12849 !! wikitext
12850 Linktrails should not work for images: [[File:Foobar.jpg]]s
12851 !! html/php
12852 <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
12853 </p>
12854 !! html/parsoid
12855 <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>
12856 !! end
12857
12858 !! test
12859 Image with empty attribute
12860 !! options
12861 parsoid=wt2html,wt2wt,html2html
12862 !! wikitext
12863 [[File:Foobar.jpg|right||Caption text]]
12864 !! html/php
12865 <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>
12866
12867 !! html/parsoid
12868 <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>
12869 !! end
12870
12871 !! test
12872 1. Block image with individual attributes from templates
12873 !! wikitext
12874 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12875 !! html/php
12876 <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>
12877
12878 !! html/parsoid
12879 <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>
12880 !! end
12881
12882 !! test
12883 2. Block Image with individual attributes from templates
12884 !! wikitext
12885 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12886 !! html/php
12887 <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>
12888
12889 !! html/parsoid
12890 <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>
12891 !! end
12892
12893 !! test
12894 3. Inline image with individual attributes from templates
12895 !! wikitext
12896 [[File:Foobar.jpg|{{echo|50px}}]]
12897 !! html/php
12898 <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>
12899 </p>
12900 !! html/parsoid
12901 <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>
12902 !! end
12903
12904 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12905 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12906 !! test
12907 Image with multiple attributes from the same template
12908 !! wikitext
12909 [[File:Foobar.jpg|{{image_attribs}}]]
12910 !! html/php
12911 <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>
12912
12913 !! html/parsoid
12914 <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>
12915 !! end
12916
12917 !! test
12918 Image with link tails
12919 !! options
12920 thumbsize=220
12921 !! wikitext
12922 123[[File:Foobar.jpg]]456
12923 123[[File:Foobar.jpg|right]]456
12924 123[[File:Foobar.jpg|thumb]]456
12925 !! html/php
12926 <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
12927 </p>
12928 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
12929 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
12930
12931 !! html/php+tidy
12932 <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>
12933 <p>123</p>
12934 <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>
12935 <p>456 123</p>
12936 <div class="thumb tright">
12937 <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>
12938 <div class="thumbcaption">
12939 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12940 </div>
12941 </div>
12942 </div>
12943 <p>456</p>
12944 !! html/parsoid
12945 <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>
12946 <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>
12947 <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>
12948 !! end
12949
12950 !! test
12951 Image with multiple captions -- only last one is accepted
12952 !! wikitext
12953 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12954 !! html/php
12955 <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>
12956
12957 !! html/parsoid
12958 <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>
12959 !! end
12960
12961 !! test
12962 Image with multiple widths -- use last
12963 !! wikitext
12964 [[File:Foobar.jpg|200px|300px|caption]]
12965 !! html/php
12966 <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>
12967 </p>
12968 !! html/parsoid
12969 <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>
12970 !! end
12971
12972 !! test
12973 Image with multiple alignments -- use first (bug 48664)
12974 !! options
12975 thumbsize=220
12976 !! wikitext
12977 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12978
12979 [[File:Foobar.jpg|middle|text-top|caption]]
12980 !! html/php
12981 <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>
12982 <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>
12983 </p>
12984 !! html/parsoid
12985 <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>
12986 <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>
12987 !! end
12988
12989 !! test
12990 Image with width attribute at different positions
12991 !! wikitext
12992 [[File:Foobar.jpg|200px|right|Caption]]
12993 [[File:Foobar.jpg|right|200px|Caption]]
12994 [[File:Foobar.jpg|right|Caption|200px]]
12995 !! html/php
12996 <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>
12997 <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>
12998 <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>
12999
13000 !! html/parsoid
13001 <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>
13002 <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>
13003 <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>
13004 !! end
13005
13006 # a sad bit of backward-compatibility
13007 !! test
13008 Image with size specified with pxpx (bug 13500, 51628)
13009 !! options
13010 parsoid=wt2html,wt2wt,html2html
13011 !! wikitext
13012 [[File:Foobar.jpg|20pxpx]]
13013 [[File:Foobar.jpg|200x20pxpx]]
13014 !! html/php
13015 <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>
13016 <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>
13017 </p>
13018 !! html/parsoid
13019 <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>
13020 !! end
13021
13022 !! test
13023 Image with link parameter, wiki target
13024 !! wikitext
13025 [[File:Foobar.jpg|link=Main Page]]
13026 !! html/php
13027 <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>
13028 </p>
13029 !! html/parsoid
13030 <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>
13031 !! end
13032
13033 # parsoid bug 49293 (part 1)
13034 !! test
13035 Image with link parameter, URL target
13036 !! wikitext
13037 [[File:Foobar.jpg|link=http://example.com/]]
13038 !! html/php
13039 <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>
13040 </p>
13041 !! html/parsoid
13042 <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>
13043 !! end
13044
13045 # parsoid bug 49293 (part 2)
13046 !! test
13047 Image with link parameter, protocol-less URL target
13048 !! wikitext
13049 [[File:Foobar.jpg|link=//example.com/]]
13050 !! html/php
13051 <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>
13052 </p>
13053 !! html/parsoid
13054 <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>
13055 !! end
13056
13057 !! test
13058 Escaping non-block captions (T107435)
13059 !! options
13060 parsoid={
13061 "modes": ["wt2wt"],
13062 "changes": [
13063 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13064 ]
13065 }
13066 !! wikitext
13067 [[Image:Foobar.jpg|caption]]
13068 !! wikitext/edited
13069 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13070 !! end
13071
13072 # wgExternalLinkTarget not supported by Parsoid
13073 !! test
13074 Image with link parameter, wgExternalLinkTarget
13075 !! wikitext
13076 [[Image:foobar.jpg|link=http://example.com/]]
13077 !! config
13078 wgExternalLinkTarget='foobar'
13079 !! html/php
13080 <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>
13081 </p>
13082 !! end
13083
13084 !! test
13085 Image with link parameter, wgNoFollowLinks set to false
13086 !! wikitext
13087 [[Image:foobar.jpg|link=http://example.com/]]
13088 !! config
13089 wgNoFollowLinks=false
13090 !! html
13091 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13092 </p>
13093 !! end
13094
13095 !! test
13096 Image with link parameter, wgNoFollowDomainExceptions
13097 !! wikitext
13098 [[Image:foobar.jpg|link=http://example.com/]]
13099 !! config
13100 wgNoFollowDomainExceptions='example.com'
13101 !! html
13102 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13103 </p>
13104 !! end
13105
13106 # wgExternalLinkTarget not supported by Parsoid
13107 !! test
13108 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13109 !! wikitext
13110 [[Image:foobar.jpg|link=http://example.com/|Title]]
13111 !! config
13112 wgExternalLinkTarget='foobar'
13113 !! html/php
13114 <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>
13115 </p>
13116 !! end
13117
13118 !! test
13119 Image with empty link parameter
13120 !! wikitext
13121 [[File:Foobar.jpg|link=]]
13122 !! html/php
13123 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13124 </p>
13125 !! html/parsoid
13126 <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>
13127 !! end
13128
13129 !! test
13130 Image with link parameter (wiki target) and unnamed parameter
13131 !! wikitext
13132 [[File:Foobar.jpg|link=Main_Page|Title]]
13133 !! html/php
13134 <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>
13135 </p>
13136 !! html/parsoid
13137 <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>
13138 !! end
13139
13140 !! test
13141 Image with link parameter (URL target) and unnamed parameter
13142 !! wikitext
13143 [[File:Foobar.jpg|link=http://example.com/|Title]]
13144 !! html/php
13145 <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>
13146 </p>
13147 !! html/parsoid
13148 <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>
13149 !! end
13150
13151 !! test
13152 Thumbnail image with link parameter
13153 !! options
13154 thumbsize=220
13155 parsoid=wt2html,wt2wt,html2html
13156 !! wikitext
13157 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13158 !! html/php
13159 <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>
13160
13161 !! html/parsoid
13162 <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>
13163 !! end
13164
13165 !! test
13166 Manually-specified thumbnail image
13167 !! options
13168 thumbsize=220
13169 !! wikitext
13170 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13171 !! html/php
13172 <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>
13173
13174 !! html/parsoid
13175 <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>
13176 !! end
13177
13178 !! test
13179 Manually-specified thumbnail image with explicit link to wiki page
13180 !! options
13181 thumbsize=220
13182 parsoid=wt2html,wt2wt,html2html
13183 !! wikitext
13184 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13185 !! html/php
13186 <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>
13187
13188 !! html/parsoid
13189 <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>
13190 !! end
13191
13192 !! test
13193 Manually-specified thumbnail image with explicit link to url
13194 !! options
13195 thumbsize=220
13196 parsoid=wt2html,wt2wt,html2html
13197 !! wikitext
13198 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13199 !! html/php
13200 <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>
13201
13202 !! html/parsoid
13203 <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>
13204 !! end
13205
13206 !! test
13207 Manually-specified thumbnail image with explicit no link
13208 !! options
13209 thumbsize=220
13210 parsoid=wt2html,wt2wt,html2html
13211 !! wikitext
13212 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13213 !! html/php
13214 <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>
13215
13216 !! html/parsoid
13217 <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>
13218 !! end
13219
13220 !! test
13221 Manually-specified thumbnail image with explicit link and alt text
13222 !! options
13223 thumbsize=220
13224 parsoid=wt2html,wt2wt,html2html
13225 !! wikitext
13226 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13227 !! html/php
13228 <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>
13229
13230 !! html/parsoid
13231 <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>
13232 !! end
13233
13234 !! test
13235 Image with frame and link
13236 !! options
13237 parsoid=wt2html,wt2wt,html2html
13238 !! wikitext
13239 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13240 !! html/php
13241 <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>
13242
13243 !! html/parsoid
13244 <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>
13245 !! end
13246
13247 !! test
13248 Image with frame and link and explicit alt
13249 !! options
13250 parsoid=wt2html,wt2wt,html2html
13251 !! wikitext
13252 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13253 !! html/php
13254 <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>
13255
13256 !! html/parsoid
13257 <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>
13258 !! end
13259
13260 !! test
13261 Image with wiki markup in implicit alt
13262 !! wikitext
13263 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13264
13265 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13266 !! html/php
13267 <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>
13268 </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>
13269 </p>
13270 !! html/parsoid
13271 <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>
13272 <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>
13273 !! end
13274
13275 !! test
13276 Alt image option should handle most kinds of wikitext without barfing
13277 !! wikitext
13278 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13279 !! html/php
13280 <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>
13281
13282 !! html/parsoid
13283 <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>
13284 !! end
13285
13286 ###################
13287 # Conflicting image format options.
13288 # First option specified should 'win'.
13289 # All three cases in each test should be identical.
13290
13291 !! test
13292 Image with 'frameless' first.
13293 !! options
13294 parsoid=wt2html,wt2wt,html2html
13295 !! wikitext
13296 [[File:Foobar.jpg|frameless|caption]]
13297
13298 [[File:Foobar.jpg|frameless|frame|caption]]
13299
13300 [[File:Foobar.jpg|frameless|thumb|caption]]
13301 !! html/php
13302 <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>
13303 </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>
13304 </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>
13305 </p>
13306 !! html/parsoid
13307 <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>
13308 <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>
13309 <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>
13310 !! end
13311
13312 !! test
13313 Image with 'frame' first.
13314 !! options
13315 parsoid=wt2html,wt2wt,html2html
13316 !! wikitext
13317 [[File:Foobar.jpg|frame|caption]]
13318 [[File:Foobar.jpg|frame|frameless|caption]]
13319 [[File:Foobar.jpg|frame|thumb|caption]]
13320 !! html/php
13321 <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>
13322 <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>
13323 <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>
13324
13325 !! html/parsoid
13326 <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>
13327 <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>
13328 <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>
13329 !! end
13330
13331 !! test
13332 Image with 'thumb' first.
13333 !! options
13334 parsoid=wt2html,wt2wt,html2html
13335 !! wikitext
13336 [[File:Foobar.jpg|thumb|caption]]
13337 [[File:Foobar.jpg|thumb|frameless|caption]]
13338 [[File:Foobar.jpg|thumb|frame|caption]]
13339 !! html/php
13340 <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>
13341 <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>
13342 <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>
13343
13344 !! html/parsoid
13345 <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>
13346 <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>
13347 <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>
13348 !! end
13349
13350 ###################
13351 # Image sizing.
13352 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13353 # and https://phabricator.wikimedia.org/T64258
13354 # Foobar has actual size of 1941x220
13355 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13356 # a scalable format.
13357 # 2. Framed images always ignore size options; always render at default size.
13358 # 3. "Unspecified format" and border are the only types which can be
13359 # enlarged.
13360
13361 !! test
13362 Image: "unspecified format" and border enlarge
13363 !! options
13364 parsoid=wt2html,wt2wt,html2html
13365 !! wikitext
13366 [[File:Foobar.jpg|2000px]]
13367
13368 [[File:Foobar.jpg|border|2000px]]
13369 !! html/php
13370 <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>
13371 </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>
13372 </p>
13373 !! html/parsoid
13374 <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>
13375 <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>
13376 !! end
13377
13378 !! test
13379 Image: "unspecified format" and border reduce
13380 !! options
13381 parsoid=wt2html,wt2wt,html2html
13382 !! wikitext
13383 [[File:Foobar.jpg|1000px]]
13384
13385 [[File:Foobar.jpg|border|1000px]]
13386 !! html/php
13387 <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>
13388 </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>
13389 </p>
13390 !! html/parsoid
13391 <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>
13392 <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>
13393 !! end
13394
13395 !! test
13396 Image: thumbs reduce
13397 !! options
13398 parsoid=wt2html,wt2wt,html2html
13399 !! wikitext
13400 [[File:Foobar.jpg|thumb|50px]]
13401 !! html/php
13402 <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>
13403
13404 !! html/parsoid
13405 <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>
13406 !! end
13407
13408 !! test
13409 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13410 !! options
13411 parsoid=wt2html,wt2wt,html2html
13412 !! wikitext
13413 [[File:Foobar.jpg|thumb|2000px]]
13414
13415 [[File:Foobar.svg|thumb|2000px]]
13416 !! html/php
13417 <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>
13418 <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>
13419
13420 !! html/parsoid
13421 <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>
13422 <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>
13423 !! end
13424
13425 !! test
13426 Image: frameless can reduce in size
13427 !! options
13428 parsoid=wt2html,wt2wt,html2html
13429 !! wikitext
13430 [[File:Foobar.jpg|frameless|50px]]
13431 !! html/php
13432 <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>
13433 </p>
13434 !! html/parsoid
13435 <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>
13436 !! end
13437
13438 !! test
13439 Image: bitmap frameless can't be enlarged past original size, but vector can
13440 !! options
13441 parsoid=wt2html,wt2wt,html2html
13442 !! wikitext
13443 [[File:Foobar.jpg|frameless|2000px]]
13444
13445 [[File:Foobar.svg|frameless|2000px]]
13446 !! html/php
13447 <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>
13448 </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>
13449 </p>
13450 !! html/parsoid
13451 <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>
13452 <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>
13453 !! end
13454
13455 !! test
13456 Image: framed images are always unscaled.
13457 !! options
13458 parsoid=wt2html,wt2wt,html2html
13459 !! wikitext
13460 [[File:Foobar.jpg|frame]]
13461
13462 [[File:Foobar.jpg|frame|50px]]
13463
13464 [[File:Foobar.jpg|frame|50x50px]]
13465
13466 [[File:Foobar.jpg|frame|2000px]]
13467 !! html/php
13468 <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>
13469 <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>
13470 <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>
13471 <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>
13472
13473 !! html/parsoid
13474 <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>
13475 <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>
13476 <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>
13477 <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>
13478 !! end
13479
13480 ###################
13481
13482 !! test
13483 Link to image page- image page normally doesn't exists, hence edit link
13484 Add test with existing image page
13485 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13486 !! wikitext
13487 [[:Image:test]]
13488 !! html
13489 <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>
13490 </p>
13491 !! end
13492
13493 !! test
13494 bug 18784 Link to non-existent image page with caption should use caption as link text
13495 !! wikitext
13496 [[:Image:test|caption]]
13497 !! html
13498 <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>
13499 </p>
13500 !! end
13501
13502 !! test
13503 Frameless image caption with a free URL
13504 !! wikitext
13505 [[File:Foobar.jpg|http://example.com]]
13506 !! html/php
13507 <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>
13508 </p>
13509 !! html/parsoid
13510 <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>
13511 !! end
13512
13513 !! test
13514 Thumbnail image caption with a free URL
13515 !! options
13516 thumbsize=220
13517 !! wikitext
13518 [[File:Foobar.jpg|thumb|http://example.com]]
13519 !! html/php
13520 <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>
13521
13522 !! html/parsoid
13523 <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>
13524 !! end
13525
13526 !! test
13527 Thumbnail image caption with a free URL and explicit alt
13528 !! options
13529 thumbsize=220
13530 parsoid=wt2html,wt2wt,html2html
13531 !! wikitext
13532 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13533 !! html/php
13534 <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>
13535
13536 !! html/parsoid
13537 <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>
13538 !! end
13539
13540 !! test
13541 SVG thumbnails with no language set
13542 !! options
13543 !! wikitext
13544 [[File:Foobar.svg|thumb|caption]]
13545 !! html/php
13546 <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>
13547
13548 !! html/parsoid
13549 <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>
13550 !! end
13551
13552 !! test
13553 SVG thumbnails with language de
13554 !! options
13555 parsoid=wt2html,wt2wt,html2html
13556 !! wikitext
13557 [[File:Foobar.svg|thumb|caption|lang=de]]
13558 !! html/php
13559 <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>
13560
13561 !! html/parsoid
13562 <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>
13563 !! end
13564
13565 !! test
13566 SVG thumbnails with invalid language code
13567 !! options
13568 parsoid=wt2html,wt2wt,html2html
13569 !! wikitext
13570 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13571 !! html/php
13572 <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>
13573
13574 !! html/parsoid
13575 <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>
13576 !! end
13577
13578 !! test
13579 BUG 1887: A ISBN with a thumbnail
13580 !! wikitext
13581 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13582 !! html/php
13583 <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>
13584
13585 !! html/parsoid
13586 <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>
13587 !! end
13588
13589 !! test
13590 BUG 1887: A RFC with a thumbnail
13591 !! wikitext
13592 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13593 !! html/php
13594 <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>
13595
13596 !! html/parsoid
13597 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
13598 !! end
13599
13600 !! test
13601 BUG 1887: A mailto link with a thumbnail
13602 !! wikitext
13603 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13604 !! html/php
13605 <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>
13606
13607 !! html/parsoid
13608 <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>
13609 !! end
13610
13611 # Pending resolution to bug 368
13612 !! test
13613 BUG 648: Frameless image caption with a link
13614 !! wikitext
13615 [[File:Foobar.jpg|text with a [[link]] in it]]
13616 !! html/php
13617 <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>
13618 </p>
13619 !! html/parsoid
13620 <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>
13621 !! end
13622
13623 !! test
13624 BUG 648: Frameless image caption with a link (suffix)
13625 !! wikitext
13626 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13627 !! html/php
13628 <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>
13629 </p>
13630 !! html/parsoid
13631 <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>
13632 !! end
13633
13634 !! test
13635 BUG 648: Frameless image caption with an interwiki link
13636 !! wikitext
13637 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13638 !! html/php
13639 <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>
13640 </p>
13641 !! html/parsoid
13642 <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>
13643 !! end
13644
13645 !! test
13646 BUG 648: Frameless image caption with a piped interwiki link
13647 !! wikitext
13648 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13649 !! html/php
13650 <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>
13651 </p>
13652 !! html/parsoid
13653 <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>
13654 !! end
13655
13656 !! test
13657 T107474: Frameless image caption with <nowiki>
13658 !! wikitext
13659 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13660 !! html/parsoid
13661 <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>
13662 !! end
13663
13664 !! test
13665 Escape HTML special chars in image alt text
13666 !! wikitext
13667 [[File:Foobar.jpg|& < > "]]
13668 !! html/php
13669 <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>
13670 </p>
13671 !! html/parsoid
13672 <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>
13673 !! end
13674
13675 !! test
13676 BUG 499: Alt text should have &#1234;, not &amp;1234;
13677 !! wikitext
13678 [[File:Foobar.jpg|&#9792;]]
13679 !! html/php
13680 <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>
13681 </p>
13682 !! html/parsoid
13683 <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>
13684 !! end
13685
13686 !! test
13687 Broken image caption with link
13688 !! options
13689 parsoid=wt2html,wt2wt,html2html
13690 !! wikitext
13691 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13692 !! html/php
13693 <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.
13694 </p>
13695 !! html/parsoid
13696 <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>
13697 !! end
13698
13699 !! test
13700 Image caption containing another image
13701 !! wikitext
13702 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13703 !! html/php
13704 <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>
13705
13706 !! html/parsoid
13707 <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>
13708 !! end
13709
13710 !! test
13711 Image: caption containing a newline
13712 !! wikitext
13713 [[File:Foobar.jpg|This
13714 *is some text]]
13715 !! html/php
13716 <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>
13717 </p>
13718 !! html/parsoid
13719 <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>
13720 !!end
13721
13722 !!test
13723 Image: caption containing leading space
13724 (The leading space should not trigger nowiki escaping in wt2wt mode)
13725 !! wikitext
13726 [[File:Foobar.jpg|thumb| bar]]
13727 !! html/php
13728 <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>
13729
13730 !! html/parsoid
13731 <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>
13732 !!end
13733
13734 !! test
13735 Image: caption containing a table
13736 !! options
13737 parsoid=wt2html,wt2wt,html2html
13738 !! wikitext
13739 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13740 {|
13741 ! Foo !! Bar
13742 |-
13743 | Foo1 || Bar1
13744 |}
13745 and some more text.]]
13746 !! html/php
13747 <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>
13748
13749 !! html/parsoid
13750 <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
13751 <table>
13752 <tbody>
13753 <tr><th>Foo </th><th>Bar</th></tr>
13754 <tr>
13755 <td>Foo1 </td>
13756 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13757 !! end
13758
13759 !! test
13760 Bug 3090: External links other than http: in image captions
13761 !! wikitext
13762 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13763 !! html/php
13764 <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>
13765
13766 !! html/parsoid
13767 <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>
13768 !! end
13769
13770 !! test
13771 Custom class
13772 !! options
13773 parsoid=wt2html,wt2wt,html2html
13774 !! wikitext
13775 [[Image:foobar.jpg|a|class=b]]
13776 !! html/php
13777 <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>
13778 </p>
13779 !! html/parsoid
13780 <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>
13781 !! end
13782
13783 !! test
13784 Localized image handling (1).
13785 !! options
13786 parsoid=wt2html,wt2wt,html2html
13787 language=es
13788 !! wikitext
13789 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13790 !! html/php
13791 <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>
13792
13793 !! html/parsoid
13794 <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>
13795 !! end
13796
13797 !! test
13798 Localized image handling (2).
13799 !! options
13800 thumbsize=220
13801 parsoid=wt2html,wt2wt,html2html
13802 language=es
13803 !! wikitext
13804 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13805 !! html/php
13806 <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>
13807
13808 !! html/parsoid
13809 <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>
13810 !! end
13811
13812 !! test
13813 "border", "frameless" and "class" attributes on an image.
13814 !! options
13815 thumbsize=220
13816 parsoid=wt2html,wt2wt,html2html
13817 !! wikitext
13818 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13819 !! html/php
13820 <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>
13821 </p>
13822 !! html/parsoid
13823 <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>
13824 !! end
13825
13826 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13827 !! test
13828 Invalid image attributes (bug 62500)
13829 !! options
13830 thumbsize=220
13831 parsoid=wt2html,wt2wt,html2html
13832 !! wikitext
13833 [[File:Foobar.jpg|thumb|float|left|caption]]
13834
13835 [[File:Foobar.jpg|thumb|righ|caption]]
13836
13837 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13838 !! html/php
13839 <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>
13840 <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>
13841 <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>
13842
13843 !! html/parsoid
13844 <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>
13845 <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>
13846 <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>
13847 !! end
13848
13849 !! article
13850 File:Barfoo.jpg
13851 !! text
13852 #REDIRECT [[File:Barfoo.jpg]]
13853 !! endarticle
13854
13855 # FIXME: Parsoid should run this test -- but we'd need to teach the
13856 # mockAPI about the redirected Barfoo.jpg image.
13857 !! test
13858 Redirected image
13859 !! wikitext
13860 [[Image:Barfoo.jpg]]
13861 !! html/php
13862 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13863 </p>
13864 !! end
13865
13866 !! test
13867 Missing image with uploads disabled
13868 !! options
13869 wgEnableUploads=0
13870 !! wikitext
13871 [[File:Foobaz.jpg]]
13872 !! html/php
13873 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13874 </p>
13875 !! html/parsoid
13876 <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>
13877 !! end
13878
13879 # Parsoid-specific testing for images
13880 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13881 # Currently imperfect due to a flaw in the Parsoid testrunner
13882 # Work in progress
13883 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13884 # image tests.
13885
13886 !! test
13887 Parsoid-specific image handling - simple image with size and middle alignment
13888 !! wikitext
13889 [[File:Foobar.jpg|middle|50px]]
13890 !! html/parsoid
13891 <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>
13892 !! end
13893
13894 !! test
13895 Parsoid-specific image handling - simple image with size, middle alignment,
13896 non-standard namespace alias
13897 !! options
13898 parsoid=wt2wt,wt2html,html2html
13899 !! wikitext
13900 [[Image:Foobar.jpg|middle|50px]]
13901 !! html/parsoid
13902 <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>
13903 !! end
13904
13905 !! test
13906 Parsoid-specific image handling - simple image with size and middle alignment
13907 (existing content)
13908 !! wikitext
13909 [[File:Foobar.jpg|50px|middle]]
13910 !! html/parsoid
13911 <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>
13912 !! end
13913
13914 !! test
13915 Parsoid-specific image handling - simple image with size and middle alignment
13916 and non-standard namespace name
13917 !! options
13918 parsoid=wt2html,wt2wt,html2html
13919 !! wikitext
13920 [[Image:Foobar.jpg|50px|middle]]
13921 !! html/parsoid
13922 <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>
13923 !! end
13924
13925 !! test
13926 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13927 !! wikitext
13928 [[File:Foobar.jpg|500x10px|baseline|caption]]
13929 !! html/parsoid
13930 <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>
13931 !! end
13932
13933 !! test
13934 Parsoid-specific image handling - simple image with border and size spec
13935 !! wikitext
13936 [[File:Foobar.jpg|50px|border|caption]]
13937 !! html/parsoid
13938 <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>
13939 !! end
13940
13941 !! test
13942 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13943 !! wikitext
13944 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13945 !! html/parsoid
13946 <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>
13947 !! end
13948
13949 !! test
13950 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13951 (existing content)
13952 !! wikitext
13953 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13954 !! html/parsoid
13955 <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>
13956 !! end
13957
13958 !! test
13959 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13960 !! wikitext
13961 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13962 !! html/parsoid
13963 <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>
13964 !! end
13965
13966 !! test
13967 Parsoid-specific image handling - thumbnail with specific size, halign,
13968 valign, and caption (existing content)
13969 !! wikitext
13970 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13971 !! html/parsoid
13972 <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>
13973 !! end
13974
13975 !! test
13976 Parsoid-specific image handling - framed image with specific size and caption
13977 (size is ignored)
13978 !! options
13979 parsoid=wt2html,wt2wt,html2html
13980 !! wikitext
13981 [[File:Foobar.jpg|frame|500x50px|caption]]
13982 !! html/parsoid
13983 <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>
13984 !! end
13985
13986 !! test
13987 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13988 (size is ignored)
13989 !! options
13990 parsoid=wt2html,wt2wt,html2html
13991 !! wikitext
13992 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13993 !! html/parsoid
13994 <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>
13995 !! end
13996
13997 !! test
13998 Parsoid-specific image handling - frameless image with specific size, border, and caption
13999 !! wikitext
14000 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14001 !! html/parsoid
14002 <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>
14003 !! end
14004
14005 !! test
14006 Parsoid-specific image handling - simple image with a formatted caption
14007 !! wikitext
14008 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14009 !! html/parsoid
14010 <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>
14011 !! end
14012
14013 !! test
14014 Parsoid-specific image handling - caption with a template in it
14015 !! wikitext
14016 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14017 !! html/parsoid
14018 <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>
14019 !! end
14020
14021 !! test
14022 Parsoid-specific image handling - caption with unbalanced tags in it
14023 !! options
14024 parsoid=wt2html,wt2wt,html2html
14025 !! wikitext
14026 foo
14027 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14028 bar
14029 !! html/parsoid
14030 <p>foo</p>
14031 <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>
14032 <p>bar</p>
14033 !! end
14034
14035 !! test
14036 Parsoid-specific image handling - empty caption (1)
14037 !! options
14038 parsoid=wt2html,wt2wt
14039 !! wikitext
14040 [[File:Foobar.jpg|thumb|]]
14041 !! html/parsoid
14042 <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>
14043 !! end
14044
14045 # empty captions don't get serialized unless we're in the "round trip" case
14046 !! test
14047 Parsoid-specific image handling - empty caption (2)
14048 !! options
14049 parsoid=html2wt
14050 !! html/parsoid
14051 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14052 <a href="./File:Foobar.jpg">
14053 <img resource="./File:Foobar.jpg"
14054 src="//example.com/images/3/3a/Foobar.jpg"
14055 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14056 height="25" width="220"/>
14057 </a>
14058 <figcaption></figcaption>
14059 </figure>
14060 !! wikitext
14061 [[File:Foobar.jpg|thumb]]
14062 !! end
14063
14064 !! test
14065 Parsoid-specific image handling - whitespace caption
14066 !! wikitext
14067 [[File:Foobar.jpg|thumb| ]]
14068 !! html/parsoid
14069 <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>
14070 !! end
14071
14072 !! test
14073 Parsoid-specific image handling - lang option
14074 !! wikitext
14075 foo
14076 [[File:Foobar.svg|lang=de|caption]]
14077 bar
14078 !! html/parsoid
14079 <p>foo
14080 <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>
14081 bar</p>
14082 !! end
14083
14084 ## Edge case bugs in Parsoid from T93580
14085 !! test
14086 T93580: 1. Templated <ref> inside block images
14087 !! wikitext
14088 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14089
14090 <references />
14091 !! html/parsoid
14092 <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>
14093
14094 <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>
14095 !! end
14096
14097 !! test
14098 T93580: 2. <ref> inside inline images
14099 !! wikitext
14100 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14101
14102 <references />
14103 !! html/parsoid
14104 <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>
14105
14106 <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>
14107 !! end
14108
14109 !! test
14110 T93580: 3. Templated <ref> inside inline images
14111 !! wikitext
14112 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14113
14114 <references />
14115 !! html/parsoid
14116 <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>
14117
14118 <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>
14119 !! end
14120
14121 ###
14122 ### Subpages
14123 ###
14124 !! article
14125 Subpage test/subpage
14126 !! text
14127 foo
14128 !! endarticle
14129
14130 !! test
14131 Subpage link
14132 !! options
14133 subpage title=[[Subpage test]]
14134 !! wikitext
14135 [[/subpage]]
14136 !! html
14137 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14138 </p>
14139 !! end
14140
14141 !! test
14142 Subpage noslash link
14143 !! options
14144 subpage title=[[Subpage test]]
14145 !! wikitext
14146 [[/subpage/]]
14147 !! html
14148 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14149 </p>
14150 !! end
14151
14152 !! article
14153 Subpage test/1/2/subpage
14154 !! text
14155 blah
14156 !! endarticle
14157
14158 !! test
14159 Relative subpage noslash link
14160 !! options
14161 parsoid=wt2wt,wt2html,html2html
14162 subpage title=[[Subpage test/1/2/3/4]]
14163 !! wikitext
14164 [[../../subpage/]]
14165
14166 [[../../subpage]]
14167 !! html/php
14168 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14169 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14170 </p>
14171 !! html/parsoid
14172 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14173 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14174 !! end
14175
14176 !! test
14177 Parsoid: dot-slash prefixed wikilinks
14178 !! wikitext
14179 [[./foo]]
14180
14181 [[././bar]]
14182
14183 [[././baz/]]
14184 !! html/php
14185 <p>[[./foo]]
14186 </p><p>[[././bar]]
14187 </p><p>[[././baz/]]
14188 </p>
14189 !! html/parsoid
14190 <p>[[./foo]]
14191 </p><p>[[././bar]]
14192 </p><p>[[././baz/]]
14193 </p>
14194 !! end
14195
14196 !! test
14197 Render invalid page names as plain text (bug 51090)
14198 !! wikitext
14199 [[./../foo|bar]]
14200 [[foo�|bar]]
14201 [[foo/.|bar]]
14202 [[foo/..|bar]]
14203 [[foo~~~bar]]
14204 [[foo>bar]]
14205 [[foo[bar]]
14206 [[.]]
14207 [[..]]
14208 [[foo././bar]]
14209
14210 [[{{echo|./../foo}}|bar]]
14211 [[{{echo|foo/.}}|bar]]
14212 [[{{echo|foo/..}}|bar]]
14213 [[{{echo|foo~~~~bar}}]]
14214 [[{{echo|foo>bar}}]]
14215 [[{{echo|foo././bar}}]]
14216 [[{{echo|foo{bar}}]]
14217 [[{{echo|foo}bar}}]]
14218 [[{{echo|foo[bar}}]]
14219 [[{{echo|foo]bar}}]]
14220 [[{{echo|foo<bar}}]]
14221 !!html/php
14222 <p>[[./../foo|bar]]
14223 [[foo�|bar]]
14224 [[foo/.|bar]]
14225 [[foo/..|bar]]
14226 [[foo~~~bar]]
14227 [[foo&gt;bar]]
14228 [[foo[bar]]
14229 [[.]]
14230 [[..]]
14231 [[foo././bar]]
14232 </p><p>[[./../foo|bar]]
14233 [[foo/.|bar]]
14234 [[foo/..|bar]]
14235 [[foo~~~~bar]]
14236 [[foo&gt;bar]]
14237 [[foo././bar]]
14238 [[foo{bar]]
14239 [[foo}bar]]
14240 [[foo[bar]]
14241 [[foo]bar]]
14242 [[foo&lt;bar]]
14243 </p>
14244 !!html/parsoid
14245 <p>[[./../foo|bar]]
14246 [[foo�|bar]]
14247 [[foo/.|bar]]
14248 [[foo/..|bar]]
14249 [[foo~~~bar]]
14250 [[foo>bar]]
14251 [[foo[bar]]
14252 [[.]]
14253 [[..]]
14254 [[foo././bar]]</p>
14255
14256 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14257 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14258 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14259 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14260 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14261 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14262 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14263 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14264 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14265 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14266 [[<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>
14267 !!end
14268
14269 !! test
14270 Disabled subpages
14271 !! wikitext
14272 [[/subpage]]
14273 !! html
14274 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14275 </p>
14276 !! end
14277
14278 !! test
14279 BUG 561: {{/Subpage}}
14280 !! options
14281 subpage title=[[Page]]
14282 !! wikitext
14283 {{/Subpage}}
14284 !! html
14285 <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>
14286 </p>
14287 !! end
14288
14289 ###
14290 ### Categories
14291 ###
14292 !! article
14293 Category:MediaWiki User's Guide
14294 !! text
14295 blah
14296 !! endarticle
14297
14298 !! test
14299 Link to category
14300 !! wikitext
14301 [[:Category:MediaWiki User's Guide]]
14302 !! html
14303 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14304 </p>
14305 !! end
14306
14307 !! test
14308 Simple category
14309 !! options
14310 cat
14311 !! wikitext
14312 [[Category:MediaWiki User's Guide]]
14313 !! html
14314 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14315 !! end
14316
14317 !! test
14318 PAGESINCATEGORY invalid title fatal (r33546 fix)
14319 !! wikitext
14320 {{PAGESINCATEGORY:<bogus>}}
14321 !! html
14322 <p>0
14323 </p>
14324 !! end
14325
14326 !! test
14327 Category with different sort key
14328 !! options
14329 cat
14330 !! wikitext
14331 [[Category:MediaWiki User's Guide|Foo]]
14332 !! html
14333 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14334 !! end
14335
14336 !! test
14337 Category with identical sort key
14338 !! options
14339 cat
14340 !! wikitext
14341 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14342 !! html
14343 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14344 !! end
14345
14346 !! test
14347 Category with empty sort key
14348 !! options
14349 cat
14350 pst
14351 !! wikitext
14352 [[Category:MediaWiki User's Guide|]]
14353 !! html/php
14354 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14355 !! end
14356
14357 !! test
14358 Category with empty sort key and parentheses
14359 !! options
14360 cat
14361 pst
14362 !! wikitext
14363 [[Category:Foo (bar)|]]
14364 !! html/php
14365 [[Category:Foo (bar)|Foo]]
14366 !! end
14367
14368 ## We used to, but no longer wt2wt this test since the default serializer
14369 ## will normalize all categories to serialize on their own line.
14370 ## This wikitext usage is going to be fairly uncommon in production and
14371 ## selser will take care of preserving formatting in those scenarios.
14372 !! test
14373 Category with link tail
14374 !! options
14375 cat
14376 pst
14377 parsoid=wt2html
14378 !! wikitext
14379 123[[Category:Foo]]456
14380 !! html/php
14381 123[[Category:Foo]]456
14382 !! html/parsoid
14383 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14384 !! end
14385
14386 !! test
14387 Category with template
14388 !! options
14389 cat
14390 pst
14391 !! wikitext
14392 [[Category:{{echo|Foo}}]]
14393 !! html/php
14394 [[Category:{{echo|Foo}}]]
14395 !! end
14396
14397 !! test
14398 Category with template in sort key
14399 !! options
14400 cat
14401 pst
14402 !! wikitext
14403 [[Category:Foo|{{echo|Bar}}]]
14404 !! html/php
14405 [[Category:Foo|{{echo|Bar}}]]
14406 !! end
14407
14408 !! test
14409 Category with template in sort key and title
14410 !! options
14411 cat
14412 pst
14413 !! wikitext
14414 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14415 !! html/php
14416 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14417 !! end
14418
14419 ## We used to, but no longer wt2wt this test since the default serializer
14420 ## will normalize all categories to serialize on their own line.
14421 ## This wikitext usage is going to be fairly uncommon in production and
14422 ## selser will take care of preserving formatting in those scenarios.
14423 !! test
14424 Category / paragraph interactions
14425 !! options
14426 parsoid=wt2html
14427 !! wikitext
14428 Foo [[Category:Baz]] Bar
14429
14430 Foo [[Category:Baz]]
14431 Bar
14432
14433 Foo
14434 [[Category:Baz]]
14435 Bar
14436
14437 Foo
14438 [[Category:Baz]] Bar
14439
14440 Foo
14441 [[Category:Baz]]
14442 [[Category:Baz]]
14443 [[Category:Baz]]
14444 Bar
14445
14446 [[Category:Baz]]
14447 [[Category:Baz]]
14448 [[Category:Baz]]
14449
14450 [[Category:Baz]]
14451 {{echo|[[Category:Baz]]}}
14452 [[Category:Baz]]
14453 !! html/php
14454 <p>Foo Bar
14455 </p><p>Foo
14456 Bar
14457 </p><p>Foo
14458 Bar
14459 </p><p>Foo Bar
14460 </p><p>Foo
14461 Bar
14462 </p>
14463 !! html/parsoid
14464 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14465 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14466 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14467 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14468 <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>
14469 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14470 !! end
14471
14472 ## We used to, but no longer wt2wt this test since the default serializer
14473 ## will normalize all categories to serialize on their own line.
14474 ## This wikitext usage is going to be fairly uncommon in production and
14475 ## selser will take care of preserving formatting in those scenarios.
14476 ##
14477 ## The whitespace on the empty line is part of the test. Please do not delete
14478 !! test
14479 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14480 !! options
14481 parsoid=wt2html
14482 !! wikitext
14483 This
14484
14485 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14486
14487 {{echo|[[Category:Foo]] and so should this!}}
14488 !! html/php
14489 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14490 </p>
14491 !! html/parsoid
14492 <p>This
14493
14494 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14495
14496 <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>
14497 !! end
14498
14499 ## Parsoid will not try to wt2wt this while preserving newlines because
14500 ## it suppresses excess newlines within list items -- and we don't want to
14501 ## introduce a special case just for categories, which is, in reality somewhat
14502 ## odd behavior -- categories are unlikely to be used in list items like this
14503 ## in top-level pages and are only likely to show up in template-generated
14504 ## list items where this RT-ing is a non-issue.
14505 ##
14506 ## The whitespace on the empty line is part of the test. Please do not delete
14507 !! test
14508 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14509 !! options
14510 parsoid=wt2html
14511 !! wikitext
14512 * This
14513
14514 [[Category:Foo]] and this should be part of the same list item
14515 * So should this
14516
14517 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14518 !! html
14519 <ul><li>This and this should be part of the same list item</li>
14520 <li>So should this and this should be part of the same list item</li></ul>
14521 !! html/parsoid
14522 <ul>
14523 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14524 <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>
14525 </ul>
14526 !! end
14527
14528 ## Newlines and categories that follow the last item of a list
14529 ## are treated differently because this (list followed by categories)
14530 ## is an extremely common pattern on wikis.
14531 !! test
14532 3. Categories and newlines: newline suppression for last list item should RT properly
14533 !! wikitext
14534 * a
14535 * b
14536
14537 [[Category:Foo]]
14538
14539 [[Category:Bar]]
14540 [[Category:Baz]]
14541 !! html/parsoid
14542 <ul><li> a</li>
14543 <li> b</li></ul>
14544
14545 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14546
14547 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14548 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14549 !! end
14550
14551 !! test
14552 4. Categories and newlines: newline suppression for last list item should RT properly
14553 !! wikitext
14554 * a
14555 **** b
14556
14557 [[Category:Foo]]
14558 !! html/parsoid
14559 <ul><li> a
14560 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14561
14562 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14563 !! end
14564
14565 ## only wt2html for this to make sure the algo only applies to the rightmost path
14566 !! test
14567 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14568 !! options
14569 parsoid=wt2html
14570 !! wikitext
14571 * a
14572 ** b
14573 [[Category:Foo]]
14574 * c
14575 ** d
14576 [[Category:Foo]]
14577 !! html/parsoid
14578 <ul><li> a
14579 <ul><li> b
14580 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14581 <li> c
14582 <ul><li> d</li></ul></li></ul>
14583 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14584 !! end
14585
14586 ## We used to, but no longer wt2wt this test since the default serializer
14587 ## will normalize all categories to serialize on their own line.
14588 ## This wikitext usage is going to be fairly uncommon in production and
14589 ## selser will take care of preserving formatting in those scenarios.
14590 !! test
14591 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14592 !! options
14593 parsoid=wt2html
14594 !! wikitext
14595 * a [[Category:Foo]]
14596 !! html/parsoid
14597 <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>
14598 !! end
14599
14600 # This test also demonstrates because of newline+category tunneling
14601 # through the list hander, template wrapping doesn't expand to the
14602 # containing list when the list item swallows the category.
14603 !! test
14604 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14605 !! wikitext
14606 * {{echo|a
14607 [[Category:Foo]]}}
14608 !! html/parsoid
14609 <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
14610 </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>
14611 !! end
14612
14613 !! test
14614 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14615 !! wikitext
14616 * a
14617
14618 {{echo|[[Category:Foo]]
14619 [[Category:Bar]]}}
14620 [[Category:Baz]]
14621 !! html/parsoid
14622 <ul><li> a</li></ul>
14623
14624 <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">
14625 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14626 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14627 !! end
14628
14629 !! test
14630 Parsoid: Serialize link to category page with colon escape
14631 !! options
14632 parsoid
14633 !! wikitext
14634
14635 [[:Category:Foo]]
14636 [[:Category:Foo|Bar]]
14637 !! html
14638 <p>
14639 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14640 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14641 </p>
14642 !! end
14643
14644 # We used to, but no longer wt2wt this test since the default serializer
14645 # will normalize all categories to serialize on their own line.
14646 # This wikitext usage is going to be fairly uncommon in production and
14647 # selser will take care of preventing whitespace insertion if this
14648 # occurs in an article.
14649 #
14650 # html2html disabled for the same reason (whitespace insertion between
14651 # x and y).
14652 #
14653 # html2wt disabled because it localizes the "Category" namespace.
14654 !! test
14655 Link prefix/suffixes aren't applied to category links
14656 !! options
14657 parsoid=wt2html
14658 language=is
14659 !! wikitext
14660 x[[Category:Foo]]y
14661 !! html/php
14662 <p>xy
14663 </p>
14664 !! html/parsoid
14665 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14666 !! end
14667
14668 !! test
14669 Parsoid: Serialize link to file page with colon escape
14670 !! options
14671 parsoid
14672 !! wikitext
14673
14674 [[:File:Foo.png]]
14675 [[:File:Foo.png|Bar]]
14676 !! html
14677 <p>
14678 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14679 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14680 </p>
14681 !! end
14682
14683 !! test
14684 Parsoid: Serialize a genuine category link without colon escape
14685 !! options
14686 parsoid
14687 !! wikitext
14688 [[Category:Foo]]
14689 [[Category:Foo|Bar]]
14690 !! html
14691 <link rel="mw:PageProp/Category" href="./Category:Foo">
14692 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14693 !! end
14694
14695 !! test
14696 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14697 !! options
14698 parsoid=html2wt
14699 !! html/parsoid
14700 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14701 !! wikitext
14702 [[Category:Toxine bactérienne]]
14703 !! end
14704
14705 !! test
14706 Parsoid: Defaultsort
14707 !! wikitext
14708 {{DEFAULTSORT:Foo}}
14709 !! html/parsoid
14710 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14711 !! end
14712
14713 !! test
14714 Parsoid: Defaultsort (template-generated)
14715 !! wikitext
14716 {{{{echo|DEFAULTSORT}}:Foo}}
14717 !! html/parsoid
14718 <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}}]}'/>
14719 !! end
14720
14721 ###
14722 ### Inter-language links
14723 ###
14724 !! test
14725 Interlanguage links
14726 !! options
14727 ill
14728 !! wikitext
14729 [[es:Alimento]]
14730 [[fr:Nourriture]]
14731 [[zh:食品]]
14732 !! html/php
14733 es:Alimento fr:Nourriture zh:食品
14734 !! html/parsoid
14735 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14736 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14737 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14738 !! end
14739
14740 !! test
14741 Duplicate interlanguage links (bug 24502)
14742 !! options
14743 ill
14744 !! wikitext
14745 [[es:1]]
14746 [[es:2]]
14747 [[fr:1]]
14748 [[fr:2]]
14749 !! html/php
14750 es:1 fr:1
14751 !! html/parsoid
14752 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14753 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14754 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14755 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14756 !! end
14757
14758 ###
14759 ### Sections
14760 ###
14761 !! test
14762 Basic section headings
14763 !! wikitext
14764 == Headline 1 ==
14765 Some text
14766
14767 ==Headline 2==
14768 More
14769 ===Smaller headline===
14770 Blah blah
14771 !! html
14772 <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>
14773 <p>Some text
14774 </p>
14775 <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>
14776 <p>More
14777 </p>
14778 <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>
14779 <p>Blah blah
14780 </p>
14781 !! end
14782
14783 !! test
14784 Section headings with TOC
14785 !! wikitext
14786 == Headline 1 ==
14787 === Subheadline 1 ===
14788 ===== Skipping a level =====
14789 ====== Skipping a level ======
14790
14791 == Headline 2 ==
14792 Some text
14793 ===Another headline===
14794 !! html
14795 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14796 <ul>
14797 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14798 <ul>
14799 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14800 <ul>
14801 <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>
14802 <ul>
14803 <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>
14804 </ul>
14805 </li>
14806 </ul>
14807 </li>
14808 </ul>
14809 </li>
14810 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14811 <ul>
14812 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14813 </ul>
14814 </li>
14815 </ul>
14816 </div>
14817
14818 <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>
14819 <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>
14820 <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>
14821 <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>
14822 <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>
14823 <p>Some text
14824 </p>
14825 <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>
14826
14827 !! end
14828
14829 !! test
14830 TOC anchors don't collide
14831 !! wikitext
14832 __FORCETOC__
14833 == Headline 2 ==
14834 == Headline ==
14835 == Headline 2 ==
14836 == Headline ==
14837 !! html/php
14838 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14839 <ul>
14840 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14841 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14842 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14843 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14844 </ul>
14845 </div>
14846
14847 <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>
14848 <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>
14849 <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>
14850 <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>
14851
14852 !! end
14853
14854 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14855 !! test
14856 Handling of sections up to level 6 and beyond
14857 !! wikitext
14858 = Level 1 Heading=
14859 == Level 2 Heading==
14860 === Level 3 Heading===
14861 ==== Level 4 Heading====
14862 ===== Level 5 Heading=====
14863 ====== Level 6 Heading======
14864 ======= Level 7 Heading=======
14865 ======== Level 8 Heading========
14866 ========= Level 9 Heading=========
14867 ========== Level 10 Heading==========
14868 !! html
14869 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14870 <ul>
14871 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14872 <ul>
14873 <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>
14874 <ul>
14875 <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>
14876 <ul>
14877 <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>
14878 <ul>
14879 <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>
14880 <ul>
14881 <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>
14882 <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>
14883 <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>
14884 <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>
14885 <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>
14886 </ul>
14887 </li>
14888 </ul>
14889 </li>
14890 </ul>
14891 </li>
14892 </ul>
14893 </li>
14894 </ul>
14895 </li>
14896 </ul>
14897 </div>
14898
14899 <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>
14900 <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>
14901 <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>
14902 <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>
14903 <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>
14904 <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>
14905 <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>
14906 <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>
14907 <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>
14908 <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>
14909
14910 !! end
14911
14912 !! test
14913 TOC regression (T11764)
14914 !! wikitext
14915 == title 1 ==
14916 === title 1.1 ===
14917 ==== title 1.1.1 ====
14918 === title 1.2 ===
14919 == title 2 ==
14920 === title 2.1 ===
14921 !! html
14922 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14923 <ul>
14924 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14925 <ul>
14926 <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>
14927 <ul>
14928 <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>
14929 </ul>
14930 </li>
14931 <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>
14932 </ul>
14933 </li>
14934 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14935 <ul>
14936 <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>
14937 </ul>
14938 </li>
14939 </ul>
14940 </div>
14941
14942 <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>
14943 <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>
14944 <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>
14945 <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>
14946 <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>
14947 <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>
14948
14949 !! end
14950
14951 !! test
14952 TOC for heading containing <span id="..."></span> (T96153)
14953 !! wikitext
14954 __FORCETOC__
14955 ==<span id="old-anchor"></span>New title==
14956 !! html/php
14957 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14958 <ul>
14959 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14960 </ul>
14961 </div>
14962
14963 <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>
14964
14965 !! end
14966
14967 !! test
14968 TOC with wgMaxTocLevel=3 (bug 6204)
14969 !! options
14970 wgMaxTocLevel=3
14971 !! wikitext
14972 == title 1 ==
14973 === title 1.1 ===
14974 ==== title 1.1.1 ====
14975 === title 1.2 ===
14976 == title 2 ==
14977 === title 2.1 ===
14978 !! html
14979 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14980 <ul>
14981 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14982 <ul>
14983 <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>
14984 <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>
14985 </ul>
14986 </li>
14987 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14988 <ul>
14989 <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>
14990 </ul>
14991 </li>
14992 </ul>
14993 </div>
14994
14995 <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>
14996 <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>
14997 <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>
14998 <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>
14999 <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>
15000 <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>
15001
15002 !! end
15003
15004 !! test
15005 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15006 !! options
15007 wgMaxTocLevel=3
15008 !! wikitext
15009 ==Section 1==
15010 ===Section 1.1===
15011 ====Section 1.1.1====
15012 ====Section 1.1.1.1====
15013 ==Section 2==
15014 !! html
15015 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15016 <ul>
15017 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15018 <ul>
15019 <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>
15020 </ul>
15021 </li>
15022 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15023 </ul>
15024 </div>
15025
15026 <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>
15027 <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>
15028 <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>
15029 <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>
15030 <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>
15031
15032 !! end
15033
15034
15035 !! test
15036 Resolving duplicate section names
15037 !! wikitext
15038 == Foo bar ==
15039 == Foo bar ==
15040 !! html
15041 <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>
15042 <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>
15043
15044 !! end
15045
15046 !! test
15047 Resolving duplicate section names with differing case (bug 10721)
15048 !! wikitext
15049 == Foo bar ==
15050 == Foo Bar ==
15051 !! html
15052 <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>
15053 <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>
15054
15055 !! end
15056
15057 !! article
15058 Template:sections
15059 !! text
15060 ===Section 1===
15061 ==Section 2==
15062 !! endarticle
15063
15064 !! test
15065 Template with sections, __NOTOC__
15066 !! wikitext
15067 __NOTOC__
15068 ==Section 0==
15069 {{sections}}
15070 ==Section 4==
15071 !! html
15072 <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>
15073 <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>
15074 <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>
15075 <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>
15076
15077 !! end
15078
15079 !! test
15080 __NOEDITSECTION__ keyword
15081 !! wikitext
15082 __NOEDITSECTION__
15083 ==Section 1==
15084 ==Section 2==
15085 !! html
15086 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15087 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15088
15089 !! end
15090
15091 !! test
15092 Link inside a section heading
15093 !! wikitext
15094 ==Section with a [[Main Page|link]] in it==
15095 !! html
15096 <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>
15097
15098 !! end
15099
15100 !! test
15101 TOC regression (T14077)
15102 !! wikitext
15103 __TOC__
15104 == title 1 ==
15105 === title 1.1 ===
15106 == title 2 ==
15107 !! html
15108 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15109 <ul>
15110 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15111 <ul>
15112 <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>
15113 </ul>
15114 </li>
15115 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15116 </ul>
15117 </div>
15118
15119 <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>
15120 <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>
15121 <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>
15122
15123 !! end
15124
15125 !! test
15126 BUG 1219 URL next to image (good)
15127 !! wikitext
15128 http://example.com [[File:Foobar.jpg]]
15129 !! html/php
15130 <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>
15131 </p>
15132 !! html/parsoid
15133 <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>
15134 !!end
15135
15136 !! test
15137 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15138 !! wikitext
15139 ===
15140 The line above must have a trailing space!
15141 === <!--
15142 --> <!-- -->
15143 But just in case it doesn't...
15144 !! html
15145 <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>
15146 <p>The line above must have a trailing space!
15147 </p>
15148 <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>
15149 <p>But just in case it doesn't...
15150 </p>
15151 !! end
15152
15153 !! test
15154 Header with special characters (bug 25462)
15155 !! wikitext
15156 The tooltips shall not show entities to the user (ie. be double escaped)
15157
15158 == text > text ==
15159 section 1
15160
15161 == text < text ==
15162 section 2
15163
15164 == text & text ==
15165 section 3
15166
15167 == text ' text ==
15168 section 4
15169
15170 == text " text ==
15171 section 5
15172 !! html
15173 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15174 </p>
15175 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15176 <ul>
15177 <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>
15178 <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>
15179 <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>
15180 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15181 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15182 </ul>
15183 </div>
15184
15185 <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>
15186 <p>section 1
15187 </p>
15188 <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>
15189 <p>section 2
15190 </p>
15191 <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>
15192 <p>section 3
15193 </p>
15194 <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>
15195 <p>section 4
15196 </p>
15197 <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>
15198 <p>section 5
15199 </p>
15200 !! end
15201
15202 !! test
15203 Header with space, plus and underscore as entity
15204 !! wikitext
15205 Id should not contain + for spaces
15206
15207 == Space between Text ==
15208 section 1
15209
15210 == Space-Entity&#32;between&#32;Text ==
15211 section 2
15212
15213 == Plus+between+Text ==
15214 section 3
15215
15216 == Plus-Entity&#43;between&#43;Text ==
15217 section 4
15218
15219 == Underscore_between_Text ==
15220 section 5
15221
15222 == Underscore-Entity&#95;between&#95;Text ==
15223 section 6
15224
15225 [[#Space between Text]]
15226 [[#Space-Entity&#32;between&#32;Text]]
15227 [[#Plus+between+Text]]
15228 [[#Plus-Entity&#43;between&#43;Text]]
15229 [[#Underscore_between_Text]]
15230 [[#Underscore-Entity&#95;between&#95;Text]]
15231 !! html
15232 <p>Id should not contain + for spaces
15233 </p>
15234 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15235 <ul>
15236 <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>
15237 <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>
15238 <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>
15239 <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>
15240 <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>
15241 <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>
15242 </ul>
15243 </div>
15244
15245 <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>
15246 <p>section 1
15247 </p>
15248 <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>
15249 <p>section 2
15250 </p>
15251 <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>
15252 <p>section 3
15253 </p>
15254 <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>
15255 <p>section 4
15256 </p>
15257 <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>
15258 <p>section 5
15259 </p>
15260 <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>
15261 <p>section 6
15262 </p><p><a href="#Space_between_Text">#Space between Text</a>
15263 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15264 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15265 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15266 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15267 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15268 </p>
15269 !! end
15270
15271 !! test
15272 Headers with excess '=' characters
15273 (Are similar tests necessary beyond the 1st level?)
15274 !! wikitext
15275 =foo==
15276 ==foo=
15277 =''italic'' heading==
15278 ==''italic'' heading=
15279 !! html
15280 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15281 <ul>
15282 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15283 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15284 <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>
15285 <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>
15286 </ul>
15287 </div>
15288
15289 <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>
15290 <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>
15291 <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>
15292 <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>
15293
15294 !! end
15295
15296 !! test
15297 HTML headers vs TOC (bug 23393)
15298 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15299 !! wikitext
15300 <h1>Header 1</h1>
15301 == Header 1.1 ==
15302 == Header 1.2 ==
15303
15304 <h1>Header 2
15305 </h1>
15306 == Header 2.1 ==
15307 == Header 2.2 ==
15308 __NOEDITSECTION__
15309 !! html
15310 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15311 <ul>
15312 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15313 <ul>
15314 <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>
15315 <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>
15316 </ul>
15317 </li>
15318 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15319 <ul>
15320 <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>
15321 <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>
15322 </ul>
15323 </li>
15324 </ul>
15325 </div>
15326
15327 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15328 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15329 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15330 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15331 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15332 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15333
15334 !! end
15335
15336 !! test
15337 Single-line or multiline-comments can follow headings
15338 !! options
15339 parsoid=wt2html,wt2wt
15340 !! wikitext
15341 ==foo==<!---->
15342 ==bar==<!--c1-->
15343 ==baz==<!--
15344 c2
15345 c3-->
15346 !! html
15347 <h2><span class="mw-headline" id="foo">foo</span></h2>
15348 <h2><span class="mw-headline" id="bar">bar</span></h2>
15349 <h2><span class="mw-headline" id="baz">baz</span></h2>
15350
15351 !! end
15352
15353 !! test
15354 BUG 1219 URL next to image (broken)
15355 !! wikitext
15356 http://example.com[[File:Foobar.jpg]]
15357 !! html/php
15358 <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>
15359 </p>
15360 !! html/parsoid
15361 <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>
15362 !!end
15363
15364 !! test
15365 Bug 1186 news: in the middle of text
15366 !! wikitext
15367 http://en.wikinews.org/wiki/Wikinews:Workplace
15368 !! html
15369 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15370 </p>
15371 !!end
15372
15373
15374 !! test
15375 Namespaced link must have a title
15376 !! wikitext
15377 [[Project:]]
15378 !! html
15379 <p>[[Project:]]
15380 </p>
15381 !!end
15382
15383 !! test
15384 Namespaced link must have a title (bad fragment version)
15385 !! wikitext
15386 [[Project:#fragment]]
15387 !! html
15388 <p>[[Project:#fragment]]
15389 </p>
15390 !!end
15391
15392
15393 ###
15394 ### HTML tags and HTML attributes
15395 ###
15396
15397 !! test
15398 div with no attributes
15399 !! wikitext
15400 <div>HTML rocks</div>
15401 !! html
15402 <div>HTML rocks</div>
15403
15404 !! end
15405
15406 !! test
15407 div with double-quoted attribute
15408 !! wikitext
15409 <div id="rock">HTML rocks</div>
15410 !! html
15411 <div id="rock">HTML rocks</div>
15412
15413 !! end
15414
15415 !! test
15416 div with single-quoted attribute
15417 !! wikitext
15418 <div id='rock'>HTML rocks</div>
15419 !! html
15420 <div id="rock">HTML rocks</div>
15421
15422 !! end
15423
15424 !! test
15425 div with unquoted 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 illegal double attributes
15435 !! wikitext
15436 <div id="a" id="b">HTML rocks</div>
15437 !! html
15438 <div id="b">HTML rocks</div>
15439
15440 !!end
15441
15442 # FIXME: produce empty string instead of "class" in the PHP parser, following
15443 # the HTML5 spec.
15444 !! test
15445 div with empty attribute value, space before equals
15446 !! options
15447 parsoid
15448 !! wikitext
15449 <div class =>HTML rocks</div>
15450 !! html
15451 <div class="">HTML rocks</div>
15452
15453 !! end
15454
15455 !! test
15456 div with multiple empty attribute values
15457 !! options
15458 parsoid
15459 !! wikitext
15460 <div id= title=>HTML rocks</div>
15461 !! html
15462 <div id="" title="">HTML rocks</div>
15463
15464 !! end
15465
15466 !! test
15467 table with multiple empty attribute values
15468 !! options
15469 parsoid
15470 !! wikitext
15471 {| title= id=
15472 | hi
15473 |}
15474 !! html
15475 <table title="" id="">
15476 <tbody><tr><td> hi</td></tr>
15477 </tbody></table>
15478 !! end
15479
15480 !! test
15481 div with braces in attribute value
15482 !! wikitext
15483 <div title="{}">Foo</div>
15484 !! html/php
15485 <div title="&#123;}">Foo</div>
15486
15487 !! html/parsoid
15488 <div title="{}">Foo</div>
15489 !! end
15490
15491 # This it very inconsistent in the PHP parser: it returns
15492 # class="class" if there is a space between the name and the equal sign (see
15493 # 'div with empty attribute value, space before equals'), but strips the
15494 # attribute completely if the space is missing. We hope that not much content
15495 # depends on this, so are implementing the behavior below in Parsoid for
15496 # consistencies' sake.
15497 # FIXME: fix this behavior in the PHP parser?
15498 !! test
15499 div with empty attribute value, no space before equals
15500 !! options
15501 parsoid=wt2html,html2html
15502 !! wikitext
15503 <div class=>HTML rocks</div>
15504 !! html/php
15505 <div>HTML rocks</div>
15506
15507 !! html/parsoid
15508 <div class="">HTML rocks</div>
15509 !! end
15510
15511 !! test
15512 HTML multiple attributes correction
15513 !! wikitext
15514 <p class="error" class="awesome">Awesome!</p>
15515 !! html
15516 <p class="awesome">Awesome!</p>
15517
15518 !!end
15519
15520 !! test
15521 Table multiple attributes correction
15522 !! wikitext
15523 {|
15524 !+ class="error" class="awesome"| status
15525 |}
15526 !! html
15527 <table>
15528 <tr>
15529 <th class="awesome"> status
15530 </th></tr></table>
15531
15532 !!end
15533
15534 !! test
15535 DIV IN UPPERCASE
15536 !! wikitext
15537 <DIV ID="x">HTML ROCKS</DIV>
15538 !! html
15539 <div id="x">HTML ROCKS</div>
15540
15541 !!end
15542
15543 !! test
15544 Non-ASCII pseudo-tags are rendered as text
15545 !! wikitext
15546 <khyô>
15547 !! html
15548 <p>&lt;khyô&gt;
15549 </p>
15550 !! end
15551
15552 !! test
15553 Pseudo-tag with URL 'name' renders as url link
15554 !! wikitext
15555 <http://example.com/>
15556 !! html
15557 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15558 </p>
15559 !! end
15560
15561 !! test
15562 text with amp in the middle of nowhere
15563 !! wikitext
15564 Remember AT&T?
15565 !! html
15566 <p>Remember AT&amp;T?
15567 </p>
15568 !! end
15569
15570 !! test
15571 text with character entity: eacute
15572 !! wikitext
15573 I always thought &eacute; was a cute letter.
15574 !! html
15575 <p>I always thought &#233; was a cute letter.
15576 </p>
15577 !! html+tidy
15578 <p>I always thought é was a cute letter.</p>
15579 !! end
15580
15581 !! test
15582 text with entity-escaped character entity-like string: eacute
15583 !! wikitext
15584 I always thought &amp;eacute; was a cute letter.
15585 !! html
15586 <p>I always thought &amp;eacute; was a cute letter.
15587 </p>
15588 !! end
15589
15590 !! test
15591 text with undefined character entity: xacute
15592 !! wikitext
15593 I always thought &xacute; was a cute letter.
15594 !! html
15595 <p>I always thought &amp;xacute; was a cute letter.
15596 </p>
15597 !! end
15598
15599 !! test
15600 HTML5 tags
15601 !! wikitext
15602 <data value="5">five</data>
15603 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15604 <mark>This highlighted text</mark>
15605 !! html
15606 <p><data value="5">five</data>
15607 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15608 <mark>This highlighted text</mark>
15609 </p>
15610 !! end
15611
15612 !! test
15613 HTML tag with leading space is parsed as text
15614 !! wikitext
15615 < div>foo< /div>
15616 !! html
15617 <p>&lt; div&gt;foo&lt; /div&gt;
15618 </p>
15619 !! end
15620
15621 ###
15622 ### Nesting tests (see bug 41545, 50604, 51081)
15623 ###
15624
15625 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15626 # Note that html2wt is considerably more difficult if we use <b> in
15627 # the test case, instead of <big>
15628 !! test
15629 Ensure that HTML adoption agency algorithm is properly implemented.
15630 !! wikitext
15631 <big>X<big>Y</big>Z</big>
15632 !! html
15633 <p><big>X<big>Y</big>Z</big>
15634 </p>
15635 !! end
15636
15637 # This was bug 41545 in the PHP parser.
15638 # Note that tidy doesn't handle this correctly.
15639 !! test
15640 Nesting of <kbd>
15641 !! wikitext
15642 <kbd>X<kbd>Y</kbd>Z</kbd>
15643 !! html
15644 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15645 </p>
15646 !! end
15647
15648 # The following cases were bug 51081 in the PHP parser.
15649 # Note that there are some other nestable tags (b, i, etc) which are
15650 # not covered; see bug 51081 for discussion.
15651
15652 # Note that tidy doesn't handle this correctly.
15653 !! test
15654 Nesting of <em>
15655 !! wikitext
15656 <em>X<em>Y</em>Z</em>
15657 !! html
15658 <p><em>X<em>Y</em>Z</em>
15659 </p>
15660 !! end
15661
15662 # Note that tidy doesn't handle this correctly.
15663 !! test
15664 Nesting of <strong>
15665 !! wikitext
15666 <strong>X<strong>Y</strong>Z</strong>
15667 !! html
15668 <p><strong>X<strong>Y</strong>Z</strong>
15669 </p>
15670 !! end
15671
15672 !! test
15673 Nesting of <q>
15674 !! wikitext
15675 <q>X<q>Y</q>Z</q>
15676 !! html+tidy
15677 <p><q>X<q>Y</q>Z</q></p>
15678 !! end
15679
15680 # Note that tidy doesn't handle this correctly.
15681 !! test
15682 Nesting of <ruby>
15683 !! wikitext
15684 <ruby>X<ruby>Y</ruby>Z</ruby>
15685 !! html
15686 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15687 </p>
15688 !! end
15689
15690 # Note that tidy doesn't handle this correctly.
15691 !! test
15692 Nesting of <bdo>
15693 !! wikitext
15694 <bdo>X<bdo>Y</bdo>Z</bdo>
15695 !! html
15696 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15697 </p>
15698 !! end
15699
15700
15701 ###
15702 ### Media links
15703 ###
15704
15705 !! test
15706 Media link
15707 !! wikitext
15708 [[Media:Foobar.jpg]]
15709 !! html
15710 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15711 </p>
15712 !! end
15713
15714 !! test
15715 Media link with text
15716 !! wikitext
15717 [[Media:Foobar.jpg|A neat file to look at]]
15718 !! html
15719 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15720 </p>
15721 !! end
15722
15723 # FIXME: this is still bad HTML tag nesting
15724 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15725 !! test
15726 Media link with nasty text
15727 !! wikitext
15728 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15729 !! html
15730 <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>
15731
15732 !! html+tidy
15733 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15734 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15735 !! end
15736
15737 !! test
15738 Media link to nonexistent file (bug 1702)
15739 !! wikitext
15740 [[Media:No such.jpg]]
15741 !! html
15742 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15743 </p>
15744 !! end
15745
15746 !! test
15747 Image link to nonexistent file (bug 1850 - good)
15748 !! wikitext
15749 [[File:No_such.jpg]]
15750 !! html/php
15751 <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>
15752 </p>
15753 !! html/parsoid
15754 <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>
15755 !! end
15756
15757 !! test
15758 :Image link to nonexistent file (bug 1850 - bad)
15759 !! wikitext
15760 [[:Image:No such.jpg]]
15761 !! html/php
15762 <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>
15763 </p>
15764 !! html/parsoid
15765 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15766 !! end
15767
15768
15769
15770 !! test
15771 Character reference normalization in link text (bug 1938)
15772 !! wikitext
15773 [[Main Page|this&that]]
15774 !! html
15775 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15776 </p>
15777 !!end
15778
15779 !! article
15780 אַ
15781 !! text
15782 Test for unicode normalization
15783
15784 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15785 !! endarticle
15786
15787 !! test
15788 (bug 19451) Links should refer to the normalized form.
15789 !! wikitext
15790 [[&#xFB2E;]]
15791 [[&#x5d0;&#x5b7;]]
15792 [[&#x5d0;ַ]]
15793 [[א&#x5b7;]]
15794 [[אַ]]
15795 !! html
15796 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15797 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15798 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15799 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15800 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15801 </p>
15802 !! end
15803
15804 !! test
15805 Empty attribute crash test (bug 2067)
15806 !! wikitext
15807 <font color="">foo</font>
15808 !! html
15809 <p><font color="">foo</font>
15810 </p>
15811 !! end
15812
15813 !! test
15814 Empty attribute crash test single-quotes (bug 2067)
15815 !! wikitext
15816 <font color=''>foo</font>
15817 !! html
15818 <p><font color="">foo</font>
15819 </p>
15820 !! end
15821
15822 !! test
15823 Attribute test: equals, then nothing
15824 !! wikitext
15825 <font color=>foo</font>
15826 !! html
15827 <p><font>foo</font>
15828 </p>
15829 !! end
15830
15831 !! test
15832 Attribute test: unquoted value
15833 !! wikitext
15834 <font color=x>foo</font>
15835 !! html
15836 <p><font color="x">foo</font>
15837 </p>
15838 !! end
15839
15840 !! test
15841 Attribute test: unquoted but illegal value (hash)
15842 !! wikitext
15843 <font color=#x>foo</font>
15844 !! html
15845 <p><font color="#x">foo</font>
15846 </p>
15847 !! end
15848
15849 # Parsoid does not serialize to empty attribute syntax,
15850 # so wt2wt and html2wt cases are skipped
15851 !! test
15852 Attribute test: no value (T54330)
15853 !! options
15854 parsoid=wt2html,html2html
15855 !! wikitext
15856 <font color>foo</font>
15857 !! html/php
15858 <p><font color="">foo</font>
15859 </p>
15860 !! html/parsoid
15861 <p><font color="">foo</font></p>
15862 !! end
15863
15864 !! test
15865 Bug 2095: link with three closing brackets
15866 !! wikitext
15867 [[Main Page]]]
15868 !! html/php
15869 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15870 </p>
15871 !! html/parsoid
15872 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15873 !! end
15874
15875 !! test
15876 Bug 2095: link with pipe and three closing brackets
15877 !! wikitext
15878 [[Main Page|link]]]
15879 !! html/php
15880 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15881 </p>
15882 !! html/parsoid
15883 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15884 !! end
15885
15886 !! test
15887 Bug 2095: link with pipe and three closing brackets, version 2
15888 !! wikitext
15889 [[Main Page|[http://example.com/]]]
15890 !! html/php
15891 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15892 </p>
15893 !! html/parsoid
15894 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15895 !! end
15896
15897
15898 ###
15899 ### Safety
15900 ###
15901
15902 !! article
15903 Template:Dangerous attribute
15904 !! text
15905 " onmouseover="alert(document.cookie)
15906 !! endarticle
15907
15908 !! article
15909 Template:Dangerous style attribute
15910 !! text
15911 border-size: expression(alert(document.cookie))
15912 !! endarticle
15913
15914 !! article
15915 Template:Div style
15916 !! text
15917 <div style="float: right; {{{1}}}">Magic div</div>
15918 !! endarticle
15919
15920 !! test
15921 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15922 !! wikitext
15923 <div title="{{test}}"></div>
15924 !! html
15925 <div title="This is a test template"></div>
15926
15927 !! end
15928
15929 # Parsoid has enough context to handle this case
15930 !! test
15931 Bug 2304: HTML attribute safety (dangerous template; 2309)
15932 !! wikitext
15933 <div title="{{dangerous attribute}}"></div>
15934 !! html/php
15935 <div title=""></div>
15936
15937 !! html/parsoid
15938 <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>
15939 !! end
15940
15941 !! test
15942 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15943 !! wikitext
15944 <div style="{{dangerous style attribute}}"></div>
15945 !! html
15946 <div style="/* insecure input */"></div>
15947
15948 !! end
15949
15950 !! test
15951 Bug 2304: HTML attribute safety (safe parameter; 2309)
15952 !! wikitext
15953 {{div style|width: 200px}}
15954 !! html
15955 <div style="float: right; width: 200px">Magic div</div>
15956
15957 !! end
15958
15959 !! test
15960 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15961 !! wikitext
15962 {{div style|width: expression(alert(document.cookie))}}
15963 !! html
15964 <div style="/* insecure input */">Magic div</div>
15965
15966 !! end
15967
15968 !! test
15969 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15970 !! wikitext
15971 {{div style|"><script>alert(document.cookie)</script>}}
15972 !! html
15973 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15974
15975 !! end
15976
15977 !! test
15978 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15979 !! wikitext
15980 {{div style|" ><script>alert(document.cookie)</script>}}
15981 !! html
15982 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15983
15984 !! end
15985
15986 !! test
15987 Bug 2304: HTML attribute safety (link)
15988 !! wikitext
15989 <div title="[[Main Page]]"></div>
15990 !! html
15991 <div title="&#91;&#91;Main Page]]"></div>
15992
15993 !! end
15994
15995 !! test
15996 Bug 2304: HTML attribute safety (italics)
15997 !! wikitext
15998 <div title="''foobar''"></div>
15999 !! html
16000 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16001
16002 !! end
16003
16004 !! test
16005 Bug 2304: HTML attribute safety (bold)
16006 !! wikitext
16007 <div title="'''foobar'''"></div>
16008 !! html
16009 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16010
16011 !! end
16012
16013
16014 !! test
16015 Bug 2304: HTML attribute safety (ISBN)
16016 !! wikitext
16017 <div title="ISBN 1234567890"></div>
16018 !! html
16019 <div title="&#73;SBN 1234567890"></div>
16020
16021 !! end
16022
16023 !! test
16024 Bug 2304: HTML attribute safety (RFC)
16025 !! wikitext
16026 <div title="RFC 1234"></div>
16027 !! html
16028 <div title="&#82;FC 1234"></div>
16029
16030 !! end
16031
16032 !! test
16033 Bug 2304: HTML attribute safety (PMID)
16034 !! wikitext
16035 <div title="PMID 1234567890"></div>
16036 !! html
16037 <div title="&#80;MID 1234567890"></div>
16038
16039 !! end
16040
16041 !! test
16042 Bug 2304: HTML attribute safety (web link)
16043 !! wikitext
16044 <div title="http://example.com/"></div>
16045 !! html
16046 <div title="http&#58;//example.com/"></div>
16047
16048 !! end
16049
16050 !! test
16051 Bug 2304: HTML attribute safety (named web link)
16052 !! wikitext
16053 <div title="[http://example.com/ link]"></div>
16054 !! html
16055 <div title="&#91;http&#58;//example.com/ link]"></div>
16056
16057 !! end
16058
16059 !! test
16060 Bug 3244: HTML attribute safety (extension; safe)
16061 !! wikitext
16062 <div style="<nowiki>background:blue</nowiki>"></div>
16063 !! html
16064 <div style="background:blue"></div>
16065
16066 !! end
16067
16068 !! test
16069 Bug 3244: HTML attribute safety (extension; unsafe)
16070 !! wikitext
16071 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16072 !! html
16073 <div style="/* insecure input */"></div>
16074
16075 !! end
16076
16077 # More MSIE fun discovered by Tom Gilder
16078
16079 !! test
16080 MSIE CSS safety test: spurious slash
16081 !! wikitext
16082 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16083 !! html
16084 <div style="/* insecure input */">evil</div>
16085
16086 !! end
16087
16088 !! test
16089 MSIE CSS safety test: hex code
16090 !! wikitext
16091 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16092 !! html
16093 <div style="/* insecure input */">evil</div>
16094
16095 !! end
16096
16097 !! test
16098 MSIE CSS safety test: comment in url
16099 !! wikitext
16100 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16101 !! html
16102 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16103
16104 !! end
16105
16106 !! test
16107 MSIE CSS safety test: comment in expression
16108 !! wikitext
16109 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16110 !! html
16111 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16112
16113 !! end
16114
16115 !! test
16116 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16117 !! wikitext
16118 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16119 !! html
16120 <p style="/* invalid control char */">A</p>
16121
16122 !! end
16123
16124 !! test
16125 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16126 !! wikitext
16127 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16128 <div style="top:EXPRESSION(alert())">B</div>
16129 !! html
16130 <p style="/* insecure input */">A</p>
16131 <div style="/* insecure input */">B</div>
16132
16133 !! end
16134
16135 !! test
16136 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16137 !! wikitext
16138 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16139 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16140 !! html
16141 <div style="/* insecure input */">A</div>
16142 <p style="/* insecure input */">B</p>
16143
16144 !! end
16145
16146 !! test
16147 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16148 !! wikitext
16149 <div style="background-image:url⁽javascript:alert())">A</div>
16150 <div style="background-image:url₍javascript:alert())">B</div>
16151 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16152 !! html
16153 <div style="/* insecure input */">A</div>
16154 <div style="/* insecure input */">B</div>
16155 <p style="/* insecure input */">C</p>
16156
16157 !! end
16158
16159 # FIXME: Parsoid fails to sanitize this! See T58846.
16160 !! test
16161 Opera -o-link CSS
16162 !! wikitext
16163 <div
16164 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;"
16165 style="-o-link:attr(title);-o-link-source:current">X</div>
16166 !! html
16167 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16168
16169 !! end
16170
16171 !! test
16172 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16173 !! wikitext
16174 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16175 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16176 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16177 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16178 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16179 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16180 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16181 !! html
16182 <p style="/* insecure input */">A</p>
16183 <p style="/* insecure input */">B</p>
16184 <p style="/* insecure input */">C</p>
16185 <p style="/* insecure input */">D</p>
16186 <p style="/* insecure input */">E</p>
16187 <p style="/* insecure input */">F</p>
16188 <p style="/* insecure input */">G</p>
16189
16190 !! end
16191
16192 !! test
16193 Table attribute legitimate extension
16194 !! wikitext
16195 {|
16196 !+ style="<nowiki>color:blue</nowiki>"| status
16197 |}
16198 !! html
16199 <table>
16200 <tr>
16201 <th style="color:blue"> status
16202 </th></tr></table>
16203
16204 !!end
16205
16206 !! test
16207 Table attribute safety
16208 !! wikitext
16209 {|
16210 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16211 |}
16212 !! html
16213 <table>
16214 <tr>
16215 <th style="/* insecure input */"> status
16216 </th></tr></table>
16217
16218 !! end
16219
16220 !! test
16221 CSS line continuation 1
16222 !! wikitext
16223 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16224 !! html
16225 <div style="/* insecure input */"></div>
16226
16227 !! end
16228
16229 !! test
16230 CSS line continuation 2
16231 !! wikitext
16232 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16233 !! html
16234 <div style="/* invalid control char */"></div>
16235
16236 !! end
16237
16238 !! article
16239 Template:Identity
16240 !! text
16241 {{{1}}}
16242 !! endarticle
16243
16244 !! test
16245 Expansion of multi-line templates in attribute values (bug 6255)
16246 !! wikitext
16247 <div style="background: {{identity|#00FF00}}">-</div>
16248 !! html
16249 <div style="background: #00FF00">-</div>
16250
16251 !! end
16252
16253
16254 !! test
16255 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16256 !! wikitext
16257 <div style="background:
16258 #00FF00">-</div>
16259 !! html/php
16260 <div style="background: #00FF00">-</div>
16261
16262 !! html/parsoid
16263 <div style="background:
16264 #00FF00">-</div>
16265 !! end
16266
16267 !! test
16268 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16269 !! wikitext
16270 <div style="background: &#10;#00FF00">-</div>
16271 !! html
16272 <div style="background: &#10;#00FF00">-</div>
16273
16274 !! end
16275
16276 !! test
16277 evil <math>-wiki-tags without Extension:Math enabled
16278 !! wikitext
16279 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16280 !! html+tidy
16281 <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>
16282 !! end
16283
16284 ###
16285 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16286 ###
16287 !! test
16288 Parser hook: empty input
16289 !! wikitext
16290 <tag></tag>
16291 !! html/php
16292 <pre>
16293 ''
16294 array (
16295 )
16296 </pre>
16297
16298 !! html/parsoid
16299 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16300 !! end
16301
16302 ## Don't expect parsoid to rt this form.
16303 !! test
16304 Parser hook: empty input using terminated empty elements
16305 !! options
16306 parsoid=wt2html,html2html
16307 !! wikitext
16308 <tag/>
16309 !! html/php
16310 <pre>
16311 NULL
16312 array (
16313 )
16314 </pre>
16315
16316 !! html/parsoid
16317 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16318 !! end
16319
16320 !! test
16321 Parser hook: empty input using terminated empty elements (space before)
16322 !! wikitext
16323 <tag />
16324 !! html/php
16325 <pre>
16326 NULL
16327 array (
16328 )
16329 </pre>
16330
16331 !! html/parsoid
16332 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16333 !! end
16334
16335 !! test
16336 Parser hook: basic input
16337 !! wikitext
16338 <tag>input</tag>
16339 !! html/php
16340 <pre>
16341 'input'
16342 array (
16343 )
16344 </pre>
16345
16346 !! html/parsoid
16347 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16348 !! end
16349
16350 ## Don't expect parsoid to rt this form.
16351 !! test
16352 Parser hook: case insensitive
16353 !! options
16354 parsoid=wt2html,html2html
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, redux
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 !! test
16387 Parser hook: nested tags
16388 !! options
16389 noxml
16390 !! wikitext
16391 <tag><tag></tag></tag>
16392 !! html/php
16393 <pre>
16394 '<tag>'
16395 array (
16396 )
16397 </pre>&lt;/tag&gt;
16398
16399 !! html/parsoid
16400 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16401 !! end
16402
16403 !! test
16404 Parser hook: basic arguments
16405 !! wikitext
16406 <tag width="200" height="100" depth="50" square=""></tag>
16407 !! html/php
16408 <pre>
16409 ''
16410 array (
16411 'width' => '200',
16412 'height' => '100',
16413 'depth' => '50',
16414 'square' => '',
16415 )
16416 </pre>
16417
16418 !! html/parsoid
16419 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16420 !! end
16421
16422 ## Don't expect parsoid to rt this form.
16423 !! test
16424 Parser hook: basic arguments, variations
16425 !! options
16426 parsoid=wt2html,html2html
16427 !! wikitext
16428 <tag width=200 height = "100" depth = '50' square></tag>
16429 !! html/php
16430 <pre>
16431 ''
16432 array (
16433 'width' => '200',
16434 'height' => '100',
16435 'depth' => '50',
16436 'square' => '',
16437 )
16438 </pre>
16439
16440 !! html/parsoid
16441 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16442 !! end
16443
16444 !! test
16445 Parser hook: argument containing a forward slash (bug 5344)
16446 !! wikitext
16447 <tag filename="/tmp/bla"></tag>
16448 !! html/php
16449 <pre>
16450 ''
16451 array (
16452 'filename' => '/tmp/bla',
16453 )
16454 </pre>
16455
16456 !! html/parsoid
16457 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16458 !! end
16459
16460 ## Don't expect parsoid to rt this form.
16461 !! test
16462 Parser hook: empty input using terminated empty elements (bug 2374)
16463 !! options
16464 parsoid=wt2html,html2html
16465 !! wikitext
16466 <tag foo=bar/>text
16467 !! html/php
16468 <pre>
16469 NULL
16470 array (
16471 'foo' => 'bar',
16472 )
16473 </pre>text
16474
16475 !! html/parsoid
16476 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16477 !! end
16478
16479 # </tag> should be output literally since there is no matching tag that begins it
16480 !! test
16481 Parser hook: basic arguments using terminated empty elements (bug 2374)
16482 !! wikitext
16483 <tag width=200 height = "100" depth = '50' square/>
16484 other stuff
16485 </tag>
16486 !! html/php
16487 <pre>
16488 NULL
16489 array (
16490 'width' => '200',
16491 'height' => '100',
16492 'depth' => '50',
16493 'square' => '',
16494 )
16495 </pre>
16496 <p>other stuff
16497 &lt;/tag&gt;
16498 </p>
16499 !! end
16500
16501 ###
16502 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16503 ###
16504
16505 !! test
16506 Parser hook: static parser hook not inside a comment
16507 !! wikitext
16508 <statictag>hello, world</statictag>
16509
16510 <statictag action="flush" />
16511 !! html/php
16512 <p><br />
16513 hello, world
16514 </p>
16515 !! html/parsoid
16516 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16517 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16518 !! end
16519
16520 !! test
16521 Parser hook: static parser hook inside a comment
16522 !! wikitext
16523 <!-- <statictag>hello, world</statictag> -->
16524 <statictag action="flush" />
16525 !! html/php
16526 <p><br />
16527 </p>
16528 !! html/parsoid
16529 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16530 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16531 !! end
16532
16533 # Nested template calls; this case was broken by Parser.php rev 1.506,
16534 # since reverted.
16535
16536 !! article
16537 Template:One-parameter
16538 !! text
16539 (My parameter is: {{{1}}})
16540 !! endarticle
16541
16542 !! article
16543 Template:Map-one-parameter
16544 !! text
16545 {{{{{1}}}|{{{2}}}}}
16546 !! endarticle
16547
16548 !! test
16549 Nested template calls
16550 !! wikitext
16551 {{Map-one-parameter|One-parameter|param}}
16552 !! html
16553 <p>(My parameter is: param)
16554 </p>
16555 !! end
16556
16557
16558 ###
16559 ### Sanitizer
16560 ###
16561
16562 # HTML+Tidy effectively strips out the empty tags completely
16563 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16564 # which Tidy would have done for the PHP parser had there been content inside it.
16565 !! test
16566 Sanitizer: Closing of open tags
16567 !! wikitext
16568 <s></s><table></table>
16569 !! html
16570 <s></s><table></table>
16571
16572 !! html/parsoid
16573 <p><s></s></p><table></table>
16574 !! end
16575
16576 !! test
16577 Sanitizer: Closing of open but not closed tags
16578 !! wikitext
16579 <s>foo
16580 !! html
16581 <p><s>foo</s>
16582 </p>
16583 !! end
16584
16585 !! test
16586 Sanitizer: Closing of closed but not open tags
16587 !! options
16588 parsoid=wt2html
16589 !! wikitext
16590 </s>
16591 !! html/php+tidy
16592 !! html/parsoid
16593 !! end
16594
16595 !! test
16596 Sanitizer: Closing of closed but not open table tags
16597 !! options
16598 parsoid=wt2html
16599 !! wikitext
16600 Table not started</td></tr></table>
16601 !! html/php+tidy
16602 <p>Table not started</p>
16603 !! html/parsoid
16604 <p>Table not started</p>
16605 !! end
16606
16607 !! test
16608 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16609 !! wikitext
16610 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16611 !! html
16612 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16613 </p>
16614 !! end
16615
16616 # In HTML5, the restrictions are that id must contain at least one character,
16617 # and must not contain any space characters.
16618 !! test
16619 Sanitizer: Validating the contents of the id attribute (bug 4515)
16620 !! options
16621 disabled
16622 !! wikitext
16623 <br id="" /><br id="a space" />
16624 !! html
16625 Something ...
16626 !! end
16627
16628 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16629 !! test
16630 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16631 !! options
16632 disabled
16633 !! wikitext
16634 <br id="foo" /><br id="foo" />
16635 !! html
16636 Something need to be done. foo-2 ?
16637 !! end
16638
16639 !! test
16640 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16641 !! wikitext
16642 <div itemscope>
16643 <meta itemprop="hello" content="world">
16644 <meta http-equiv="refresh" content="5">
16645 <meta itemprop="hello" http-equiv="refresh" content="5">
16646 <link itemprop="hello" href="{{SERVER}}">
16647 <link rel="stylesheet" href="{{SERVER}}">
16648 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16649 </div>
16650 !! html
16651 <div itemscope="">
16652 <p> <meta itemprop="hello" content="world" />
16653 &lt;meta http-equiv="refresh" content="5"&gt;
16654 <meta itemprop="hello" content="5" />
16655 </p>
16656 <link itemprop="hello" href="http&#58;//example.org" />
16657 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16658 <link itemprop="hello" href="http&#58;//example.org" />
16659 </div>
16660
16661 !! end
16662
16663 !! test
16664 Language converter: output gets cut off unexpectedly (bug 5757)
16665 !! options
16666 language=zh
16667 !! wikitext
16668 this bit is safe: }-
16669
16670 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16671
16672 then we get cut off here: }-
16673
16674 all additional text is vanished
16675 !! html
16676 <p>this bit is safe: }-
16677 </p><p>but if we add a conversion instance: xxx
16678 </p><p>then we get cut off here: }-
16679 </p><p>all additional text is vanished
16680 </p>
16681 !! end
16682
16683 !! test
16684 Self closed html pairs (bug 5487)
16685 !! options
16686 !! wikitext
16687 <center><font id="bug" />Centered text</center>
16688 <div><font id="bug2" />In div text</div>
16689 !! html
16690 <center>&lt;font id="bug" /&gt;Centered text</center>
16691 <div>&lt;font id="bug2" /&gt;In div text</div>
16692
16693 !! end
16694
16695 #
16696 #
16697 #
16698
16699 !! test
16700 Punctuation: nbsp before exclamation
16701 !! wikitext
16702 C'est grave !
16703 !! html
16704 <p>C'est grave&#160;!
16705 </p>
16706 !! end
16707
16708 !! test
16709 Punctuation: CSS !important (bug 11874)
16710 !! wikitext
16711 <div style="width:50% !important">important</div>
16712 !! html
16713 <div style="width:50% !important">important</div>
16714
16715 !!end
16716
16717 !! test
16718 Punctuation: CSS ! important (bug 11874; with space after)
16719 !! wikitext
16720 <div style="width:50% ! important">important</div>
16721 !! html
16722 <div style="width:50% ! important">important</div>
16723
16724 !!end
16725
16726 !! test
16727 HTML bullet list, closed tags (bug 5497)
16728 !! wikitext
16729 <ul>
16730 <li>One</li>
16731 <li>Two</li>
16732 </ul>
16733 !! html/php
16734 <ul>
16735 <li>One</li>
16736 <li>Two</li>
16737 </ul>
16738
16739 !! html/parsoid
16740 <ul data-parsoid='{"stx":"html"}'>
16741 <li data-parsoid='{"stx":"html"}'>One</li>
16742 <li data-parsoid='{"stx":"html"}'>Two</li>
16743 </ul>
16744
16745 !! end
16746
16747 !! test
16748 HTML bullet list, unclosed tags (bug 5497)
16749 !! wikitext
16750 <ul>
16751 <li>One
16752 <li>Two
16753 </ul>
16754 !! html/php+tidy
16755 <ul>
16756 <li>One</li>
16757 <li>Two</li>
16758 </ul>
16759 !! html/parsoid
16760 <ul data-parsoid='{"stx":"html"}'>
16761 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16762 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16763 </ul>
16764
16765 !! end
16766
16767 !! test
16768 HTML ordered list, closed tags (bug 5497)
16769 !! wikitext
16770 <ol>
16771 <li>One</li>
16772 <li>Two</li>
16773 </ol>
16774 !! html/php
16775 <ol>
16776 <li>One</li>
16777 <li>Two</li>
16778 </ol>
16779
16780 !! html/parsoid
16781 <ol data-parsoid='{"stx":"html"}'>
16782 <li data-parsoid='{"stx":"html"}'>One</li>
16783 <li data-parsoid='{"stx":"html"}'>Two</li>
16784 </ol>
16785
16786 !! end
16787
16788 !! test
16789 HTML ordered list, unclosed tags (bug 5497)
16790 !! options
16791 !! wikitext
16792 <ol>
16793 <li>One
16794 <li>Two
16795 </ol>
16796 !! html/php+tidy
16797 <ol>
16798 <li>One</li>
16799 <li>Two</li>
16800 </ol>
16801 !! html/parsoid
16802 <ol data-parsoid='{"stx":"html"}'>
16803 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16804 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16805 </ol>
16806
16807 !! end
16808
16809 !! test
16810 HTML nested bullet list, closed tags (bug 5497)
16811 !! wikitext
16812 <ul>
16813 <li>One</li>
16814 <li>Two:
16815 <ul>
16816 <li>Sub-one</li>
16817 <li>Sub-two</li>
16818 </ul>
16819 </li>
16820 </ul>
16821 !! html
16822 <ul>
16823 <li>One</li>
16824 <li>Two:
16825 <ul>
16826 <li>Sub-one</li>
16827 <li>Sub-two</li>
16828 </ul>
16829 </li>
16830 </ul>
16831
16832 !! end
16833
16834 !! test
16835 HTML nested bullet list, open tags (bug 5497)
16836 !! wikitext
16837 <ul>
16838 <li>One
16839 <li>Two:
16840 <ul>
16841 <li>Sub-one
16842 <li>Sub-two
16843 </ul>
16844 </ul>
16845 !! html/php+tidy
16846 <ul>
16847 <li>One</li>
16848 <li>Two:
16849 <ul>
16850 <li>Sub-one</li>
16851 <li>Sub-two</li>
16852 </ul>
16853 </li>
16854 </ul>
16855 !! html/parsoid
16856 <ul>
16857 <li>One
16858 </li>
16859 <li>Two:
16860 <ul>
16861 <li>Sub-one
16862 </li>
16863 <li>Sub-two
16864 </li>
16865 </ul>
16866 </li>
16867 </ul>
16868
16869 !! end
16870
16871 !! test
16872 HTML nested ordered list, closed tags (bug 5497)
16873 !! wikitext
16874 <ol>
16875 <li>One</li>
16876 <li>Two:
16877 <ol>
16878 <li>Sub-one</li>
16879 <li>Sub-two</li>
16880 </ol>
16881 </li>
16882 </ol>
16883 !! html
16884 <ol>
16885 <li>One</li>
16886 <li>Two:
16887 <ol>
16888 <li>Sub-one</li>
16889 <li>Sub-two</li>
16890 </ol>
16891 </li>
16892 </ol>
16893
16894 !! end
16895
16896 !! test
16897 HTML nested ordered list, open tags (bug 5497)
16898 !! wikitext
16899 <ol>
16900 <li>One
16901 <li>Two:
16902 <ol>
16903 <li>Sub-one
16904 <li>Sub-two
16905 </ol>
16906 </ol>
16907 !! html/php
16908 <ol>
16909 <li>One
16910 <li>Two:
16911 <ol>
16912 <li>Sub-one
16913 <li>Sub-two
16914 </ol>
16915 </ol>
16916
16917 !! html/parsoid
16918 <ol>
16919 <li>One
16920 </li>
16921 <li>Two:
16922 <ol>
16923 <li>Sub-one
16924 </li>
16925 <li>Sub-two
16926 </li>
16927 </ol>
16928 </li>
16929 </ol>
16930
16931 !! end
16932
16933 !! test
16934 HTML ordered list item with parameters oddity
16935 !! wikitext
16936 <ol><li id="fragment">One</li>
16937 </ol>
16938 !! html
16939 <ol><li id="fragment">One</li>
16940 </ol>
16941
16942 !! end
16943
16944 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16945 !!test
16946 bug 5918: autonumbering
16947 !! wikitext
16948 [http://first/] [http://second] [ftp://ftp]
16949
16950 ftp://inlineftp
16951
16952 [mailto:enclosed@mail.tld With target]
16953
16954 [mailto:enclosed@mail.tld]
16955
16956 mailto:inline@mail.tld
16957 !! html/php
16958 <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>
16959 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16960 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16961 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16962 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16963 </p>
16964 !! html/parsoid
16965 <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>
16966 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16967 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16968 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16969 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16970 !! end
16971
16972
16973 #
16974 # Security and HTML correctness
16975 # From Nick Jenkins' fuzz testing
16976 #
16977
16978 !! test
16979 Fuzz testing: Parser13
16980 !! wikitext
16981 {|
16982 | http://a|
16983 !! html
16984 <table>
16985 <tr>
16986 <td>
16987 </td>
16988 </tr>
16989 </table>
16990
16991 !! end
16992
16993 !! test
16994 Fuzz testing: Parser14
16995 !! wikitext
16996 == onmouseover= ==
16997 http://__TOC__
16998 !! html
16999 <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>
17000 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17001 <ul>
17002 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17003 </ul>
17004 </div>
17005
17006
17007 !! html+tidy
17008 <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>
17009 <p>http://</p>
17010 <div id="toc" class="toc">
17011 <div id="toctitle">
17012 <h2>Contents</h2>
17013 </div>
17014 <ul>
17015 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17016 </ul>
17017 </div>
17018 <p></p>
17019 !! end
17020
17021 !! test
17022 Fuzz testing: Parser14-table
17023 !! wikitext
17024 ==a==
17025 {| STYLE=__TOC__
17026 !! html
17027 <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>
17028 <table style="&#95;_TOC&#95;_">
17029 <tr><td></td></tr>
17030 </table>
17031
17032 !! html+tidy
17033 <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>
17034 <table style="__TOC__">
17035 <tr>
17036 <td></td>
17037 </tr>
17038 </table>
17039 !! end
17040
17041 # Known to produce bogus xml (extra </td>)
17042 !! test
17043 Fuzz testing: Parser16
17044 !! options
17045 noxml
17046 !! wikitext
17047 {|
17048 !https://||||||
17049 !! html
17050 <table>
17051 <tr>
17052 <th>https://</th>
17053 <th></th>
17054 <th></th>
17055 <th>
17056 </td>
17057 </tr>
17058 </table>
17059
17060 !! html+tidy
17061 <table>
17062 <tr>
17063 <th>https://</th>
17064 <th></th>
17065 <th></th>
17066 <th></th>
17067 </tr>
17068 </table>
17069 !! end
17070
17071 !! test
17072 Fuzz testing: Parser21
17073 !! wikitext
17074 {|
17075 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17076 |
17077 !! html
17078 <table>
17079 <tr>
17080 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17081 </th>
17082 <td>
17083 </td>
17084 </tr>
17085 </table>
17086
17087 !! end
17088
17089 !! test
17090 Fuzz testing: Parser22
17091 !! wikitext
17092 http://===r:::https://b
17093
17094 {|
17095 !! html
17096 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17097 </p>
17098 <table>
17099 <tr><td></td></tr>
17100 </table>
17101
17102 !! end
17103
17104 # Known to produce bad XML for now
17105 !! test
17106 Fuzz testing: Parser24
17107 !! options
17108 noxml
17109 !! wikitext
17110 {|
17111 {{{|
17112 <u CLASS=
17113 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17114 <br style="onmouseover='alert(document.cookie);' " />
17115
17116 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17117 |
17118 !! html
17119 <table>
17120 {{{|
17121 <u class="&#124;">}}}} &gt;
17122 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17123
17124 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17125 <tr>
17126 <td></u>
17127 </td>
17128 </tr>
17129 </table>
17130
17131 !! end
17132
17133 # Note: the current result listed for this is not what the original one was,
17134 # but the original bug was JavaScript injection, which is fixed in any case.
17135 # It's not clear that the original result listed was any more correct than the
17136 # current one. Original result:
17137 # <p>{{{|
17138 # </p>
17139 # <li class="&#124;&#124;">
17140 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17141 !!test
17142 Fuzz testing: Parser25 (bug 6055)
17143 !! wikitext
17144 {{{
17145 |
17146 <LI CLASS=||
17147 >
17148 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17149 !! html
17150 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17151 </p>
17152 !! end
17153
17154 !!test
17155 Fuzz testing: URL adjacent extension (with space, clean)
17156 !! wikitext
17157 http://example.com <nowiki>junk</nowiki>
17158 !! html/php
17159 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17160 </p>
17161 !! html/parsoid
17162 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17163 !! end
17164
17165 !!test
17166 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17167 !! wikitext
17168 http://example.com<nowiki>junk</nowiki>
17169 !! html/php
17170 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17171 </p>
17172 !! html/parsoid
17173 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17174 !! end
17175
17176 !!test
17177 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17178 !! wikitext
17179 http://example.com<pre>junk</pre>
17180 !! html/php
17181 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17182
17183 !! html/php+tidy
17184 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17185 <pre>
17186 junk
17187 </pre>
17188 !! html/parsoid
17189 <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>
17190 !!end
17191
17192 !!test
17193 Fuzz testing: image with bogus manual thumbnail
17194 !! wikitext
17195 [[Image:foobar.jpg|thumbnail= ]]
17196 !! html/php
17197 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17198
17199 !! html/parsoid
17200 <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>
17201 !!end
17202
17203 !! test
17204 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17205 !! wikitext
17206 <pre dir="&#10;"></pre>
17207 !! html
17208 <pre dir="&#10;"></pre>
17209
17210 !! end
17211
17212 !! test
17213 Parsing optional HTML elements (Bug 6171)
17214 !! options
17215 !! wikitext
17216 <table>
17217 <tr>
17218 <td> Some tabular data</td>
17219 <td> More tabular data ...
17220 <td> And yet som tabular data</td>
17221 </tr>
17222 </table>
17223 !! html
17224 <table>
17225 <tr>
17226 <td> Some tabular data</td>
17227 <td> More tabular data ...
17228 </td><td> And yet som tabular data</td>
17229 </tr>
17230 </table>
17231
17232 !! end
17233
17234 !! test
17235 Correct handling of <td>, <tr> (Bug 6171)
17236 !! options
17237 !! wikitext
17238 <table>
17239 <tr>
17240 <td> Some tabular data</td>
17241 <td> More tabular data ...</td>
17242 <td> And yet som tabular data</td>
17243 </tr>
17244 </table>
17245 !! html
17246 <table>
17247 <tr>
17248 <td> Some tabular data</td>
17249 <td> More tabular data ...</td>
17250 <td> And yet som tabular data</td>
17251 </tr>
17252 </table>
17253
17254 !! end
17255
17256
17257 !! test
17258 Parsing crashing regression (fr:JavaScript)
17259 !! wikitext
17260 </body></x>
17261 !! html
17262 <p>&lt;/body&gt;&lt;/x&gt;
17263 </p>
17264 !! end
17265
17266 !! test
17267 Inline wiki vs wiki block nesting
17268 !! wikitext
17269 '''Bold paragraph
17270
17271 New wiki paragraph
17272 !! html
17273 <p><b>Bold paragraph</b>
17274 </p><p>New wiki paragraph
17275 </p>
17276 !! end
17277
17278 # FIXME: The current php output is documented
17279 # and desired output is the parsoid target.
17280 !! test
17281 Inline HTML vs wiki block nesting
17282 !! wikitext
17283 <b>Bold paragraph
17284
17285 New wiki paragraph
17286 !! html/php
17287 <p><b>Bold paragraph
17288 </p><p>New wiki paragraph</b>
17289 </p>
17290 !! html/parsoid
17291 <p><b>Bold paragraph</b>
17292 </p><p>New wiki paragraph
17293 </p>
17294 !! end
17295
17296 # Original result was this:
17297 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17298 # </p>
17299 # While that might be marginally more intuitive, maybe, the six-apostrophe
17300 # construct is clearly pathological and the result stated here (which is what
17301 # the parser actually does) is about as reasonable as anything.
17302 !!test
17303 Mixing markup for italics and bold
17304 !! options
17305 !! wikitext
17306 '''bold''''''bold''bolditalics'''''
17307 !! html
17308 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17309 </p>
17310 !! end
17311
17312
17313 !! article
17314 Xyzzyx
17315 !! text
17316 Article for special page transclusion test
17317 !! endarticle
17318
17319 !! test
17320 Special page transclusion
17321 !! options
17322 !! wikitext
17323 {{Special:Prefixindex/Xyzzyx}}
17324 !! html
17325 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17326 </ul>
17327
17328 !! end
17329
17330 !! test
17331 Special page transclusion twice (bug 5021)
17332 !! options
17333 !! wikitext
17334 {{Special:Prefixindex/Xyzzyx}}
17335 {{Special:Prefixindex/Xyzzyx}}
17336 !! html
17337 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17338 </ul>
17339 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17340 </ul>
17341
17342 !! end
17343
17344 !! test
17345 Transclusion of default MediaWiki message
17346 !! wikitext
17347 {{MediaWiki:Mainpage}}
17348 !! html
17349 <p>Main Page
17350 </p>
17351 !! end
17352
17353 !! test
17354 Transclusion of nonexistent MediaWiki message
17355 !! wikitext
17356 {{MediaWiki:Mainpagexxx}}
17357 !! html
17358 <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>
17359 </p>
17360 !! end
17361
17362 !! test
17363 Transclusion of MediaWiki message with underscore
17364 !! wikitext
17365 {{MediaWiki:history_short}}
17366 !! html
17367 <p>History
17368 </p>
17369 !! end
17370
17371 !! test
17372 Transclusion of MediaWiki message with space
17373 !! wikitext
17374 {{MediaWiki:history short}}
17375 !! html
17376 <p>History
17377 </p>
17378 !! end
17379
17380 !! test
17381 Invalid header with following text
17382 !! wikitext
17383 = x = y
17384 !! html
17385 <p>= x = y
17386 </p>
17387 !! end
17388
17389
17390 !! test
17391 Section extraction test (section 0)
17392 !! options
17393 section=0
17394 !! wikitext
17395 start
17396 ==a==
17397 ===aa===
17398 ====aaa====
17399 ==b==
17400 ===ba===
17401 ===bb===
17402 ====bba====
17403 ===bc===
17404 ==c==
17405 ===ca===
17406 !! html/php
17407 start
17408 !! end
17409
17410 !! test
17411 Section extraction test (section 1)
17412 !! options
17413 section=1
17414 !! wikitext
17415 start
17416 ==a==
17417 ===aa===
17418 ====aaa====
17419 ==b==
17420 ===ba===
17421 ===bb===
17422 ====bba====
17423 ===bc===
17424 ==c==
17425 ===ca===
17426 !! html/php
17427 ==a==
17428 ===aa===
17429 ====aaa====
17430 !! end
17431
17432 !! test
17433 Section extraction test (section 2)
17434 !! options
17435 section=2
17436 !! wikitext
17437 start
17438 ==a==
17439 ===aa===
17440 ====aaa====
17441 ==b==
17442 ===ba===
17443 ===bb===
17444 ====bba====
17445 ===bc===
17446 ==c==
17447 ===ca===
17448 !! html/php
17449 ===aa===
17450 ====aaa====
17451 !! end
17452
17453 !! test
17454 Section extraction test (section 3)
17455 !! options
17456 section=3
17457 !! wikitext
17458 start
17459 ==a==
17460 ===aa===
17461 ====aaa====
17462 ==b==
17463 ===ba===
17464 ===bb===
17465 ====bba====
17466 ===bc===
17467 ==c==
17468 ===ca===
17469 !! html/php
17470 ====aaa====
17471 !! end
17472
17473 !! test
17474 Section extraction test (section 4)
17475 !! options
17476 section=4
17477 !! wikitext
17478 start
17479 ==a==
17480 ===aa===
17481 ====aaa====
17482 ==b==
17483 ===ba===
17484 ===bb===
17485 ====bba====
17486 ===bc===
17487 ==c==
17488 ===ca===
17489 !! html/php
17490 ==b==
17491 ===ba===
17492 ===bb===
17493 ====bba====
17494 ===bc===
17495 !! end
17496
17497 !! test
17498 Section extraction test (section 5)
17499 !! options
17500 section=5
17501 !! wikitext
17502 start
17503 ==a==
17504 ===aa===
17505 ====aaa====
17506 ==b==
17507 ===ba===
17508 ===bb===
17509 ====bba====
17510 ===bc===
17511 ==c==
17512 ===ca===
17513 !! html/php
17514 ===ba===
17515 !! end
17516
17517 !! test
17518 Section extraction test (section 6)
17519 !! options
17520 section=6
17521 !! wikitext
17522 start
17523 ==a==
17524 ===aa===
17525 ====aaa====
17526 ==b==
17527 ===ba===
17528 ===bb===
17529 ====bba====
17530 ===bc===
17531 ==c==
17532 ===ca===
17533 !! html/php
17534 ===bb===
17535 ====bba====
17536 !! end
17537
17538 !! test
17539 Section extraction test (section 7)
17540 !! options
17541 section=7
17542 !! wikitext
17543 start
17544 ==a==
17545 ===aa===
17546 ====aaa====
17547 ==b==
17548 ===ba===
17549 ===bb===
17550 ====bba====
17551 ===bc===
17552 ==c==
17553 ===ca===
17554 !! html/php
17555 ====bba====
17556 !! end
17557
17558 !! test
17559 Section extraction test (section 8)
17560 !! options
17561 section=8
17562 !! wikitext
17563 start
17564 ==a==
17565 ===aa===
17566 ====aaa====
17567 ==b==
17568 ===ba===
17569 ===bb===
17570 ====bba====
17571 ===bc===
17572 ==c==
17573 ===ca===
17574 !! html/php
17575 ===bc===
17576 !! end
17577
17578 !! test
17579 Section extraction test (section 9)
17580 !! options
17581 section=9
17582 !! wikitext
17583 start
17584 ==a==
17585 ===aa===
17586 ====aaa====
17587 ==b==
17588 ===ba===
17589 ===bb===
17590 ====bba====
17591 ===bc===
17592 ==c==
17593 ===ca===
17594 !! html/php
17595 ==c==
17596 ===ca===
17597 !! end
17598
17599 !! test
17600 Section extraction test (section 10)
17601 !! options
17602 section=10
17603 !! wikitext
17604 start
17605 ==a==
17606 ===aa===
17607 ====aaa====
17608 ==b==
17609 ===ba===
17610 ===bb===
17611 ====bba====
17612 ===bc===
17613 ==c==
17614 ===ca===
17615 !! html/php
17616 ===ca===
17617 !! end
17618
17619 !! test
17620 Section extraction test (nonexistent section 11)
17621 !! options
17622 section=11
17623 !! wikitext
17624 start
17625 ==a==
17626 ===aa===
17627 ====aaa====
17628 ==b==
17629 ===ba===
17630 ===bb===
17631 ====bba====
17632 ===bc===
17633 ==c==
17634 ===ca===
17635 !! html/php
17636 !! end
17637
17638 !! test
17639 Section extraction test with bogus heading (section 1)
17640 !! options
17641 section=1
17642 !! wikitext
17643 ==a==
17644 ==bogus== not a legal section
17645 ==b==
17646 !! html/php
17647 ==a==
17648 ==bogus== not a legal section
17649 !! end
17650
17651 !! test
17652 Section extraction test with bogus heading (section 2)
17653 !! options
17654 section=2
17655 !! wikitext
17656 ==a==
17657 ==bogus== not a legal section
17658 ==b==
17659 !! html/php
17660 ==b==
17661 !! end
17662
17663 !! test
17664 Section extraction test with comment after heading (section 1)
17665 !! options
17666 section=1
17667 !! wikitext
17668 ==a==
17669 ==b== <!-- -->
17670 ==c==
17671 !! html/php
17672 ==a==
17673 !! end
17674
17675 !! test
17676 Section extraction test with comment after heading (section 2)
17677 !! options
17678 section=2
17679 !! wikitext
17680 ==a==
17681 ==b== <!-- -->
17682 ==c==
17683 !! html/php
17684 ==b== <!-- -->
17685 !! end
17686
17687 !! test
17688 Section extraction test with bogus <nowiki> heading (section 1)
17689 !! options
17690 section=1
17691 !! wikitext
17692 ==a==
17693 ==bogus== <nowiki>not a legal section</nowiki>
17694 ==b==
17695 !! html/php
17696 ==a==
17697 ==bogus== <nowiki>not a legal section</nowiki>
17698 !! end
17699
17700 !! test
17701 Section extraction test with bogus <nowiki> heading (section 2)
17702 !! options
17703 section=2
17704 !! wikitext
17705 ==a==
17706 ==bogus== <nowiki>not a legal section</nowiki>
17707 ==b==
17708 !! html/php
17709 ==b==
17710 !! end
17711
17712 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17713 # instead of respecting commented sections
17714 !! test
17715 Section extraction prefixed by comment (section 1)
17716 !! options
17717 section=1
17718 !! wikitext
17719 <!-- -->==sec1==
17720 ==sec2==
17721 !! html/php
17722 ==sec2==
17723 !!end
17724
17725 !! test
17726 Section extraction prefixed by comment (section 2)
17727 !! options
17728 section=2
17729 !! wikitext
17730 <!-- -->==sec1==
17731 ==sec2==
17732 !! html/php
17733
17734 !!end
17735
17736 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17737 # instead of respecting HTML-style headings
17738 !! test
17739 Section extraction, mixed wiki and html (section 1)
17740 !! options
17741 section=1
17742 !! wikitext
17743 <h2>unmarked</h2>
17744 unmarked
17745 ==1==
17746 one
17747 ==2==
17748 two
17749 !! html/php
17750 ==1==
17751 one
17752 !! end
17753
17754 !! test
17755 Section extraction, mixed wiki and html (section 2)
17756 !! options
17757 section=2
17758 !! wikitext
17759 <h2>unmarked</h2>
17760 unmarked
17761 ==1==
17762 one
17763 ==2==
17764 two
17765 !! html/php
17766 ==2==
17767 two
17768 !! end
17769
17770
17771 # Formerly testing for bug 3342
17772 !! test
17773 Section extraction, heading surrounded by <noinclude>
17774 !! options
17775 section=1
17776 !! wikitext
17777 <noinclude>==unmarked==</noinclude>
17778 ==marked==
17779 !! html/php
17780 ==marked==
17781 !!end
17782
17783 # Test behavior of bug 19910
17784 !! test
17785 Sectiion with all-equals
17786 !! options
17787 section=2
17788 !! wikitext
17789 ===
17790 The line above must have a trailing space
17791 === <!--
17792 --> <!-- -->
17793 But just in case it doesn't...
17794 !! html/php
17795 === <!--
17796 --> <!-- -->
17797 But just in case it doesn't...
17798 !! end
17799
17800 !! test
17801 Section replacement test (section 0)
17802 !! options
17803 replace=0,"xxx"
17804 !! wikitext
17805 start
17806 ==a==
17807 ===aa===
17808 ====aaa====
17809 ==b==
17810 ===ba===
17811 ===bb===
17812 ====bba====
17813 ===bc===
17814 ==c==
17815 ===ca===
17816 !! html/php
17817 xxx
17818
17819 ==a==
17820 ===aa===
17821 ====aaa====
17822 ==b==
17823 ===ba===
17824 ===bb===
17825 ====bba====
17826 ===bc===
17827 ==c==
17828 ===ca===
17829 !! end
17830
17831 !! test
17832 Section replacement test (section 1)
17833 !! options
17834 replace=1,"xxx"
17835 !! wikitext
17836 start
17837 ==a==
17838 ===aa===
17839 ====aaa====
17840 ==b==
17841 ===ba===
17842 ===bb===
17843 ====bba====
17844 ===bc===
17845 ==c==
17846 ===ca===
17847 !! html/php
17848 start
17849 xxx
17850
17851 ==b==
17852 ===ba===
17853 ===bb===
17854 ====bba====
17855 ===bc===
17856 ==c==
17857 ===ca===
17858 !! end
17859
17860 !! test
17861 Section replacement test (section 2)
17862 !! options
17863 replace=2,"xxx"
17864 !! wikitext
17865 start
17866 ==a==
17867 ===aa===
17868 ====aaa====
17869 ==b==
17870 ===ba===
17871 ===bb===
17872 ====bba====
17873 ===bc===
17874 ==c==
17875 ===ca===
17876 !! html/php
17877 start
17878 ==a==
17879 xxx
17880
17881 ==b==
17882 ===ba===
17883 ===bb===
17884 ====bba====
17885 ===bc===
17886 ==c==
17887 ===ca===
17888 !! end
17889
17890 !! test
17891 Section replacement test (section 3)
17892 !! options
17893 replace=3,"xxx"
17894 !! wikitext
17895 start
17896 ==a==
17897 ===aa===
17898 ====aaa====
17899 ==b==
17900 ===ba===
17901 ===bb===
17902 ====bba====
17903 ===bc===
17904 ==c==
17905 ===ca===
17906 !! html/php
17907 start
17908 ==a==
17909 ===aa===
17910 xxx
17911
17912 ==b==
17913 ===ba===
17914 ===bb===
17915 ====bba====
17916 ===bc===
17917 ==c==
17918 ===ca===
17919 !! end
17920
17921 !! test
17922 Section replacement test (section 4)
17923 !! options
17924 replace=4,"xxx"
17925 !! wikitext
17926 start
17927 ==a==
17928 ===aa===
17929 ====aaa====
17930 ==b==
17931 ===ba===
17932 ===bb===
17933 ====bba====
17934 ===bc===
17935 ==c==
17936 ===ca===
17937 !! html/php
17938 start
17939 ==a==
17940 ===aa===
17941 ====aaa====
17942 xxx
17943
17944 ==c==
17945 ===ca===
17946 !! end
17947
17948 !! test
17949 Section replacement test (section 5)
17950 !! options
17951 replace=5,"xxx"
17952 !! wikitext
17953 start
17954 ==a==
17955 ===aa===
17956 ====aaa====
17957 ==b==
17958 ===ba===
17959 ===bb===
17960 ====bba====
17961 ===bc===
17962 ==c==
17963 ===ca===
17964 !! html/php
17965 start
17966 ==a==
17967 ===aa===
17968 ====aaa====
17969 ==b==
17970 xxx
17971
17972 ===bb===
17973 ====bba====
17974 ===bc===
17975 ==c==
17976 ===ca===
17977 !! end
17978
17979 !! test
17980 Section replacement test (section 6)
17981 !! options
17982 replace=6,"xxx"
17983 !! wikitext
17984 start
17985 ==a==
17986 ===aa===
17987 ====aaa====
17988 ==b==
17989 ===ba===
17990 ===bb===
17991 ====bba====
17992 ===bc===
17993 ==c==
17994 ===ca===
17995 !! html/php
17996 start
17997 ==a==
17998 ===aa===
17999 ====aaa====
18000 ==b==
18001 ===ba===
18002 xxx
18003
18004 ===bc===
18005 ==c==
18006 ===ca===
18007 !! end
18008
18009 !! test
18010 Section replacement test (section 7)
18011 !! options
18012 replace=7,"xxx"
18013 !! wikitext
18014 start
18015 ==a==
18016 ===aa===
18017 ====aaa====
18018 ==b==
18019 ===ba===
18020 ===bb===
18021 ====bba====
18022 ===bc===
18023 ==c==
18024 ===ca===
18025 !! html/php
18026 start
18027 ==a==
18028 ===aa===
18029 ====aaa====
18030 ==b==
18031 ===ba===
18032 ===bb===
18033 xxx
18034
18035 ===bc===
18036 ==c==
18037 ===ca===
18038 !! end
18039
18040 !! test
18041 Section replacement test (section 8)
18042 !! options
18043 replace=8,"xxx"
18044 !! wikitext
18045 start
18046 ==a==
18047 ===aa===
18048 ====aaa====
18049 ==b==
18050 ===ba===
18051 ===bb===
18052 ====bba====
18053 ===bc===
18054 ==c==
18055 ===ca===
18056 !! html/php
18057 start
18058 ==a==
18059 ===aa===
18060 ====aaa====
18061 ==b==
18062 ===ba===
18063 ===bb===
18064 ====bba====
18065 xxx
18066
18067 ==c==
18068 ===ca===
18069 !!end
18070
18071 !! test
18072 Section replacement test (section 9)
18073 !! options
18074 replace=9,"xxx"
18075 !! wikitext
18076 start
18077 ==a==
18078 ===aa===
18079 ====aaa====
18080 ==b==
18081 ===ba===
18082 ===bb===
18083 ====bba====
18084 ===bc===
18085 ==c==
18086 ===ca===
18087 !! html/php
18088 start
18089 ==a==
18090 ===aa===
18091 ====aaa====
18092 ==b==
18093 ===ba===
18094 ===bb===
18095 ====bba====
18096 ===bc===
18097 xxx
18098 !! end
18099
18100 !! test
18101 Section replacement test (section 10)
18102 !! options
18103 replace=10,"xxx"
18104 !! wikitext
18105 start
18106 ==a==
18107 ===aa===
18108 ====aaa====
18109 ==b==
18110 ===ba===
18111 ===bb===
18112 ====bba====
18113 ===bc===
18114 ==c==
18115 ===ca===
18116 !! html/php
18117 start
18118 ==a==
18119 ===aa===
18120 ====aaa====
18121 ==b==
18122 ===ba===
18123 ===bb===
18124 ====bba====
18125 ===bc===
18126 ==c==
18127 xxx
18128 !! end
18129
18130 !! test
18131 Section replacement test with initial whitespace (bug 13728)
18132 !! options
18133 replace=2,"xxx"
18134 !! wikitext
18135 Preformatted initial line
18136 ==a==
18137 ===a===
18138 !! html/php
18139 Preformatted initial line
18140 ==a==
18141 xxx
18142 !! end
18143
18144
18145 !! test
18146 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18147 !! options
18148 section=1
18149 !! wikitext
18150 ==a==
18151 a
18152 !! html/php
18153 ==a==
18154 a
18155 !! end
18156
18157 !! test
18158 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18159 !! options
18160 section=1
18161 !! wikitext
18162 ==a==
18163 a
18164 !! html/php
18165 ==a==
18166 a
18167 !! end
18168
18169
18170 !! test
18171 Section extraction, <pre> around bogus header (bug 10309)
18172 !! options
18173 noxml section=2
18174 !! wikitext
18175 == Section One ==
18176 <pre>
18177 =======
18178 </pre>
18179
18180 == Section Two ==
18181 stuff
18182 !! html/php
18183 == Section Two ==
18184 stuff
18185 !! end
18186
18187 !! test
18188 Section replacement, <pre> around bogus header (bug 10309)
18189 !! options
18190 noxml replace=2,"xxx"
18191 !! wikitext
18192 == Section One ==
18193 <pre>
18194 =======
18195 </pre>
18196
18197 == Section Two ==
18198 stuff
18199 !! html/php
18200 == Section One ==
18201 <pre>
18202 =======
18203 </pre>
18204
18205 xxx
18206 !! end
18207
18208
18209 !! test
18210 Handling of &#x0A; in URLs
18211 !! wikitext
18212 ** irc://&#x0A;a
18213 !! html/php
18214 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18215
18216 !! html/parsoid
18217 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18218 a">irc://
18219 a</a></li></ul></li></ul>
18220 !! end
18221
18222 !! test
18223 Handling of %0A in URLs
18224 !! wikitext
18225 ** irc://%0Aa
18226 !! html/php
18227 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18228
18229 !! html/parsoid
18230 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18231 !! end
18232
18233
18234 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18235 !! test
18236 5 quotes, code coverage +1 line
18237 !! options
18238 parsoid=wt2html
18239 !! wikitext
18240 '''''
18241 !! html/php
18242 !! html/parsoid
18243 <p><b><i></i></b></p>
18244 !! end
18245
18246 # same html as previous, but wikitext adjusted to match parsoid html2wt
18247 # note that wt2html and html2html will put the <i> before the <b>
18248 !! test
18249 5 quotes, code coverage +1 line w/ nowiki (1)
18250 !! options
18251 parsoid=wt2wt,html2wt
18252 !! wikitext
18253 '''''<nowiki/>'''''
18254 !! html/php
18255 <p><i></i>
18256 </p>
18257 !! html/parsoid
18258 <p><b><i></i></b></p>
18259 !! end
18260
18261 # same as previous, just swapping the <i> and <b>
18262 !! test
18263 5 quotes, code coverage +1 line w/ nowiki (2)
18264 !! wikitext
18265 '''''<nowiki/>'''''
18266 !! html/php
18267 <p><i></i>
18268 </p>
18269 !! html/parsoid
18270 <p><i><b></b></i></p>
18271 !! end
18272
18273 !! test
18274 Special:Search page linking.
18275 !! wikitext
18276 {{Special:search}}
18277 !! html
18278 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18279 </p>
18280 !! end
18281
18282 !! test
18283 {{!}} is a magic word
18284 !! wikitext
18285 {{!}} is a magic word there and {{!}} is still a magic word here
18286 | is not a magic word here but {{!}} is still a magic word here
18287 !! html/php
18288 <p>| is a magic word there and | is still a magic word here
18289 | is not a magic word here but | is still a magic word here
18290 </p>
18291 !! html/parsoid
18292 <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
18293 | 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>
18294
18295 !! end
18296
18297 !! test
18298 Say the magic word
18299 !! options
18300 title=[[Parser test]]
18301 !! wikitext
18302 * {{PAGENAME}}
18303 * {{PAGENAMEE}}
18304 * {{FULLPAGENAME}}
18305 * {{FULLPAGENAMEE}}
18306 * {{BASEPAGENAME}}
18307 * {{BASEPAGENAMEE}}
18308 * {{SUBPAGENAME}}
18309 * {{SUBPAGENAMEE}}
18310 * {{ROOTPAGENAME}}
18311 * {{ROOTPAGENAMEE}}
18312 * {{TALKPAGENAME}}
18313 * {{TALKPAGENAMEE}}
18314 * {{SUBJECTPAGENAME}}
18315 * {{SUBJECTPAGENAMEE}}
18316 * {{NAMESPACEE}}
18317 * {{NAMESPACE}}
18318 * {{NAMESPACENUMBER}}
18319 * {{TALKSPACE}}
18320 * {{TALKSPACEE}}
18321 * {{SUBJECTSPACE}}
18322 * {{SUBJECTSPACEE}}
18323 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18324 !! html
18325 <ul><li> Parser test</li>
18326 <li> Parser_test</li>
18327 <li> Parser test</li>
18328 <li> Parser_test</li>
18329 <li> Parser test</li>
18330 <li> Parser_test</li>
18331 <li> Parser test</li>
18332 <li> Parser_test</li>
18333 <li> Parser test</li>
18334 <li> Parser_test</li>
18335 <li> Talk:Parser test</li>
18336 <li> Talk:Parser_test</li>
18337 <li> Parser test</li>
18338 <li> Parser_test</li>
18339 <li> </li>
18340 <li> </li>
18341 <li> 0</li>
18342 <li> Talk</li>
18343 <li> Talk</li>
18344 <li> </li>
18345 <li> </li>
18346 <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>
18347
18348 !! end
18349 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18350
18351 !! test
18352 Gallery
18353 !! wikitext
18354 <gallery>
18355 image1.png |
18356 image2.gif|||||
18357
18358 image3|
18359 image4 |300px| centre
18360 image5.svg| http://///////
18361 [[x|xx]]]]
18362 * image6
18363 </gallery>
18364 !! html
18365 <ul class="gallery mw-gallery-traditional">
18366 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18367 <div class="thumb" style="height: 150px;">Image1.png</div>
18368 <div class="gallerytext">
18369 </div>
18370 </div></li>
18371 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18372 <div class="thumb" style="height: 150px;">Image2.gif</div>
18373 <div class="gallerytext">
18374 </div>
18375 </div></li>
18376 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18377 <div class="thumb" style="height: 150px;">Image3</div>
18378 <div class="gallerytext">
18379 </div>
18380 </div></li>
18381 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18382 <div class="thumb" style="height: 150px;">Image4</div>
18383 <div class="gallerytext">
18384 <pre>centre
18385 </pre>
18386 </div>
18387 </div></li>
18388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18389 <div class="thumb" style="height: 150px;">Image5.svg</div>
18390 <div class="gallerytext">
18391 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18392 </p>
18393 </div>
18394 </div></li>
18395 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18396 <div class="thumb" style="height: 150px;">* image6</div>
18397 <div class="gallerytext">
18398 </div>
18399 </div></li>
18400 </ul>
18401
18402 !! end
18403
18404 !! test
18405 Gallery (with options)
18406 !! wikitext
18407 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18408 File:Nonexistent.jpg|caption
18409 File:Nonexistent.jpg
18410 image:foobar.jpg|some '''caption''' [[Main Page]]
18411 image:foobar.jpg
18412 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18413 </gallery>
18414 !! html
18415 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18416 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18417 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18418 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18419 <div class="gallerytext">
18420 <p>caption
18421 </p>
18422 </div>
18423 </div></li>
18424 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18425 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18426 <div class="gallerytext">
18427 </div>
18428 </div></li>
18429 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18430 <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>
18431 <div class="gallerytext">
18432 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18433 </p>
18434 </div>
18435 </div></li>
18436 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18437 <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>
18438 <div class="gallerytext">
18439 </div>
18440 </div></li>
18441 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18442 <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>
18443 <div class="gallerytext">
18444 <p>blabla.
18445 </p>
18446 </div>
18447 </div></li>
18448 </ul>
18449
18450 !! end
18451
18452 !! test
18453 Gallery with link that has fragment
18454 !! wikitext
18455 <gallery>
18456 image:foobar.jpg|link=Main_Page
18457 image:foobar.jpg|link=Main_Page#section
18458 image:foobar.jpg|link=Main Page#section|caption
18459 </gallery>
18460 !! html
18461 <ul class="gallery mw-gallery-traditional">
18462 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18463 <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>
18464 <div class="gallerytext">
18465 </div>
18466 </div></li>
18467 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18468 <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>
18469 <div class="gallerytext">
18470 </div>
18471 </div></li>
18472 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18473 <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>
18474 <div class="gallerytext">
18475 <p>caption
18476 </p>
18477 </div>
18478 </div></li>
18479 </ul>
18480
18481 !! end
18482
18483 !! test
18484 Gallery with wikitext inside caption
18485 !! wikitext
18486 <gallery>
18487 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18488 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18489 </gallery>
18490 !! html
18491 <ul class="gallery mw-gallery-traditional">
18492 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18493 <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>
18494 <div class="gallerytext">
18495 <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>
18496 </p>
18497 </div>
18498 </div></li>
18499 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18500 <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>
18501 <div class="gallerytext">
18502 <p>This is a test template
18503 </p>
18504 </div>
18505 </div></li>
18506 </ul>
18507
18508 !! end
18509
18510 !! test
18511 gallery (with showfilename option)
18512 !! wikitext
18513 <gallery showfilename>
18514 File:Nonexistent.jpg|caption
18515 File:Nonexistent.jpg
18516 image:foobar.jpg|some '''caption''' [[Main Page]]
18517 File:Foobar.jpg
18518 </gallery>
18519 !! html
18520 <ul class="gallery mw-gallery-traditional">
18521 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18522 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18523 <div class="gallerytext">
18524 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18525 caption
18526 </p>
18527 </div>
18528 </div></li>
18529 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18530 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18531 <div class="gallerytext">
18532 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18533 </p>
18534 </div>
18535 </div></li>
18536 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18537 <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>
18538 <div class="gallerytext">
18539 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18540 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18541 </p>
18542 </div>
18543 </div></li>
18544 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18545 <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>
18546 <div class="gallerytext">
18547 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18548 </p>
18549 </div>
18550 </div></li>
18551 </ul>
18552
18553 !! end
18554
18555 !! test
18556 Gallery (with namespace-less filenames)
18557 !! wikitext
18558 <gallery>
18559 File:Nonexistent.jpg
18560 Nonexistent.jpg
18561 image:foobar.jpg
18562 foobar.jpg
18563 </gallery>
18564 !! html
18565 <ul class="gallery mw-gallery-traditional">
18566 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18567 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18568 <div class="gallerytext">
18569 </div>
18570 </div></li>
18571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18572 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18573 <div class="gallerytext">
18574 </div>
18575 </div></li>
18576 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18577 <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>
18578 <div class="gallerytext">
18579 </div>
18580 </div></li>
18581 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18582 <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>
18583 <div class="gallerytext">
18584 </div>
18585 </div></li>
18586 </ul>
18587
18588 !! end
18589
18590 !! test
18591 HTML Hex character encoding (spells the word "JavaScript")
18592 !! options
18593 parsoid=wt2html,wt2wt,html2html
18594 !! wikitext
18595 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18596 !! html/php
18597 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18598 </p>
18599 !! html/php+tidy
18600 <p>JavaScript</p>
18601 !! html/parsoid
18602 <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>
18603 !! end
18604
18605 !! test
18606 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18607 !! wikitext
18608 &#xsee;&#XSEE;
18609 !! html/php
18610 <p>&amp;#xsee;&amp;#XSEE;
18611 </p>
18612 !! html/parsoid
18613 <p>&amp;#xsee;&amp;#XSEE;</p>
18614 !! end
18615
18616 !! test
18617 HTML Hex character encoding mixed case
18618 !! options
18619 parsoid=wt2html,wt2wt,html2html
18620 !! wikitext
18621 &#xEE;&#Xee;
18622 !! html/php
18623 <p>&#xee;&#xee;
18624 </p>
18625 !! html/php+tidy
18626 <p>îî</p>
18627 !! html/parsoid
18628 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18629 !! end
18630
18631 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18632 # Note that U+000C (form feed) is not a valid XML character, so
18633 # it is banned even though allowed in HTML5.
18634 !! test
18635 Illegal character references (T106578)
18636 !! wikitext
18637 ; Null: &#00;
18638 ; FF: &#xC;
18639 ; CR: &#xD;
18640 ; Control (low): &#8;
18641 ; Control (high): &#x7F; &#x9F;
18642 ; Surrogate: &#xD83D;&#xDCA9;
18643 ; This is an okay astral character: &#x1F4A9;
18644 !! html+tidy
18645 <dl>
18646 <dt>Null</dt>
18647 <dd>&amp;#00;</dd>
18648 <dt>FF</dt>
18649 <dd>&amp;#xC;</dd>
18650 <dt>CR</dt>
18651 <dd>&amp;#xD;</dd>
18652 <dt>Control (low)</dt>
18653 <dd>&amp;#8;</dd>
18654 <dt>Control (high)</dt>
18655 <dd>&amp;#x7F; &amp;#x9F;</dd>
18656 <dt>Surrogate</dt>
18657 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18658 <dt>This is an okay astral character</dt>
18659 <dd>💩</dd>
18660 </dl>
18661 !! end
18662
18663 !! test
18664 __FORCETOC__ override
18665 !! wikitext
18666 __NEWSECTIONLINK__
18667 __FORCETOC__
18668 !! html/php
18669 <p><br />
18670 </p>
18671 !! end
18672
18673 !! test
18674 ISBN code coverage
18675 !! wikitext
18676 ISBN 978-0-1234-56&#x20;789
18677 !! html
18678 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18679 </p>
18680 !! html+tidy
18681 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18682 !! html/parsoid
18683 <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>
18684 !! end
18685
18686 !! test
18687 ISBN followed by 5 spaces
18688 !! wikitext
18689 ISBN
18690 !! html
18691 <p>ISBN
18692 </p>
18693 !! end
18694
18695 !! test
18696 Double ISBN
18697 !! wikitext
18698 ISBN ISBN 1234567890
18699 !! html/php
18700 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18701 </p>
18702 !! html/parsoid
18703 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18704 !! end
18705
18706 # Uppercase X and lowercase x as well
18707 !! test
18708 ISBN with an X
18709 !! wikitext
18710 ISBN 3-462-04561-X
18711 ISBN 3-462-04561-x
18712 ISBN 080442957X
18713 ISBN 080442957x
18714 ISBN 978080442957X
18715 ISBN 978080442957x
18716 !! html/php
18717 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18718 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18719 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18720 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18721 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18722 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18723 </p>
18724 !! html/parsoid
18725 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18726 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18727 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18728 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18729 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18730 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18731 !! end
18732
18733 !! test
18734 ISBN with empty prefix (parsoid test)
18735 !! wikitext
18736 ISBN 1234567890
18737 !! html/php
18738 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18739 </p>
18740 !! html/parsoid
18741 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18742 !! end
18743
18744 !! test
18745 Bug 22905: <abbr> followed by ISBN followed by </a>
18746 !! wikitext
18747 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18748 !! html/php
18749 <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>
18750 </p>
18751 !! html/parsoid
18752 <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>
18753 !! end
18754
18755 !! test
18756 Double RFC
18757 !! wikitext
18758 RFC RFC 1234
18759 !! html
18760 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18761 </p>
18762 !! end
18763
18764 !! test
18765 Double RFC with a wiki link
18766 !! wikitext
18767 RFC [[RFC 1234]]
18768 !! html
18769 <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>
18770 </p>
18771 !! end
18772
18773 !! test
18774 RFC code coverage
18775 !! wikitext
18776 RFC 983&#x20;987
18777 !! html
18778 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18779 </p>
18780 !! html+tidy
18781 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18782 !! end
18783
18784 !! test
18785 Centre-aligned image
18786 !! wikitext
18787 [[Image:foobar.jpg|centre]]
18788 !! html
18789 <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>
18790
18791 !!end
18792
18793 !! test
18794 None-aligned image
18795 !! wikitext
18796 [[Image:foobar.jpg|none]]
18797 !! html
18798 <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>
18799
18800 !!end
18801
18802 !! test
18803 Width + Height sized image (using px) (height is ignored)
18804 !! wikitext
18805 [[Image:foobar.jpg|640x480px]]
18806 !! html
18807 <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>
18808 </p>
18809 !!end
18810
18811 !! test
18812 Width-sized image (using px, no following whitespace)
18813 !! wikitext
18814 [[Image:foobar.jpg|640px]]
18815 !! html
18816 <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>
18817 </p>
18818 !!end
18819
18820 !! test
18821 Width-sized image (using px, with following whitespace - test regression from r39467)
18822 !! wikitext
18823 [[Image:foobar.jpg|640px ]]
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, with preceding whitespace - test regression from r39467)
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 Image with page parameter
18840 !! options
18841 djvu
18842 !! wikitext
18843 [[File:LoremIpsum.djvu|page=2]]
18844 !! html/php
18845 <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>
18846 </p>
18847 !! html/parsoid
18848 <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>
18849 !! end
18850
18851 !! test
18852 Another italics / bold test
18853 !! wikitext
18854 ''' ''x'
18855 !! html
18856 <pre>'<i> </i>x'
18857 </pre>
18858 !!end
18859
18860 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18861 !! test
18862 dt/dd/dl test
18863 !! wikitext
18864 :;;;::
18865 !! html/php
18866 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18867
18868 !! html/parsoid
18869 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18870
18871 !!end
18872
18873
18874 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18875 !! test
18876 Images with the "|" character in the comment
18877 !! wikitext
18878 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18879 !! html/php
18880 <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>
18881
18882 !! html/parsoid
18883 <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>
18884 !! end
18885
18886 !! test
18887 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18888 !! wikitext
18889 <html><script>alert(1);</script></html>
18890 !! html
18891 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18892 </p>
18893 !! end
18894
18895 !! test
18896 HTML with raw HTML ($wgRawHtml==true)
18897 !! options
18898 wgRawHtml=1
18899 !! wikitext
18900 <html><script>alert(1);</script></html>
18901 !! html
18902 <p><script>alert(1);</script>
18903 </p>
18904 !! end
18905
18906 !! test
18907 Parents of subpages, one level up
18908 !! options
18909 subpage title=[[Subpage test/L1/L2/L3]]
18910 !! wikitext
18911 [[../|L2]]
18912 !! html
18913 <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>
18914 </p>
18915 !! end
18916
18917
18918 !! test
18919 Parents of subpages, one level up, not named
18920 !! options
18921 subpage title=[[Subpage test/L1/L2/L3]]
18922 !! wikitext
18923 [[../]]
18924 !! html
18925 <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>
18926 </p>
18927 !! end
18928
18929
18930
18931 !! test
18932 Parents of subpages, two levels up
18933 !! options
18934 subpage title=[[Subpage test/L1/L2/L3]]
18935 !! wikitext
18936 [[../../|L1]]2
18937
18938 [[../../|L1]]l
18939 !! html
18940 <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
18941 </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>
18942 </p>
18943 !! end
18944
18945 !! test
18946 Parents of subpages, two levels up, without trailing slash or name.
18947 !! options
18948 subpage title=[[Subpage test/L1/L2/L3]]
18949 !! wikitext
18950 [[../..]]
18951 !! html
18952 <p>[[../..]]
18953 </p>
18954 !! end
18955
18956 !! test
18957 Parents of subpages, two levels up, with lots of extra trailing slashes.
18958 !! options
18959 subpage title=[[Subpage test/L1/L2/L3]]
18960 !! wikitext
18961 [[../../////]]
18962 !! html
18963 <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>
18964 </p>
18965 !! end
18966
18967 !! article
18968 Subpage test/L1/L2/L3Sibling
18969 !! text
18970 Sibling article
18971 !! endarticle
18972
18973 !! test
18974 Transclusion of a sibling page (one level up)
18975 !! options
18976 subpage title=[[Subpage test/L1/L2/L3]]
18977 !! wikitext
18978 {{../L3Sibling}}
18979 !! html
18980 <p>Sibling article
18981 </p>
18982 !! end
18983
18984 !! test
18985 Transclusion of a child page
18986 !! options
18987 subpage title=[[Subpage test/L1/L2]]
18988 !! wikitext
18989 {{/L3Sibling}}
18990 !! html
18991 <p>Sibling article
18992 </p>
18993 !! end
18994
18995 !! test
18996 Non-transclusion because of too many up levels
18997 !! options
18998 subpage title=[[Subpage test/L1/L2/L3]]
18999 !! wikitext
19000 {{../../../../More than parent}}
19001 !! html
19002 <p>{{../../../../More than parent}}
19003 </p>
19004 !! end
19005
19006 !! test
19007 Definition list code coverage
19008 !! wikitext
19009 ; title : def
19010 ; title : def
19011 ;title: def
19012 !! html/php
19013 <dl><dt> title &#160;</dt>
19014 <dd> def</dd>
19015 <dt> title&#160;</dt>
19016 <dd> def</dd>
19017 <dt>title</dt>
19018 <dd> def</dd></dl>
19019
19020 !! html/parsoid
19021 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19022 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19023 <dt>title</dt><dd> def</dd></dl>
19024 !! end
19025
19026 !! test
19027 Don't fall for the self-closing div
19028 !! wikitext
19029 <div>hello world</div/>
19030 !! html
19031 <div>hello world</div>
19032
19033 !! end
19034
19035 !! test
19036 MSGNW magic word
19037 !! wikitext
19038 {{MSGNW:msg}}
19039 !! html/php
19040 <p>&#91;&#91;:Template:Msg&#93;&#93;
19041 </p>
19042 !! end
19043
19044 !! test
19045 RAW magic word
19046 !! wikitext
19047 {{RAW:QUERTY}}
19048 !! html
19049 <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>
19050 </p>
19051 !! end
19052
19053 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19054 !! test
19055 Always escape literal '>' in output, not just after '<'
19056 !! wikitext
19057 ><>
19058 !! html
19059 <p>&gt;&lt;&gt;
19060 </p>
19061 !! end
19062
19063 !! test
19064 Template caching
19065 !! wikitext
19066 {{Test}}
19067 {{Test}}
19068 !! html
19069 <p>This is a test template
19070 This is a test template
19071 </p>
19072 !! end
19073
19074
19075 !! article
19076 MediaWiki:Fake
19077 !! text
19078 ==header==
19079 !! endarticle
19080
19081 !! test
19082 Inclusion of !userCanEdit() content
19083 !! wikitext
19084 {{MediaWiki:Fake}}
19085 !! html
19086 <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>
19087
19088 !! end
19089
19090
19091 !! test
19092 Out-of-order TOC heading levels
19093 !! wikitext
19094 ==2==
19095 ======6======
19096 ===3===
19097 =1=
19098 =====5=====
19099 ==2==
19100 !! html
19101 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19102 <ul>
19103 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19104 <ul>
19105 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19106 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19107 </ul>
19108 </li>
19109 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19110 <ul>
19111 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19112 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19113 </ul>
19114 </li>
19115 </ul>
19116 </div>
19117
19118 <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>
19119 <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>
19120 <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>
19121 <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>
19122 <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>
19123 <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>
19124
19125 !! end
19126
19127
19128 !! test
19129 ISBN with a dummy number
19130 !! wikitext
19131 ISBN ---
19132 !! html
19133 <p>ISBN ---
19134 </p>
19135 !! end
19136
19137
19138 !! test
19139 ISBN with space-delimited number
19140 !! wikitext
19141 ISBN 92 9017 032 8
19142 !! html
19143 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19144 </p>
19145 !! end
19146
19147
19148 !! test
19149 ISBN with multiple spaces, no number
19150 !! wikitext
19151 ISBN foo
19152 !! html
19153 <p>ISBN foo
19154 </p>
19155 !! end
19156
19157
19158 !! test
19159 ISBN length
19160 !! wikitext
19161 ISBN 123456789
19162
19163 ISBN 1234567890
19164
19165 ISBN 12345678901
19166 !! html
19167 <p>ISBN 123456789
19168 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19169 </p><p>ISBN 12345678901
19170 </p>
19171 !! end
19172
19173
19174 !! test
19175 ISBN with trailing year (bug 8110)
19176 !! wikitext
19177 ISBN 1-234-56789-0 - 2006
19178
19179 ISBN 1 234 56789 0 - 2006
19180 !! html
19181 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19182 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19183 </p>
19184 !! end
19185
19186
19187 !! test
19188 anchorencode
19189 !! wikitext
19190 {{anchorencode:foo bar©#%n}}
19191 !! html
19192 <p>foo_bar.C2.A9.23.25n
19193 </p>
19194 !! end
19195
19196 !! test
19197 anchorencode trims spaces
19198 !! wikitext
19199 {{anchorencode: __pretty__please__}}
19200 !! html
19201 <p>pretty_please
19202 </p>
19203 !! end
19204
19205 !! test
19206 anchorencode deals with links
19207 !! wikitext
19208 {{anchorencode: [[hello|world]] [[hi]]}}
19209 !! html
19210 <p>world_hi
19211 </p>
19212 !! end
19213
19214 !! test
19215 anchorencode deals with templates
19216 !! wikitext
19217 {{anchorencode: {{Foo}} }}
19218 !! html
19219 <p>FOO
19220 </p>
19221 !! end
19222
19223 !! test
19224 anchorencode encodes like the TOC generator: (bug 18431)
19225 !! wikitext
19226 === _ +:.3A%3A&&amp;]] ===
19227 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19228 __NOEDITSECTION__
19229 !! html
19230 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19231 <p>.2B:.3A.253A.26.26.5D.5D
19232 </p>
19233 !! end
19234
19235 !! test
19236 Bug 6200: blockquotes and paragraph formatting
19237 !! wikitext
19238 <blockquote>
19239 foo
19240 </blockquote>
19241
19242 bar
19243
19244 baz
19245 !! html
19246 <blockquote>
19247 <p>foo
19248 </p>
19249 </blockquote>
19250 <p>bar
19251 </p>
19252 <pre>baz
19253 </pre>
19254 !! end
19255
19256 !! test
19257 Bug 8293: Use of center tag ruins paragraph formatting
19258 !! wikitext
19259 <center>
19260 foo
19261 </center>
19262
19263 bar
19264
19265 baz
19266 !! html
19267 <center>
19268 <p>foo
19269 </p>
19270 </center>
19271 <p>bar
19272 </p>
19273 <pre>baz
19274 </pre>
19275 !! end
19276
19277 !!test
19278 Parsing of overlapping (improperly nested) inline html tags
19279 !! wikitext
19280 <span><s>x</span></s>
19281 !! html/php
19282 <p><span><s>x&lt;/span&gt;</s></span>
19283 </p>
19284 !! html/parsoid
19285 <p><span><s>x</s></span>
19286 </p>
19287 !!end
19288
19289 ###
19290 ### Language variants related tests
19291 ###
19292 !! test
19293 Self-link in language variants
19294 !! options
19295 title=[[Dunav]] language=sr
19296 !! wikitext
19297 Both [[Dunav]] and [[Дунав]] are names for this river.
19298 !! html
19299 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19300 </p>
19301 !!end
19302
19303 !! article
19304 Дуна
19305 !! text
19306 content
19307 !! endarticle
19308
19309 !! test
19310 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19311 !! options
19312 title=[[Duna]] language=sr
19313 !! wikitext
19314 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19315 !! html
19316 <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.
19317 </p>
19318 !! end
19319
19320 !! test
19321 Link to a section of a variant of this title shouldn't be parsed as self-link
19322 !! options
19323 title=[[Duna]] language=sr
19324 !! wikitext
19325 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19326 !! html
19327 <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.
19328 </p>
19329 !! end
19330
19331 !! test
19332 Link to pages in language variants
19333 !! options
19334 language=sr
19335 !! wikitext
19336 Main Page can be written as [[Маин Паге]]
19337 !! html
19338 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19339 </p>
19340 !!end
19341
19342
19343 !! test
19344 Multiple links to pages in language variants
19345 !! options
19346 language=sr
19347 !! wikitext
19348 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19349 !! html
19350 <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>.
19351 </p>
19352 !!end
19353
19354
19355 !! test
19356 Simple template in language variants
19357 !! options
19358 language=sr
19359 !! wikitext
19360 {{тест}}
19361 !! html
19362 <p>This is a test template
19363 </p>
19364 !! end
19365
19366
19367 !! test
19368 Template with explicit namespace in language variants
19369 !! options
19370 language=sr
19371 !! wikitext
19372 {{Template:тест}}
19373 !! html
19374 <p>This is a test template
19375 </p>
19376 !! end
19377
19378
19379 !! test
19380 Basic test for template parameter in language variants
19381 !! options
19382 language=sr
19383 !! wikitext
19384 {{парамтест|param=foo}}
19385 !! html
19386 <p>This is a test template with parameter foo
19387 </p>
19388 !! end
19389
19390
19391 !! test
19392 Simple category in language variants
19393 !! options
19394 language=sr cat
19395 !! wikitext
19396 [[Category:МедиаWики Усер'с Гуиде]]
19397 !! html
19398 <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>
19399 !! end
19400
19401
19402 !! article
19403 Category:分类
19404 !! text
19405 blah
19406 !! endarticle
19407
19408 !! article
19409 Category:分類
19410 !! text
19411 blah
19412 !! endarticle
19413
19414 ## We used to, but no longer wt2wt this test since the default serializer
19415 ## will normalize all categories to serialize on their own line.
19416 ## This wikitext usage is going to be fairly uncommon in production and
19417 ## selser will take care of preserving formatting in those scenarios.
19418 !! test
19419 Don't convert blue categorylinks to another variant (bug 33210)
19420 !! options
19421 cat
19422 language=zh
19423 parsoid=wt2html
19424 !! wikitext
19425 [[A]][[Category:分类]]
19426 !! html/php
19427 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19428 !! html/parsoid
19429 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19430 <link rel="mw:PageProp/Category" href="Category:分类"/>
19431 !! end
19432
19433 !! test
19434 Stripping -{}- tags (language variants)
19435 !! options
19436 language=sr
19437 !! wikitext
19438 Latin proverb: -{Ne nuntium necare}-
19439 !! html
19440 <p>Latin proverb: Ne nuntium necare
19441 </p>
19442 !! end
19443
19444
19445 !! test
19446 Prevent conversion with -{}- tags (language variants)
19447 !! options
19448 language=sr variant=sr-ec
19449 !! wikitext
19450 Latinski: -{Ne nuntium necare}-
19451 !! html
19452 <p>Латински: Ne nuntium necare
19453 </p>
19454 !! end
19455
19456
19457 !! test
19458 Prevent conversion of text with -{}- tags (language variants)
19459 !! options
19460 language=sr variant=sr-ec
19461 !! wikitext
19462 Latinski: -{Ne nuntium necare}-
19463 !! html
19464 <p>Латински: Ne nuntium necare
19465 </p>
19466 !! end
19467
19468
19469 !! test
19470 Prevent conversion of links with -{}- tags (language variants)
19471 !! options
19472 language=sr variant=sr-ec
19473 !! wikitext
19474 -{[[Main Page]]}-
19475 !! html
19476 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19477 </p>
19478 !! end
19479
19480
19481 !! test
19482 -{}- tags within headlines (within html for parserConvert())
19483 !! options
19484 language=sr variant=sr-ec
19485 !! wikitext
19486 == -{Naslov}- ==
19487 !! html
19488 <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>
19489
19490 !! end
19491
19492
19493 !! test
19494 Explicit definition of language variant alternatives
19495 !! options
19496 language=zh variant=zh-tw
19497 !! wikitext
19498 -{zh:China;zh-tw:Taiwan}-, not China
19499 !! html
19500 <p>Taiwan, not China
19501 </p>
19502 !! end
19503
19504
19505 !! test
19506 Conversion around HTML tags
19507 !! options
19508 language=sr variant=sr-ec
19509 !! wikitext
19510 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19511 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19512 !! html
19513 <p>
19514 <span title="ЛаCтин">ски</span>
19515 </p>
19516 !! end
19517
19518
19519 !! test
19520 Explicit session-wise language variant mapping (A flag and - flag)
19521 !! options
19522 language=zh variant=zh-tw
19523 !! wikitext
19524 Taiwan is not China.
19525 But -{A|zh:China;zh-tw:Taiwan}- is China,
19526 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19527 and -{China}- is China.
19528 !! html
19529 <p>Taiwan is not China.
19530 But Taiwan is Taiwan,
19531 (This should be stripped!)
19532 and China is China.
19533 </p>
19534 !! end
19535
19536 !! test
19537 Explicit session-wise language variant mapping (H flag for hide)
19538 !! options
19539 language=zh variant=zh-tw
19540 !! wikitext
19541 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19542 Taiwan is China.
19543 !! html
19544 <p>(This should be stripped!)
19545 Taiwan is Taiwan.
19546 </p>
19547 !! end
19548
19549 !! test
19550 Adding explicit conversion rule for title (T flag)
19551 !! options
19552 language=zh variant=zh-tw showtitle
19553 !! wikitext
19554 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19555 !! html
19556 Taiwan
19557 <p>Should be stripped!
19558 </p>
19559 !! end
19560
19561 !! test
19562 Testing that changing the language variant here in the tests actually works
19563 !! options
19564 language=zh variant=zh showtitle
19565 !! wikitext
19566 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19567 !! html
19568 China
19569 <p>Should be stripped!
19570 </p>
19571 !! end
19572
19573 !! test
19574 Recursive conversion of alt and title attrs shouldn't clear converter state
19575 !! options
19576 language=zh variant=zh-cn showtitle
19577 !! wikitext
19578 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19579 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19580 !! html
19581 China
19582 <p>
19583 Should be stripped<span title="Exclamation">!</span>
19584 </p>
19585 !! end
19586
19587 !! test
19588 Bug 24072: more test on conversion rule for title
19589 !! options
19590 language=zh variant=zh-tw showtitle
19591 !! wikitext
19592 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19593 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19594 !! html
19595 Taiwan
19596 <p>This should be stripped!
19597 This won't take interferes with the title rule.
19598 </p>
19599 !! end
19600
19601 !! test
19602 Partly disable title conversion if variant == main language code
19603 !! options
19604 language=zh variant=zh title=[[ZH]] showtitle
19605 !! wikitext
19606 -{T|zh-cn:CN;zh-tw:TW}-
19607 !! html
19608 ZH
19609 <p>
19610 </p>
19611 !! end
19612
19613 !! test
19614 Partly disable title conversion if variant == main language code, more
19615 !! options
19616 language=zh variant=zh title=[[ZH]] showtitle
19617 !! wikitext
19618 -{T|TW}-
19619 !! html
19620 ZH
19621 <p>
19622 </p>
19623 !! end
19624
19625 !! test
19626 Raw output of variant escape tags (R flag)
19627 !! options
19628 language=zh variant=zh-tw
19629 !! wikitext
19630 Raw: -{R|zh:China;zh-tw:Taiwan}-
19631 !! html
19632 <p>Raw: zh:China;zh-tw:Taiwan
19633 </p>
19634 !! end
19635
19636 !! test
19637 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19638 !! options
19639 language=zh variant=zh-cn
19640 !! input
19641 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19642 !! result
19643 <p>0
19644 </p>
19645 !! end
19646
19647 !! test
19648 Conversion rules from [numeric-only string] to [something else] (T48634)
19649 !! options
19650 language=zh variant=zh-cn
19651 !! input
19652 -{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
19653 !! result
19654 <p>D12345EE12345
19655 </p>
19656 !! end
19657
19658 !! test
19659 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19660 !! options
19661 language=zh variant=zh-cn
19662 !! input
19663 -{H|zh-cn:foo;zh-tw:;}-foobar
19664 !! result
19665 <p>foobar
19666 </p>
19667 !! end
19668
19669 !! test
19670 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19671 !! options
19672 language=zh variant=zh-cn
19673 !! input
19674 -{H|=>zh-cn:foo;}-foobar
19675 !! result
19676 <p>foobar
19677 </p>
19678 !! end
19679
19680 !! test
19681 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19682 !! options
19683 language=zh variant=zh-cn
19684 !! input
19685 -{H|}-foobar
19686 !! result
19687 <p>foobar
19688 </p>
19689 !! end
19690
19691 !! test
19692 Nested using of manual convert syntax
19693 !! options
19694 language=zh variant=zh-hk
19695 !! wikitext
19696 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19697 !! html
19698 <p>Nested: Hello Hong Kong!
19699 </p>
19700 !! end
19701
19702 !! test
19703 Proper conversion of text in external links
19704 !! options
19705 language=sr variant=sr-ec
19706 !! wikitext
19707 http://www.google.com
19708 gopher://www.google.com
19709 [http://www.google.com http://www.google.com]
19710 [gopher://www.google.com gopher://www.google.com]
19711 [https://www.google.com irc://www.google.com]
19712 [ftp://www.google.com www.google.com/ftp://dir]
19713 [//www.google.com www.google.com]
19714 !! html
19715 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19716 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19717 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19718 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19719 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19720 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19721 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19722 </p>
19723 !! end
19724
19725 !! test
19726 Do not convert roman numbers to language variants
19727 !! options
19728 language=sr variant=sr-ec
19729 !! wikitext
19730 Fridrih IV je car.
19731 !! html
19732 <p>Фридрих IV је цар.
19733 </p>
19734 !! end
19735
19736 !! test
19737 Unclosed language converter markup "-{"
19738 !! options
19739 language=sr
19740 !! wikitext
19741 -{T|hello
19742 !! html
19743 <p>-{T|hello
19744 </p>
19745 !! end
19746
19747 !! test
19748 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19749 !! options
19750 language=sr
19751 !! wikitext
19752 -{R|=&gt;}-
19753 !! html
19754 <p>=&gt;
19755 </p>
19756 !!end
19757
19758 !! test
19759 Don't break link parsing if language converter markup is in the caption.
19760 !! options
19761 language=sr variant=sr-ec
19762 !! wikitext
19763 [[Main Page|-{R|main page}-]]
19764 !! html
19765 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19766 </p>
19767 !! end
19768
19769 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19770 !! test
19771 Don't break image parsing if language converter markup is in the caption.
19772 !! options
19773 language=sr
19774 !! wikitext
19775 [[File:Foobar.jpg|-{R|caption}-]]
19776 !! html/parsoid
19777 <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>
19778 </p>
19779 !! end
19780
19781 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19782 !! test
19783 Don't break list handling if language converter markup is in the item.
19784 !! options
19785 language=zh variant=zh-cn
19786 !! wikitext
19787 ;-{zh-cn:AAA;zh-tw:BBB}-
19788 !! html/php
19789 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19790
19791 !! html/parsoid
19792 <dl><dt>AAA
19793 </dt></dl>
19794 !! end
19795
19796 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19797 !! test
19798 Don't break table handling if language converter markup is in the cell.
19799 !! options
19800 language=sr variant=sr-ec
19801 !! wikitext
19802 {|
19803 |-
19804 | -{R|B}-
19805 |}
19806 !! html/php
19807 <table>
19808
19809 <tr>
19810 <td>Б}-
19811 </td></tr></table>
19812
19813 !! html/parsoid
19814 <table>
19815
19816 <tr>
19817 <td> B
19818 </td></tr></table>
19819
19820 !! end
19821
19822 !! test
19823 Bug 529: Uncovered bullet
19824 !! wikitext
19825 * Foo {{bullet}}
19826 !! html
19827 <ul><li> Foo </li>
19828 <li> Bar</li></ul>
19829
19830 !! end
19831
19832 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19833 # Templates in Wikipedia rely on this behavior, as tidy has always been
19834 # enabled there. These tests are normally run *without* tidy, so specify the
19835 # full output here.
19836 # To test realistic parsing behavior, apply a tidy-like transformation to both
19837 # the expected output and your parser's output.
19838 !! test
19839 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19840 !! wikitext
19841 ******* Foo {{bullet}}
19842 !! html
19843 <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>
19844 <li> Bar</li></ul>
19845
19846 !! end
19847
19848 !! test
19849 Bug 529: Uncovered table already at line-start
19850 !! wikitext
19851 x
19852
19853 {{table}}
19854 y
19855 !! html
19856 <p>x
19857 </p>
19858 <table>
19859 <tr>
19860 <td> 1 </td>
19861 <td> 2
19862 </td></tr>
19863 <tr>
19864 <td> 3 </td>
19865 <td> 4
19866 </td></tr></table>
19867 <p>y
19868 </p>
19869 !! end
19870
19871 !! test
19872 Bug 529: Uncovered bullet in parser function result
19873 !! wikitext
19874 * Foo {{lc:{{bullet}} }}
19875 !! html
19876 <ul><li> Foo </li>
19877 <li> bar</li></ul>
19878
19879 !! end
19880
19881 !! test
19882 Bug 5678: Double-parsed template argument
19883 !! wikitext
19884 {{lc:{{{1}}}|hello}}
19885 !! html
19886 <p>{{{1}}}
19887 </p>
19888 !! end
19889
19890 !! test
19891 Bug 5678: Double-parsed template invocation
19892 !! wikitext
19893 {{lc:{{paramtest {{!}} param = hello }} }}
19894 !! html
19895 <p>{{paramtest | param = hello }}
19896 </p>
19897 !! end
19898
19899 !! test
19900 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19901 !! options
19902 language=cs
19903 title=[[Main Page]]
19904 !! wikitext
19905 {{PRVNÍVELKÉ:ěščř}}
19906 {{prvnívelké:ěščř}}
19907 {{PRVNÍMALÉ:ěščř}}
19908 {{prvnímalé:ěščř}}
19909 {{MALÁ:ěščř}}
19910 {{malá:ěščř}}
19911 {{VELKÁ:ěščř}}
19912 {{velká:ěščř}}
19913 !! html
19914 <p>Ěščř
19915 Ěščř
19916 ěščř
19917 ěščř
19918 ěščř
19919 ěščř
19920 ĚŠČŘ
19921 ĚŠČŘ
19922 </p>
19923 !! end
19924
19925 !! test
19926 Morwen/13: Unclosed link followed by heading
19927 !! wikitext
19928 [[link
19929 ==heading==
19930 !! html
19931 <p>[[link
19932 </p>
19933 <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>
19934
19935 !! end
19936
19937 !! test
19938 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19939 !! wikitext
19940 {{foo|
19941 =heading=
19942 !! html
19943 <p>{{foo|
19944 </p>
19945 <h1><span class="mw-headline" id="heading">heading</span></h1>
19946
19947 !! end
19948
19949 !! test
19950 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19951 !! wikitext
19952 {{foo|
19953 ==heading==
19954 !! html
19955 <p>{{foo|
19956 </p>
19957 <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>
19958
19959 !! end
19960
19961 !! test
19962 Tildes in comments
19963 !! options
19964 pst
19965 !! wikitext
19966 <!-- ~~~~ -->
19967 !! html/php
19968 <!-- ~~~~ -->
19969 !! end
19970
19971 !! test
19972 Paragraphs inside divs (no extra line breaks)
19973 !! wikitext
19974 <div>Line one
19975
19976 Line two</div>
19977 !! html
19978 <div>Line one
19979 Line two</div>
19980
19981 !! end
19982
19983 !! test
19984 Paragraphs inside divs (extra line break on open)
19985 !! wikitext
19986 <div>
19987 Line one
19988
19989 Line two</div>
19990 !! html
19991 <div>
19992 <p>Line one
19993 </p>
19994 Line two</div>
19995
19996 !! end
19997
19998 !! test
19999 Paragraphs inside divs (extra line break on close)
20000 !! wikitext
20001 <div>Line one
20002
20003 Line two
20004 </div>
20005 !! html
20006 <div>Line one
20007 <p>Line two
20008 </p>
20009 </div>
20010
20011 !! end
20012
20013 !! test
20014 Paragraphs inside divs (extra line break on open and close)
20015 !! wikitext
20016 <div>
20017 Line one
20018
20019 Line two
20020 </div>
20021 !! html
20022 <div>
20023 <p>Line one
20024 </p><p>Line two
20025 </p>
20026 </div>
20027
20028 !! end
20029
20030 !! test
20031 Nesting tags, paragraphs on lines which begin with <div>
20032 !! wikitext
20033 <div></div><strong>A
20034 B</strong>
20035 !! html/php+tidy
20036 <p><strong>A</strong></p>
20037 <p><strong>B</strong></p>
20038 !! html/parsoid
20039 <div></div>
20040 <p><strong>A
20041 B</strong>
20042 </p>
20043 !! end
20044
20045 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20046 !! test
20047 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20048 !! wikitext
20049 <blockquote>Line one
20050
20051 Line two</blockquote>
20052 !! html
20053 <blockquote>Line one
20054 Line two</blockquote>
20055
20056 !! html+tidy
20057 <blockquote>
20058 <p>Line one Line two</p>
20059 </blockquote>
20060 !! end
20061
20062 !! test
20063 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20064 !! wikitext
20065 <blockquote>
20066 Line one
20067
20068 Line two</blockquote>
20069 !! html
20070 <blockquote>
20071 <p>Line one
20072 </p>
20073 Line two</blockquote>
20074
20075 !! html+tidy
20076 <blockquote>
20077 <p>Line one</p>
20078 Line two</blockquote>
20079 !! end
20080
20081 !! test
20082 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20083 !! wikitext
20084 <blockquote>Line one
20085
20086 Line two
20087 </blockquote>
20088 !! html
20089 <blockquote>Line one
20090 <p>Line two
20091 </p>
20092 </blockquote>
20093
20094 !! html+tidy
20095 <blockquote>
20096 <p>Line one</p>
20097 <p>Line two</p>
20098 </blockquote>
20099 !! end
20100
20101 !! test
20102 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20103 !! wikitext
20104 <blockquote>
20105 Line one
20106
20107 Line two
20108 </blockquote>
20109 !! html
20110 <blockquote>
20111 <p>Line one
20112 </p><p>Line two
20113 </p>
20114 </blockquote>
20115
20116 !! html+tidy
20117 <blockquote>
20118 <p>Line one</p>
20119 <p>Line two</p>
20120 </blockquote>
20121 !! end
20122
20123 !! test
20124 Paragraphs inside blockquotes/divs (no extra line breaks)
20125 !! wikitext
20126 <blockquote><div>Line one
20127
20128 Line two</div></blockquote>
20129 !! html
20130 <blockquote><div>Line one
20131 Line two</div></blockquote>
20132
20133 !! end
20134
20135 !! test
20136 Paragraphs inside blockquotes/divs (extra line break on open)
20137 !! wikitext
20138 <blockquote><div>
20139 Line one
20140
20141 Line two</div></blockquote>
20142 !! html
20143 <blockquote><div>
20144 <p>Line one
20145 </p>
20146 Line two</div></blockquote>
20147
20148 !! end
20149
20150 !! test
20151 Paragraphs inside blockquotes/divs (extra line break on close)
20152 !! wikitext
20153 <blockquote><div>Line one
20154
20155 Line two
20156 </div></blockquote>
20157 !! html
20158 <blockquote><div>Line one
20159 <p>Line two
20160 </p>
20161 </div></blockquote>
20162
20163 !! end
20164
20165 !! test
20166 Paragraphs inside blockquotes/divs (extra line break on open and close)
20167 !! wikitext
20168 <blockquote><div>
20169 Line one
20170
20171 Line two
20172 </div></blockquote>
20173 !! html
20174 <blockquote><div>
20175 <p>Line one
20176 </p><p>Line two
20177 </p>
20178 </div></blockquote>
20179
20180 !! end
20181
20182 !! test
20183 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20184 !! options
20185 wgLinkHolderBatchSize=0
20186 !! wikitext
20187 [[meatball:1]]
20188 [[meatball:2]]
20189 [[meatball:3]]
20190 !! html
20191 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20192 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20193 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20194 </p>
20195 !! end
20196
20197 !! test
20198 Free external link invading image caption
20199 !! wikitext
20200 [[Image:Foobar.jpg|thumb|http://x|hello]]
20201 !! html
20202 <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>
20203
20204 !! end
20205
20206 !! test
20207 Bug 15196: localised external link numbers
20208 !! options
20209 language=fa
20210 !! wikitext
20211 [http://en.wikipedia.org/]
20212 !! html/php
20213 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20214 </p>
20215 !! html/parsoid
20216 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20217 !! end
20218
20219 !! test
20220 Multibyte character in padleft
20221 !! wikitext
20222 {{padleft:-Hello|7|Æ}}
20223 !! html
20224 <p>Æ-Hello
20225 </p>
20226 !! end
20227
20228 !! test
20229 Multibyte character in padright
20230 !! wikitext
20231 {{padright:Hello-|7|Æ}}
20232 !! html
20233 <p>Hello-Æ
20234 </p>
20235 !! end
20236
20237 !!test
20238 formatdate parser function
20239 !! wikitext
20240 {{#formatdate:2009-03-24}}
20241 !! html
20242 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20243 </p>
20244 !! end
20245
20246 !!test
20247 formatdate parser function, with default format
20248 !! wikitext
20249 {{#formatdate:2009-03-24|mdy}}
20250 !! html
20251 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20252 </p>
20253 !! end
20254
20255 !! test
20256 Spacing of numbers in formatted dates
20257 !! wikitext
20258 {{#formatdate:January 15}}
20259 !! html
20260 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20261 </p>
20262 !! end
20263
20264 !! test
20265 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
20266 !! options
20267 language=nl title=[[MediaWiki:Common.css]]
20268 !! wikitext
20269 {{#formatdate:2009-03-24|dmy}}
20270 !! html
20271 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20272 </p>
20273 !! end
20274
20275 #
20276 #
20277 #
20278
20279 #
20280 # Edit comments
20281 #
20282
20283 !! test
20284 Edit comment with link
20285 !! options
20286 comment
20287 !! wikitext
20288 I like the [[Main Page]] a lot
20289 !! html/php
20290 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20291 !!end
20292
20293 !! test
20294 Edit comment with link and link text
20295 !! options
20296 comment
20297 !! wikitext
20298 I like the [[Main Page|best pages]] a lot
20299 !! html/php
20300 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20301 !!end
20302
20303 !! test
20304 Edit comment with link and link text with suffix
20305 !! options
20306 comment
20307 !! wikitext
20308 I like the [[Main Page|best page]]s a lot
20309 !! html/php
20310 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20311 !!end
20312
20313 !! test
20314 Edit comment with section link (non-local, eg in history list)
20315 !! options
20316 comment title=[[Main Page]]
20317 !! wikitext
20318 /* External links */ removed bogus entries
20319 !! html/php
20320 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20321 !!end
20322
20323 !! test
20324 Edit comment with section link and text before it (non-local, eg in history list)
20325 !! options
20326 comment title=[[Main Page]]
20327 !! wikitext
20328 pre-comment text /* External links */ removed bogus entries
20329 !! html/php
20330 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>
20331 !!end
20332
20333 !! test
20334 Edit comment with section link (local, eg in diff view)
20335 !! options
20336 comment local title=[[Main Page]]
20337 !! wikitext
20338 /* External links */ removed bogus entries
20339 !! html/php
20340 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20341 !!end
20342
20343 !! test
20344 Edit comment with subpage link (bug 14080)
20345 !! options
20346 comment
20347 subpage
20348 title=[[Subpage test]]
20349 !! wikitext
20350 Poked at a [[/subpage]] here...
20351 !! html/php
20352 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20353 !!end
20354
20355 !! test
20356 Edit comment with subpage link and link text (bug 14080)
20357 !! options
20358 comment
20359 subpage
20360 title=[[Subpage test]]
20361 !! wikitext
20362 Poked at a [[/subpage|neat little page]] here...
20363 !! html/php
20364 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20365 !!end
20366
20367 !! test
20368 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20369 !! options
20370 comment
20371 title=[[Subpage test]]
20372 !! wikitext
20373 Poked at a [[/subpage]] here...
20374 !! html/php
20375 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...
20376 !!end
20377
20378 !! test
20379 Edit comment with bare anchor link (local, as on diff)
20380 !! options
20381 comment
20382 local
20383 title=[[Main Page]]
20384 !! wikitext
20385 [[#section]]
20386 !! html/php
20387 <a href="#section">#section</a>
20388 !! end
20389
20390 !! test
20391 Edit comment with bare anchor link (non-local, as on history)
20392 !! options
20393 comment
20394 title=[[Main Page]]
20395 !! wikitext
20396 [[#section]]
20397 !! html/php
20398 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20399 !! end
20400
20401 !! test
20402 Anchor starting with underscore
20403 !! options
20404 title=[[Foo]]
20405 !! wikitext
20406 [[#_ref|One]]
20407 !! html/php
20408 <p><a href="#_ref">One</a>
20409 </p>
20410 !! html/parsoid
20411 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20412 !! end
20413
20414 !! test
20415 Id starting with underscore
20416 !! wikitext
20417 <div id="_ref"></div>
20418 !! html/*
20419 <div id="_ref"></div>
20420
20421 !! end
20422
20423 !! test
20424 Space normalisation on autocomment (bug 22784)
20425 !! options
20426 comment
20427 title=[[Main Page]]
20428 !! wikitext
20429 /* __hello__world__ */
20430 !! html/php
20431 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20432 !! end
20433
20434 !! test
20435 percent-encoding and + signs in comments (Bug 26410)
20436 !! options
20437 comment
20438 !! wikitext
20439 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20440 !! html/php
20441 <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>
20442 !! end
20443
20444 # Parsoid doesn't support this yet: see bug 73581
20445 # but it *should* omit the 'src' attribute if the image is bad.
20446 # PHP side of tests was disabled in
20447 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20448 # because of issues in the PHP parserTests infrastructure
20449 # (but the output below is indeed what the PHP side emits)
20450 !! test
20451 Bad images - basic functionality
20452 !! wikitext
20453 [[File:Bad.jpg]]
20454 !! DISABLED/html/php
20455 !! html/parsoid
20456 <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>
20457 !! end
20458
20459 !! test
20460 Bad images - bug 16039: text after bad image disappears
20461 !! wikitext
20462 Foo bar
20463 [[File:Bad.jpg]]
20464 Bar foo
20465 !! DISABLED/html/php
20466 <p>Foo bar
20467 </p><p>Bar foo
20468 </p>
20469 !! html/parsoid
20470 <p>Foo bar
20471 <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>
20472 Bar foo</p>
20473 !! end
20474
20475 !! test
20476 Verify that displaytitle works (bug #22501) no displaytitle
20477 !! options
20478 showtitle
20479 !! config
20480 wgAllowDisplayTitle=true
20481 wgRestrictDisplayTitle=false
20482 !! wikitext
20483 this is not the the title
20484 !! html/php
20485 Parser test
20486 <p>this is not the the title
20487 </p>
20488 !! end
20489
20490 !! test
20491 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20492 !! options
20493 showtitle
20494 title=[[Screen]]
20495 !! config
20496 wgAllowDisplayTitle=true
20497 wgRestrictDisplayTitle=false
20498 !! wikitext
20499 this is not the the title
20500 {{DISPLAYTITLE:whatever}}
20501 !! html/php
20502 whatever
20503 <p>this is not the the title
20504 </p>
20505 !! end
20506
20507 !! test
20508 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20509 !! options
20510 showtitle
20511 title=[[Screen]]
20512 !! config
20513 wgAllowDisplayTitle=true
20514 wgRestrictDisplayTitle=true
20515 !! wikitext
20516 this is not the the title
20517 {{DISPLAYTITLE:whatever}}
20518 !! html/php
20519 Screen
20520 <p>this is not the the title
20521 </p>
20522 !! end
20523
20524 !! test
20525 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20526 !! options
20527 showtitle
20528 title=[[Screen]]
20529 !! config
20530 wgAllowDisplayTitle=true
20531 wgRestrictDisplayTitle=true
20532 !! wikitext
20533 this is not the the title
20534 {{DISPLAYTITLE:screen}}
20535 !! html/php
20536 screen
20537 <p>this is not the the title
20538 </p>
20539 !! end
20540
20541 !! test
20542 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20543 !! options
20544 showtitle
20545 title=[[Screen]]
20546 !! config
20547 wgAllowDisplayTitle=false
20548 !! wikitext
20549 this is not the the title
20550 {{DISPLAYTITLE:screen}}
20551 !! html/php
20552 Screen
20553 <p>this is not the the title
20554 <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>
20555 </p>
20556 !! end
20557
20558 !! test
20559 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20560 !! options
20561 showtitle
20562 title=[[Screen]]
20563 !! config
20564 wgAllowDisplayTitle=false
20565 !! wikitext
20566 this is not the the title
20567 !! html/php
20568 Screen
20569 <p>this is not the the title
20570 </p>
20571 !! end
20572
20573 !! test
20574 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20575 !! options
20576 showtitle
20577 title=[[Screen]]
20578 !! config
20579 wgAllowDisplayTitle=true
20580 wgRestrictDisplayTitle=true
20581 !! wikitext
20582 this is not the the title
20583 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20584 !! html/php
20585 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20586 <p>this is not the the title
20587 </p>
20588 !! end
20589
20590 !! test
20591 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20592 !! options
20593 showtitle
20594 title=[[Screen]]
20595 !! config
20596 wgAllowDisplayTitle=true
20597 wgRestrictDisplayTitle=true
20598 !! wikitext
20599 this is not the the title
20600 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20601 !! html/php
20602 <span style="color: red;">s</span>creen
20603 <p>this is not the the title
20604 </p>
20605 !! end
20606
20607 !! test
20608 Page status indicators: Empty name is invalid
20609 !! options
20610 showindicators
20611 !! wikitext
20612 <indicator name=" "></indicator>
20613 <indicator></indicator>
20614 !! html
20615 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20616 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20617 </p>
20618 !! end
20619
20620 !! test
20621 Page status indicators: Weird syntaxes that are okay
20622 !! options
20623 showindicators
20624 !! wikitext
20625 <indicator name="empty" />
20626 <indicator name="name"></indicator>
20627 !! html
20628 empty=
20629 name=
20630 <p><br />
20631 </p>
20632 !! end
20633
20634 !! test
20635 Page status indicators: Torture test
20636 !! options
20637 showindicators
20638 !! wikitext
20639 <indicator name="01">hello world</indicator>
20640 <indicator name="02">[[Main Page]]</indicator>
20641 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20642 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20643 <indicator name="05">* foo
20644 * bar</indicator>
20645 <indicator name="06"><nowiki>foo</nowiki></indicator>
20646 <indicator name="07"> Preformatted</indicator>
20647 <indicator name="08"><div>Broken tag</indicator>
20648 <indicator name="09">{| class=wikitable
20649 | cell
20650 |}</indicator>
20651 <indicator name="10">Two
20652
20653 paragraphs</indicator>
20654 !! html
20655 01=hello world
20656 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20657 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" />
20658 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>
20659 05=<ul><li> foo</li>
20660 <li> bar</li></ul>
20661
20662 06=foo
20663 07=<pre>Preformatted
20664 </pre>
20665 08=<div>Broken tag</div>
20666
20667 09=<table class="wikitable">
20668 <tr>
20669 <td> cell
20670 </td></tr></table>
20671
20672 10=<p>Two
20673 </p><p>paragraphs
20674 </p>
20675 <p><br />
20676 </p><p><br />
20677 </p><p><br />
20678 </p><p><br />
20679 </p><p><br />
20680 </p>
20681 !! end
20682
20683 !! test
20684 preload: check <noinclude> and <includeonly>
20685 !! options
20686 preload
20687 !! wikitext
20688 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20689 !! html/php
20690 Hello kind world.
20691 !! end
20692
20693 !! test
20694 preload: check <onlyinclude>
20695 !! options
20696 preload
20697 !! wikitext
20698 Goodbye <onlyinclude>Hello world</onlyinclude>
20699 !! html/php
20700 Hello world
20701 !! end
20702
20703 !! test
20704 preload: can pass tags through if we want to
20705 !! options
20706 preload
20707 !! wikitext
20708 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20709 !! html/php
20710 <includeonly>Hello world</includeonly>
20711 !! end
20712
20713 !! test
20714 preload: check that it doesn't try to do tricks
20715 !! options
20716 preload
20717 !! wikitext
20718 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20719 !! html/php
20720 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20721 !! end
20722
20723 !! test
20724 Play a bit with r67090 and bug 3158
20725 !! wikitext
20726 <div style="width:50% !important">&nbsp;</div>
20727 <div style="width:50%&nbsp;!important">&nbsp;</div>
20728 <div style="width:50%&#160;!important">&nbsp;</div>
20729 <div style="border : solid;">&nbsp;</div>
20730 !! html/php
20731 <div style="width:50% !important">&#160;</div>
20732 <div style="width:50% !important">&#160;</div>
20733 <div style="width:50% !important">&#160;</div>
20734 <div style="border&#160;: solid;">&#160;</div>
20735
20736 !! html/parsoid
20737 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20738 <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>
20739 <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>
20740 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20741
20742 !! end
20743
20744 !! test
20745 HTML5 data attributes
20746 !! wikitext
20747 <span data-foo="bar">Baz</span>
20748 <p data-abc-def_hij="">Quuz</p>
20749 !! html/php
20750 <p><span data-foo="bar">Baz</span>
20751 </p>
20752 <p data-abc-def_hij="">Quuz</p>
20753
20754 !! html/parsoid
20755 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20756 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20757 !! end
20758
20759 !! test
20760 Strip reserved data attributes
20761 !! wikitext
20762 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20763 !! html/php
20764 <div data-ok="fred">d</div>
20765
20766 !! html/parsoid
20767 <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>
20768 !! end
20769
20770 !! test
20771 percent-encoding and + signs in internal links (Bug 26410)
20772 !! wikitext
20773 [[User:+%]] [[Page+title%]]
20774 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20775 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20776 [[%33%45]] [[%33%45+]]
20777 !! html/php
20778 <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>
20779 <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>
20780 <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>
20781 <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>
20782 </p>
20783 !! html/parsoid
20784 <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>
20785 <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>
20786 <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>
20787 <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>
20788 !! end
20789
20790 !! test
20791 Special characters in embedded file links (bug 27679)
20792 !! wikitext
20793 [[File:Contains & ampersand.jpg]]
20794 [[File:Does not exist.jpg|Title with & ampersand]]
20795 !! html/php
20796 <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>
20797 <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>
20798 </p>
20799 !! html/parsoid
20800 <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>
20801 <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>
20802 !! end
20803
20804 !! test
20805 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20806 !! wikitext
20807 Text&apos;s been normalized?
20808 !! html
20809 <p>Text&#39;s been normalized?
20810 </p>
20811 !! end
20812
20813 !! test
20814 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20815 !! wikitext
20816 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20817 !! html
20818 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20819 </p>
20820 !! end
20821
20822 !! test
20823 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20824 !! wikitext
20825 [http://www.example.org/ ideograms]
20826 !! html
20827 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20828 </p>
20829 !! end
20830
20831 !! test
20832 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20833 !! wikitext
20834 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20835 !! html
20836 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20837 </p>
20838 !! end
20839
20840 !! article
20841 Mediawiki:loop1
20842 !! text
20843 {{Identical|A}}
20844 !! endarticle
20845
20846 !! article
20847 Mediawiki:loop2
20848 !! text
20849 {{Identical|B}}
20850 !! endarticle
20851
20852 !! article
20853 Template:Identical
20854 !! text
20855 {{int:loop1}}
20856 {{int:loop2}}
20857 !! endarticle
20858
20859 !! test
20860 Bug 31098 Template which includes system messages which includes the template
20861 !! wikitext
20862 {{Identical}}
20863 !! html
20864 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20865 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20866 </p>
20867 !! end
20868
20869 !! test
20870 Bug31490 Turkish: ucfirst 'blah'
20871 !! options
20872 language=tr
20873 !! wikitext
20874 {{ucfirst:blah}}
20875 !! html
20876 <p>Blah
20877 </p>
20878 !! end
20879
20880 !! test
20881 Bug31490 Turkish: ucfirst 'ix'
20882 !! options
20883 language=tr
20884 !! wikitext
20885 {{ucfirst:ix}}
20886 !! html
20887 <p>İx
20888 </p>
20889 !! end
20890
20891 !! test
20892 Bug31490 Turkish: lcfirst 'BLAH'
20893 !! options
20894 language=tr
20895 !! wikitext
20896 {{lcfirst:BLAH}}
20897 !! html
20898 <p>bLAH
20899 </p>
20900 !! end
20901
20902 !! test
20903 Bug31490 Turkish: ucfırst (with a dotless i)
20904 !! options
20905 language=tr
20906 !! wikitext
20907 {{ucfırst:blah}}
20908 !! html
20909 <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>
20910 </p>
20911 !! end
20912
20913 !! test
20914 Bug31490 ucfırst (with a dotless i) with English language
20915 !! options
20916 language=en
20917 !! wikitext
20918 {{ucfırst:blah}}
20919 !! html
20920 <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>
20921 </p>
20922 !! end
20923
20924 !! test
20925 Bug 26375: TOC with italics
20926 !! options
20927 title=[[Main Page]]
20928 !! wikitext
20929 __TOC__
20930 == ''Lost'' episodes ==
20931 !! html
20932 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20933 <ul>
20934 <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>
20935 </ul>
20936 </div>
20937
20938 <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>
20939
20940 !! end
20941
20942 !! test
20943 Bug 26375: TOC with bold
20944 !! options
20945 title=[[Main Page]]
20946 !! wikitext
20947 __TOC__
20948 == '''should be bold''' then normal text ==
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="#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>
20953 </ul>
20954 </div>
20955
20956 <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>
20957
20958 !! end
20959
20960 !! test
20961 Bug 33845: Headings become cursive in TOC when they contain an image
20962 !! options
20963 title=[[Main Page]]
20964 !! wikitext
20965 __TOC__
20966 == Image [[Image:foobar.jpg]] ==
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="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20971 </ul>
20972 </div>
20973
20974 <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>
20975
20976 !! end
20977
20978 !! test
20979 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20980 !! options
20981 title=[[Main Page]]
20982 !! wikitext
20983 __TOC__
20984 == <blockquote>Quote</blockquote> ==
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="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20989 </ul>
20990 </div>
20991
20992 <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>
20993
20994 !! html+tidy
20995 <p></p>
20996 <div id="toc" class="toc">
20997 <div id="toctitle">
20998 <h2>Contents</h2>
20999 </div>
21000 <ul>
21001 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21002 </ul>
21003 </div>
21004 <p></p>
21005 <h2><span class="mw-headline" id="Quote"></span></h2>
21006 <blockquote>
21007 <p><span class="mw-headline" id="Quote">Quote</span></p>
21008 </blockquote>
21009 <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>
21010 !! end
21011
21012 !! test
21013 Unclosed tags in TOC
21014 !! options
21015 title=[[Main Page]]
21016 !! wikitext
21017 __TOC__
21018 == Proof: 2 < 3 ==
21019 <small>Hanc marginis exiguitas non caperet.</small>
21020 QED
21021 !! html
21022 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21023 <ul>
21024 <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>
21025 </ul>
21026 </div>
21027
21028 <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>
21029 <p><small>Hanc marginis exiguitas non caperet.</small>
21030 QED
21031 </p>
21032 !! end
21033
21034 !! test
21035 Multiple tags in TOC
21036 !! wikitext
21037 __TOC__
21038 == <i>Foo</i> <b>Bar</b> ==
21039
21040 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21041 !! html
21042 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21043 <ul>
21044 <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>
21045 <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>
21046 </ul>
21047 </div>
21048
21049 <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>
21050 <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>
21051
21052 !! html+tidy
21053 <p></p>
21054 <div id="toc" class="toc">
21055 <div id="toctitle">
21056 <h2>Contents</h2>
21057 </div>
21058 <ul>
21059 <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>
21060 <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>
21061 </ul>
21062 </div>
21063 <p></p>
21064 <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>
21065 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21066 <blockquote>
21067 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21068 </blockquote>
21069 <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>
21070 !! end
21071
21072 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21073 # html5 tag parsing.
21074 !! test
21075 Tags with parameters in TOC
21076 !! options
21077 parsoid=wt2html
21078 !! wikitext
21079 __TOC__
21080 == <sup class="in-h2">Hello</sup> ==
21081
21082 == <sup class="a > b">Evilbye</sup> ==
21083 !! html/php
21084 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21085 <ul>
21086 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21087 <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>
21088 </ul>
21089 </div>
21090
21091 <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>
21092 <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>
21093
21094 !! html/parsoid
21095 <meta property="mw:PageProp/toc" />
21096 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21097
21098 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21099 !! end
21100
21101 !! test
21102 span tags with directionality in TOC
21103 !! wikitext
21104 __TOC__
21105 == <span dir="ltr">C++</span> ==
21106
21107 == <span dir="rtl">זבנג!</span> ==
21108
21109 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21110
21111 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21112
21113 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21114 !! html
21115 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21116 <ul>
21117 <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>
21118 <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>
21119 <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>
21120 <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>
21121 <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>
21122 </ul>
21123 </div>
21124
21125 <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>
21126 <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>
21127 <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>
21128 <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>
21129 <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>
21130
21131 !! end
21132
21133 !! test
21134 Bug 72884: bdi element in ToC
21135 !! wikitext
21136 __TOC__
21137 == <bdi>test</bdi> ==
21138 !! html
21139 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21140 <ul>
21141 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21142 </ul>
21143 </div>
21144
21145 <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>
21146
21147 !! end
21148
21149 # Note that the html output does not have the <p></p>, but the
21150 # html+tidy output *does*. This is because the empty <p></p> is
21151 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21152 !! test
21153 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21154 !! wikitext
21155 __TOC__
21156 == x ==
21157 !! html
21158 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21159 <ul>
21160 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21161 </ul>
21162 </div>
21163
21164 <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>
21165
21166 !! html+tidy
21167 <p></p>
21168 <div id="toc" class="toc">
21169 <div id="toctitle">
21170 <h2>Contents</h2>
21171 </div>
21172 <ul>
21173 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21174 </ul>
21175 </div>
21176 <p></p>
21177 <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>
21178 !! end
21179
21180 !! article
21181 MediaWiki:Bug32057
21182 !! text
21183 == {{int:headline_sample}} ==
21184 !! endarticle
21185
21186 !! test
21187 Bug 32057: Title needed when expanding <h> nodes.
21188 !! options
21189 title=[[Main Page]]
21190 !! wikitext
21191 {{int:Bug32057}}
21192 !! html
21193 <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>
21194
21195 !! end
21196
21197 !! test
21198 Strip marker in urlencode
21199 !! wikitext
21200 {{urlencode:x<nowiki/>y}}
21201 {{urlencode:x<nowiki/>y|wiki}}
21202 {{urlencode:x<nowiki/>y|path}}
21203 {{urlencode:x<pre id="one">two</pre>y}}
21204 !! html
21205 <p>xy
21206 xy
21207 xy
21208 xy
21209 </p>
21210 !! end
21211
21212 !! test
21213 Strip marker in lc
21214 !! wikitext
21215 {{lc:x<nowiki/>y}}
21216 !! html
21217 <p>xy
21218 </p>
21219 !! end
21220
21221 !! test
21222 Strip marker in uc
21223 !! wikitext
21224 {{uc:x<nowiki/>y}}
21225 !! html
21226 <p>XY
21227 </p>
21228 !! end
21229
21230 !! test
21231 Strip marker in formatNum
21232 !! wikitext
21233 {{formatnum:1<nowiki/>2}}
21234 {{formatnum:1<nowiki/>2|R}}
21235 !! html
21236 <p>12
21237 12
21238 </p>
21239 !! end
21240
21241 !! test
21242 Check noCommafy in formatNum
21243 !! options
21244 language=be-tarask
21245 !! wikitext
21246 {{formatnum:123456.78}}
21247 {{formatnum:123456.78|NOSEP}}
21248 !! html
21249 <p>123 456,78
21250 123456.78
21251 </p>
21252 !! end
21253
21254 !! test
21255 Wrong option for formatNum (bug 56199)
21256 !! wikitext
21257 {{formatnum:1,234.56|Random}}
21258 {{formatnum:1,234.56|EVERYTHING}}
21259 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21260 !! html
21261 <p>1,234.56
21262 1,234.56
21263 1,234.56
21264 </p>
21265 !! end
21266
21267 !! test
21268 Strip marker in grammar
21269 !! options
21270 language=fi
21271 !! wikitext
21272 {{grammar:elative|foo<nowiki/>bar}}
21273 !! html
21274 <p>foobarista
21275 </p>
21276 !! end
21277
21278 !! test
21279 Strip marker in padleft
21280 !! wikitext
21281 {{padleft:|2|x<nowiki/>y}}
21282 !! html
21283 <p>xy
21284 </p>
21285 !! end
21286
21287 !! test
21288 Strip marker in padright
21289 !! wikitext
21290 {{padright:|2|x<nowiki/>y}}
21291 !! html
21292 <p>xy
21293 </p>
21294 !! end
21295
21296 !! test
21297 Strip marker in anchorencode
21298 !! wikitext
21299 {{anchorencode:x<nowiki/>y}}
21300 !! html
21301 <p>xy
21302 </p>
21303 !! end
21304
21305 !! test
21306 nowiki inside link inside heading (bug 18295)
21307 !! wikitext
21308 ==[[foo|x<nowiki>y</nowiki>z]]==
21309 !! html
21310 <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>
21311
21312 !! end
21313
21314 !! test
21315 new support for bdi element (bug 31817)
21316 !! wikitext
21317 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21318 !! html
21319 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21320
21321 !!end
21322
21323 !! test
21324 Ignore pipe between table row attributes
21325 !! wikitext
21326 {|
21327 | quux
21328 |- id=foo | style='color: red'
21329 | bar
21330 |}
21331 !! html
21332 <table>
21333 <tr>
21334 <td> quux
21335 </td></tr>
21336 <tr id="foo" style="color: red">
21337 <td> bar
21338 </td></tr></table>
21339
21340 !! end
21341
21342 !!test
21343 Gallery override link with WikiLink (bug 34852)
21344 !! wikitext
21345 <gallery>
21346 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21347 </gallery>
21348 !! html
21349 <ul class="gallery mw-gallery-traditional">
21350 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21351 <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>
21352 <div class="gallerytext">
21353 <p>caption
21354 </p>
21355 </div>
21356 </div></li>
21357 </ul>
21358
21359 !! end
21360
21361 !!test
21362 Gallery override link with absolute external link (bug 34852)
21363 !! wikitext
21364 <gallery>
21365 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21366 </gallery>
21367 !! html
21368 <ul class="gallery mw-gallery-traditional">
21369 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21370 <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>
21371 <div class="gallerytext">
21372 <p>caption
21373 </p>
21374 </div>
21375 </div></li>
21376 </ul>
21377
21378 !! end
21379
21380 !!test
21381 Gallery override link with malicious javascript (bug 34852)
21382 !! wikitext
21383 <gallery>
21384 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21385 </gallery>
21386 !! html
21387 <ul class="gallery mw-gallery-traditional">
21388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21389 <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>
21390 <div class="gallerytext">
21391 <p>caption
21392 </p>
21393 </div>
21394 </div></li>
21395 </ul>
21396
21397 !! end
21398
21399 !!test
21400 Gallery with invalid title as link (bug 43964)
21401 !! wikitext
21402 <gallery>
21403 File:foobar.jpg|link=<
21404 </gallery>
21405 !! html
21406 <ul class="gallery mw-gallery-traditional">
21407 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21408 <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>
21409 <div class="gallerytext">
21410 </div>
21411 </div></li>
21412 </ul>
21413
21414 !! end
21415
21416 !!test
21417 Language parser function
21418 !! wikitext
21419 {{#language:ar}}
21420 !! html
21421 <p>العربية
21422 </p>
21423 !! end
21424
21425 !!test
21426 Padleft and padright as substr
21427 !! wikitext
21428 {{padleft:|3|abcde}}
21429 {{padright:|3|abcde}}
21430 !! html
21431 <p>abc
21432 abc
21433 </p>
21434 !! end
21435
21436 !!test
21437 Special parser function
21438 !! wikitext
21439 {{#special:RandomPage}}
21440 {{#special:BaDtItLe}}
21441 {{#special:Foobar}}
21442 !! html
21443 <p>Special:Random
21444 Special:Badtitle
21445 Special:Foobar
21446 </p>
21447 !! end
21448
21449 !!test
21450 Bug 34939 - Case insensitive link parsing ([HttP://])
21451 !! wikitext
21452 [HttP://MediaWiki.Org/]
21453 !! html/php
21454 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21455 </p>
21456 !! html/parsoid
21457 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21458 !! end
21459
21460 !!test
21461 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21462 !! wikitext
21463 [HttP://MediaWiki.Org/ MediaWiki]
21464 !! html
21465 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21466 </p>
21467 !! end
21468
21469 !!test
21470 Bug 34939 - Case insensitive link parsing (HttP://)
21471 !! wikitext
21472 HttP://MediaWiki.Org/
21473 !! html/php
21474 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21475 </p>
21476 !! html/parsoid
21477 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21478 !! end
21479
21480 !!test
21481 Disable TOC
21482 !! options
21483 notoc
21484 !! wikitext
21485 Lead
21486 == Section 1 ==
21487 == Section 2 ==
21488 == Section 3 ==
21489 == Section 4 ==
21490 == Section 5 ==
21491 !! html
21492 <p>Lead
21493 </p>
21494
21495 <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>
21496 <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>
21497 <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>
21498 <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>
21499 <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>
21500
21501 !! end
21502
21503
21504 ###
21505 ### Parsoid-specific tests
21506 ### Parsoid-PHP parser incompatibilities
21507 ###
21508 !!test
21509 1. SOL-sensitive wikitext tokens as template-args
21510 !!options
21511 parsoid=wt2html,wt2wt
21512 !! wikitext
21513 {{echo|*a}}
21514 {{echo|#a}}
21515 {{echo|:a}}
21516 !! html
21517 <span about="#mwt1" typeof="mw:Transclusion">
21518 </span><ul about="#mwt1"><li>a</li>
21519 </ul>
21520 <span about="#mwt2" typeof="mw:Transclusion">
21521 </span><ol about="#mwt2"><li>a</li>
21522 </ol>
21523 <span about="#mwt3" typeof="mw:Transclusion">
21524 </span><dl about="#mwt3"><dd>a</dd>
21525 </dl>
21526 !!end
21527
21528 #### -----------------------------------------------------------------
21529 #### Parsoid-specific functionality tests
21530 #### -----------------------------------------------------------------
21531
21532 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21533 # We know wt2wt will fail, but we expect selser to pass.
21534 # Due to the nature of our testing, wt2wt and selser tests will enter the
21535 # blacklist and we'll catch selser regressions based on changes to the
21536 # blacklist entries for selser tests.
21537 !! test
21538 1. Bad treebuilder fixup of formatting elt is cleaned up
21539 !! options
21540 parsoid=wt2html,wt2wt
21541 !! wikitext
21542 {|
21543 |
21544 <small>
21545 [[Image:Foobar.jpg|right|Test]]
21546 </small>
21547 |}
21548 !! html/parsoid
21549 <table>
21550 <tbody><tr><td>
21551 <small>
21552 <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>
21553 </small>
21554 </td></tr>
21555 </tbody></table>
21556 !! end
21557
21558 !! test
21559 2. Bad treebuilder fixup of formatting elt is cleaned up
21560 !! options
21561 parsoid=wt2html,wt2wt
21562 !! wikitext
21563 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21564
21565 <small>[[Image:Foobar.jpg|right|300px]]</small>
21566 !! html/parsoid
21567
21568 <p><b>foo</b></p>
21569 <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>
21570 <p><b>bar</b></p>
21571 <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>
21572 !! end
21573
21574 !! test
21575 3. Bad treebuilder fixup of formatting elt is cleaned up
21576 !! options
21577 parsoid=wt2html,wt2wt
21578 !! wikitext
21579 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21580 !! html/parsoid
21581 <p><small><b>foo</b></small></p>
21582 <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>
21583 <p><small><b>bar</b></small></p>
21584 !! end
21585
21586 !! test
21587 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21588 !! options
21589 parsoid=wt2html,wt2wt
21590 !! wikitext
21591 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21592 !! html/parsoid
21593 <p><b><small></small></b></p>
21594 <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>
21595 <p></p>
21596 !! end
21597
21598 #### ----------------------------------------------------------------
21599 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21600 #### tags. Parsoid's output for these tags differs from that of the
21601 #### PHP parser.
21602 #### ----------------------------------------------------------------
21603
21604 !!test
21605 Ref: 1. ref-location should be replaced with an index span
21606 !! wikitext
21607 A <ref>foo</ref>
21608 B <ref name="x">foo</ref>
21609 C <ref name="y" />
21610 <references />
21611 !! html/parsoid
21612 <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>
21613 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>
21614 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>
21615 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21616 <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>
21617 <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>
21618 <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>
21619 </ol>
21620 !!end
21621
21622 !!test
21623 Ref: 2. ref-tags with identical names should all get the same index
21624 !! wikitext
21625 A <ref name="x">foo</ref>
21626 B <ref name="x" />
21627 <references />
21628 !! html/parsoid
21629 <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>
21630 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>
21631 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21632 <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>
21633 </ol>
21634 !!end
21635
21636 !!test
21637 Ref: 3. spaces in ref-names should be ignored
21638 !! wikitext
21639 A <ref name="x">foo</ref>
21640 B <ref name=" x " />
21641 C <ref name= x />
21642 <references />
21643 !! html/parsoid
21644 <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>
21645 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>
21646 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>
21647 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21648 <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>
21649 </ol>
21650 !!end
21651
21652 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21653 !!test
21654 Ref: 4. 'constructor' should be accepted as a valid ref-name
21655 !! wikitext
21656 A <ref name="constructor">foo</ref>
21657 <references />
21658 !! html/parsoid
21659 <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>
21660 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21661 <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>
21662 </ol>
21663 !!end
21664
21665 !!test
21666 Ref: 5. body should accept generic wikitext
21667 !! wikitext
21668 A <ref>
21669 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21670 </ref>
21671
21672 <references />
21673 !! html/parsoid
21674 <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>
21675
21676 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21677 <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>
21678 </span></li>
21679 </ol>
21680 !!end
21681
21682 !!test
21683 Ref: 6. indent-pres should not be output in ref-body
21684 !! wikitext
21685 A <ref>
21686 foo
21687 bar
21688 baz
21689 </ref>
21690
21691 <references />
21692 !! html/parsoid
21693 <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>
21694
21695 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21696 <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
21697 bar
21698 baz
21699 </span></li>
21700 </ol>
21701 !!end
21702
21703 !!test
21704 Ref: 7. No p-wrapping in ref-body
21705 !! wikitext
21706 A <ref>
21707 foo
21708
21709 bar
21710
21711
21712 baz
21713
21714
21715
21716 booz
21717 </ref>
21718
21719 <references />
21720 !! html/parsoid
21721 <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>
21722
21723 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21724 <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
21725
21726 bar
21727
21728
21729 baz
21730
21731
21732
21733 booz
21734 </span></li>
21735 </ol>
21736 !!end
21737
21738 !!test
21739 Ref: 8. transclusion wikitext has lower precedence
21740 !! wikitext
21741 A <ref> foo {{echo|</ref> B C}}
21742
21743 <references />
21744 !! html/parsoid
21745 <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>
21746 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21747 <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>
21748 </ol>
21749 !!end
21750
21751 !!test
21752 Ref: 9. unclosed comments should not leak out of ref-body
21753 !! wikitext
21754 A <ref> foo <!--</ref> B C
21755 <references />
21756 !! html/parsoid
21757 <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>
21758 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21759 <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>
21760 </ol>
21761 !!end
21762
21763 !!test
21764 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21765 !! wikitext
21766 A <ref> <b> foo </ref> B C
21767
21768 <references />
21769 !! html/parsoid
21770 <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>
21771
21772
21773 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21774 <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>
21775 </ol>
21776 !!end
21777
21778 !!test
21779 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21780 !! wikitext
21781 A <ref>foo</ref> B
21782 C <ref>bar</ref> D
21783 <references />
21784 !! html/parsoid
21785 <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
21786 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>
21787 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21788 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21789 <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>
21790 </ol>
21791 !!end
21792
21793 !!test
21794 Ref: 12. ref-tags act as trailing newline migration barrier
21795 !! wikitext
21796 <!--the newline at the end of this line moves out of the p tag-->a
21797
21798 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21799 <ref />
21800
21801 c
21802 <references />
21803 !! html/parsoid
21804 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21805
21806
21807 <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>
21808 <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>
21809
21810 <p>c</p>
21811 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21812 <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>
21813 <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>
21814 !!end
21815
21816 !!test
21817 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21818 !! wikitext
21819 <ref>foo</ref> A
21820 <ref>bar
21821 </ref> B
21822 <references />
21823 !! html/parsoid
21824 <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
21825 <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>
21826 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21827 <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>
21828 <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
21829 </span></li>
21830 </ol>
21831 !!end
21832
21833 !!test
21834 Ref: 14. A nested ref-tag should be emitted as plain text
21835 !! wikitext
21836 <ref>foo <ref>bar</ref> baz</ref>
21837
21838 <references />
21839 !! html/parsoid
21840 <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>
21841 </p>
21842 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21843 <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>
21844 </ol>
21845 !!end
21846
21847 !!test
21848 Ref: 15. ref-tags with identical names should get identical indexes
21849 !! wikitext
21850 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21851 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21852
21853 <references />
21854 !! html/parsoid
21855 <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>
21856 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>
21857
21858 <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>
21859 </ol>
21860 !!end
21861
21862 ## We don't bother wt2wt-ing non-standard whitespace
21863 !!test
21864 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21865 !!options
21866 parsoid=wt2html
21867 !! wikitext
21868 A <ref >foo</ref >
21869
21870 <references />
21871 !! html/parsoid
21872 <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>
21873 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21874 <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>
21875 !!end
21876
21877 !!test
21878 Ref: 17. Generate valid HTML5 id/about attributes
21879 !!wikitext
21880 <ref name="a b">foo</ref>
21881
21882 <references />
21883 !!html/parsoid
21884 <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>
21885 </p>
21886
21887 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21888 <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>
21889 </ol>
21890 !!end
21891
21892 !!test
21893 Ref: 18. T58916: Extension attributes should be parsed as plain text
21894 !!wikitext
21895 <ref name="{{echo|a}}">foo</ref>
21896
21897 <references />
21898 !!html/parsoid
21899 <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>
21900 </p>
21901
21902 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21903 <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>
21904 </ol>
21905 !!end
21906
21907 !!test
21908 Ref: 19. ref-tags with identical name encodings should get identical indexes
21909 !! wikitext
21910 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21911
21912 <references />
21913 !! html/parsoid
21914 <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>
21915 </p>
21916 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21917 <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>
21918 </ol>
21919 !!end
21920
21921 !!test
21922 Ref: 20. ref-tags with identical names but different content should keep it
21923 !! wikitext
21924 A <ref name="foo">Foo one</ref>
21925 B <ref name="foo">Foo two</ref>
21926 C <ref name="foo" />
21927
21928 <references />
21929 !! html/parsoid
21930 <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>
21931 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>
21932 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>
21933
21934 <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>
21935 </ol>
21936 !!end
21937
21938 !!test
21939 References: 1. references tag without any refs should be handled properly
21940 !! wikitext
21941 <references />
21942 !! html/parsoid
21943 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21944 !!end
21945
21946 !!test
21947 References: 2. references tag with group only outputs references from that group
21948 !! wikitext
21949 A <ref group="a">foo</ref>
21950 B <ref group="b">bar</ref>
21951 C <ref>baz</ref>
21952
21953 <references group="a" />
21954 <references />
21955 <references group="b" />
21956 !! html/parsoid
21957 <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>
21958 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>
21959 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>
21960
21961 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21962 <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>
21963 </ol>
21964 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21965 <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>
21966 </ol>
21967 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21968 <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>
21969 </ol>
21970 !!end
21971
21972 !!test
21973 References: 3. ref list should be cleared after processing references
21974 !! wikitext
21975 A <ref>foo</ref>
21976
21977 <references />
21978
21979 B <ref>bar</ref>
21980
21981 <references />
21982 !! html/parsoid
21983 <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>
21984
21985 <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>
21986 </ol>
21987
21988 <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>
21989
21990 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21991 <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>
21992 </ol>
21993 !!end
21994
21995 !!test
21996 References: 4. only referenced group should be cleared after processing references
21997 !! wikitext
21998 A <ref group="a">afoo</ref>
21999 B <ref>bfoo</ref>
22000
22001 <references group="a" />
22002
22003 C <ref>cfoo</ref>
22004
22005 <references />
22006 !! html/parsoid
22007 <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>
22008 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>
22009
22010 <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>
22011 </ol>
22012
22013 <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>
22014
22015 <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>
22016 </ol>
22017 !!end
22018
22019 !!test
22020 References: 5. ref tags in references should be processed while ignoring all other content
22021 !! wikitext
22022 A <ref name="a" />
22023 B <ref name="b">bar</ref>
22024
22025 <references>
22026 <ref name="a">foo</ref>
22027 This should just get lost.
22028 </references>
22029 !! html/parsoid
22030 <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>
22031 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>
22032
22033
22034 <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>
22035 </ol>
22036 !!end
22037
22038 !!test
22039 References: 6. <references /> from a transclusion
22040 !! wikitext
22041 <ref>Foo</ref> {{echo|<references />}}
22042 !! html/parsoid
22043 <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>
22044 </ol>
22045 !!end
22046
22047 !! test
22048 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22049 !! wikitext
22050 A <ref>foo bar for a</ref>
22051 B <ref group="X" name="b" />
22052
22053 <references />
22054
22055 <references group="X">
22056 <ref name="b">foo</ref>
22057 </references>
22058 !! html/parsoid
22059 <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>
22060 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>
22061 </p>
22062
22063 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22064 <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>
22065 </ol>
22066
22067 <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"}}'>
22068 <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>
22069 </ol>
22070 !! end
22071
22072 !! test
22073 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22074 !! wikitext
22075 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22076 <references />
22077 !! html/parsoid
22078 <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>
22079 <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>
22080 </ol>
22081 !!end
22082
22083 # This test only works in wt2html now as the <references /> are always generated
22084 # unless selser is active. Once T72722 is fixed, we should add a changes test
22085 # here to ensure that unrelated changes don't add the new <references /> in
22086 # wt2wt.
22087 !! test
22088 References: 9. Generate missing references list at the end
22089 !! wikitext
22090 A <ref>foo</ref>
22091 B <ref group="inexistent">bar</ref>
22092 !! html/parsoid
22093 <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>
22094 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22095 <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>
22096 </ol>
22097 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22098 <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>
22099 </ol>
22100 !! end
22101
22102 !! test
22103 References: 10. New <references/> shouldn't be added for unrelated edits.
22104 !! options
22105 parsoid={
22106 "modes": ["selser"],
22107 "changes": [["#x", "remove"]],
22108 "selser": "noauto"
22109 }
22110 !! wikitext
22111 Unrelated text<span id="x"> that's going to disappear</span>.
22112 A <ref>foo</ref>
22113 !! wikitext/edited
22114 Unrelated text.
22115 A <ref>foo</ref>
22116 !!end
22117
22118 !! test
22119 Entities in ref name
22120 !! wikitext
22121 <ref name="test &amp; me">hi</ref>
22122 <references />
22123 !! html/parsoid
22124 <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>
22125 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22126 <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>
22127 </ol>
22128 !! end
22129
22130 # This test is wt2html only because we're permitting the serializer to produce
22131 # dirty diffs, normalizing the unclosed references to the self-closed version.
22132 !! test
22133 Generate references for unclosed references tag
22134 !! options
22135 parsoid=wt2html
22136 !! wikitext
22137 a<ref>foo</ref>
22138
22139 <references>
22140 !! html/parsoid
22141 <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>
22142 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22143 <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>
22144 !! end
22145
22146 !! test
22147 New reference serializes on its own line
22148 !! options
22149 parsoid=wt2wt,html2wt
22150 !! wikitext
22151 foo
22152 <references />
22153 !! html/parsoid
22154 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22155 !! end
22156
22157 #### ----------------------------------------------------------------
22158 #### Parsoid-only testing of Parsoid's impl of LST
22159 #### Not implemented yet, see
22160 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22161 #### ----------------------------------------------------------------
22162
22163 !! test
22164 LST Sections: 1. Simple section start and end
22165 !! options
22166 parsoid={ "suppressErrors": true }
22167 !! wikitext
22168 <section begin="2011-05-16" />
22169 <section end="2014-04-10 (MW 1.23wmf22)" />
22170 !! html/parsoid
22171 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22172 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22173 !! end
22174
22175 #--------- Test stripping of empty nodes in template content ----------
22176 !!test
22177 Empty LI and TR nodes should be stripped from template content
22178 !!wikitext
22179 {{EmptyLITest}}
22180 {{EmptyTRTest}}
22181 !!html/parsoid
22182 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22183 <li>a</li>
22184 <li>b</li>
22185 </ul>
22186 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22187 <tbody>
22188 <tr>
22189 <td>foo</td>
22190 </tr>
22191 <tr>
22192 <td>bar</td>
22193 </tr>
22194 </tbody>
22195 </table>
22196 !!end
22197
22198 !!test
22199 Empty LI and TR nodes should not be stripped from top-level content
22200 !!wikitext
22201 * a
22202 *
22203 * b
22204 {|
22205 |-
22206 |-
22207 |foo
22208 |}
22209 !!html/parsoid
22210 <ul>
22211 <li> a</li>
22212 <li></li>
22213 <li> b</li>
22214 </ul>
22215 <table>
22216 <tbody>
22217 <tr></tr>
22218 <tr>
22219 <td>foo</td>
22220 </tr>
22221 </tbody>
22222 </table>
22223 !!end
22224
22225 !!test
22226 Empty TR nodes should not be stripped if they have any attributes set
22227 !!wikitext
22228 {{EmptyTRWithHTMLAttrTest}}
22229 !!html/parsoid
22230 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22231 <tr align="center"></tr>
22232 <tr><td>foo</td></tr>
22233 <tr align="center"></tr>
22234 <tr><td>bar</td></tr>
22235 </table>
22236 !!end
22237
22238 #### ----------------------------------------------------------------
22239 #### The following section of tests are primarily to test
22240 #### wikitext escaping capabilities of Parsoid. Given that
22241 #### escaping can be done any number of ways, the wikitext (input)
22242 #### is always adjusted to reflect how Parsoid adds nowiki
22243 #### escape tags.
22244 ####
22245 #### We are marking several tests as parsoid-only since the
22246 #### HTML in the result section is different from what the
22247 #### PHP parser generates for it.
22248 #### ----------------------------------------------------------------
22249
22250
22251 #### --------------- Headings ---------------
22252 #### 0. Unnested
22253 #### 1. Nested inside html <h1>=foo=</h1>
22254 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22255 #### 3. Nested inside html with wikitext split by html tags
22256 #### 4. No escape needed
22257 #### 5. Empty headings <h1></h1>
22258 #### 6. Heading chars in SOL context
22259 #### ----------------------------------------
22260 !! test
22261 Headings: 0. Unnested
22262 !! options
22263 parsoid=html2wt
22264 !! html/parsoid
22265 <p>=foo=</p>
22266
22267 <p> =foo=
22268 <!--cmt-->
22269 =foo=</p>
22270
22271 <p>=foo<i>a</i>=</p>
22272 !! wikitext
22273 <nowiki>=foo=</nowiki>
22274
22275 <nowiki> </nowiki>=foo=
22276 <!--cmt-->
22277 <nowiki>=foo=</nowiki>
22278
22279 =foo''a''<nowiki>=</nowiki>
22280 !!end
22281
22282 # New headings and existing headings are handled differently
22283 !! test
22284 Headings: 1. Nested inside html
22285 !! options
22286 parsoid=html2wt
22287 !! html/parsoid
22288 <h1>=foo=</h1>
22289 <h2>=foo=</h2>
22290 <h3>=foo=</h3>
22291
22292 <h1 data-parsoid=''>=foo=</h1>
22293 <h2 data-parsoid=''>=foo=</h2>
22294 <h3 data-parsoid=''>=foo=</h3>
22295 <h4 data-parsoid=''>=foo=</h4>
22296 <h5 data-parsoid=''>=foo=</h5>
22297 <h6 data-parsoid=''>=foo=</h6>
22298 !! wikitext
22299 = =foo= =
22300
22301 == =foo= ==
22302
22303 === =foo= ===
22304
22305 =<nowiki>=foo=</nowiki>=
22306 ==<nowiki>=foo=</nowiki>==
22307 ===<nowiki>=foo=</nowiki>===
22308 ====<nowiki>=foo=</nowiki>====
22309 =====<nowiki>=foo=</nowiki>=====
22310 ======<nowiki>=foo=</nowiki>======
22311
22312 !!end
22313
22314 !! test
22315 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22316 !! options
22317 parsoid=html2wt
22318 !! html/parsoid
22319 <h1>foo</h1>*bar
22320 <h1>foo</h1>=bar
22321 <h1>foo</h1>=bar=
22322 !! wikitext
22323 = foo =
22324 <nowiki>*</nowiki>bar
22325
22326 = foo =
22327 =bar
22328
22329 = foo =
22330 <nowiki>=bar=</nowiki>
22331 !!end
22332
22333 !! test
22334 Headings: 3. Nested inside html with wikitext split by html tags
22335 !! options
22336 parsoid=html2wt
22337 !! html/parsoid
22338 <h1>=<b>bold</b>foo=</h1>
22339 !! wikitext
22340 = ='''bold'''<nowiki>foo=</nowiki> =
22341 !!end
22342
22343 !! test
22344 Headings: 4a. No escaping needed (testing just h1 and h2)
22345 !! options
22346 parsoid=html2wt
22347 !! html/parsoid
22348 <h1>=foo</h1>
22349 <h1>foo=</h1>
22350 <h1> =foo= </h1>
22351 <h1>=foo= bar</h1>
22352 <h2>=foo</h2>
22353 <h2>foo=</h2>
22354 <h1>=</h1>
22355 <h1><i>=</i>foo=</h1>
22356 !! wikitext
22357 = =foo =
22358
22359 = foo= =
22360
22361 = =foo= =
22362
22363 = =foo= bar =
22364
22365 == =foo ==
22366
22367 == foo= ==
22368
22369 = = =
22370
22371 = ''=''foo= =
22372 !!end
22373
22374 !! test
22375 Headings: 4b. No escaping needed (inside p-tags)
22376 !! options
22377 parsoid=html2wt
22378 !! html/parsoid
22379 <p>===
22380 =foo= x
22381 =foo= <s></s>
22382 </p>
22383 !! wikitext
22384 ===
22385 =foo= x
22386 =foo= <s></s>
22387 !!end
22388
22389 !! test
22390 Headings: 5. Empty headings
22391 !! options
22392 parsoid=html2wt
22393 !! html/parsoid
22394 <h1 data-parsoid='{}'></h1>
22395
22396 <h2 data-parsoid='{}'></h2>
22397
22398 <h3 data-parsoid='{}'></h3>
22399
22400 <h4 data-parsoid='{}'></h4>
22401
22402 <h5 data-parsoid='{}'></h5>
22403
22404 <h6 data-parsoid='{}'></h6>
22405 !! wikitext
22406 =<nowiki/>=
22407
22408 ==<nowiki/>==
22409
22410 ===<nowiki/>===
22411
22412 ====<nowiki/>====
22413
22414 =====<nowiki/>=====
22415
22416 ======<nowiki/>======
22417 !!end
22418
22419 !! test
22420 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22421 !! options
22422 parsoid=html2wt
22423 !! html/parsoid
22424 <p>=a=</p>
22425
22426 <p>=a=</p>
22427
22428 <p>=a=</p>
22429 !! wikitext
22430 <nowiki>=a=</nowiki>
22431
22432 <nowiki>=a=</nowiki>
22433
22434 <nowiki>=a=</nowiki>
22435 !!end
22436
22437 !! test
22438 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22439 !! options
22440 parsoid=html2wt
22441 !! html/parsoid
22442 <p>=a=
22443 b</p>
22444
22445 <p>=a=
22446 b</p>
22447
22448 <p>=a=
22449 b</p>
22450 !! wikitext
22451 <nowiki>=a=</nowiki>
22452 b
22453
22454 <nowiki>=a=</nowiki>
22455 b
22456
22457 <nowiki>=a=</nowiki>
22458 b
22459 !!end
22460
22461 !! test
22462 Headings: 6c. Heading chars in SOL context (leading newline break)
22463 !! options
22464 parsoid=html2wt
22465 !! html/parsoid
22466 <p>a
22467 =b=</p>
22468 !! wikitext
22469 a
22470 <nowiki>=b=</nowiki>
22471 !!end
22472
22473 !! test
22474 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22475 !! options
22476 parsoid=html2wt
22477 !! html/parsoid
22478 <!--c0--><p>=a=</p>
22479
22480 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22481 !! wikitext
22482 <!--c0--><nowiki>=a=</nowiki>
22483
22484 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22485 !!end
22486
22487 !! test
22488 Headings: 6d. Heading chars in SOL context (No escaping needed)
22489 !! options
22490 parsoid=html2wt
22491 !! html/parsoid
22492 =a=<div>b</div>
22493 !! wikitext
22494 =a=<div>b</div>
22495 !!end
22496
22497 !! test
22498 Headings: 7. Insert a newline between new content and headings
22499 !! options
22500 parsoid=html2wt
22501 !! html/parsoid
22502 <h2>NEW</h2>
22503 <p>new</p>
22504 <h2 data-parsoid='{}'>A</h2>
22505 <p data-parsoid='{}'>a</p>
22506 !! wikitext
22507 == NEW ==
22508 new
22509
22510 ==A==
22511 a
22512
22513 !! end
22514
22515 #### --------------- Lists ---------------
22516 #### 0. Outside nests (*foo, etc.)
22517 #### 1. Nested inside html <ul><li>*foo</li></ul>
22518 #### 2. Inside definition lists
22519 #### 3. Only bullets at start should be escaped
22520 #### 4. No escapes needed
22521 #### 5. No unnecessary escapes
22522 #### 6. Escape bullets in SOL position
22523 #### 7. Escape bullets in a multi-line context
22524 #### ----------------------------------------
22525
22526 !! test
22527 Lists: 0. Outside nests
22528 !! options
22529 parsoid=html2wt
22530 !! html/parsoid
22531 <p>*foo</p>
22532
22533 <p>#foo</p>
22534
22535 <p>;Foo:bar</p>
22536 !! wikitext
22537 <nowiki>*</nowiki>foo
22538
22539 <nowiki>#</nowiki>foo
22540
22541 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22542 !!end
22543
22544 !! test
22545 Lists: 1. Nested inside html
22546 !! options
22547 parsoid=html2wt
22548 !! html/parsoid
22549 <ul><li>*foo</li></ul>
22550 <ul><li>#foo</li></ul>
22551 <ul><li>:foo</li></ul>
22552 <ul><li>;foo</li></ul>
22553 <ol><li>*foo</li></ol>
22554 <ol><li>#foo</li></ol>
22555 <ol><li>:foo</li></ol>
22556 <ol><li>;foo</li></ol>
22557
22558 !! wikitext
22559 *<nowiki>*foo</nowiki>
22560
22561 *<nowiki>#foo</nowiki>
22562
22563 *<nowiki>:foo</nowiki>
22564
22565 *<nowiki>;foo</nowiki>
22566
22567 #<nowiki>*foo</nowiki>
22568
22569 #<nowiki>#foo</nowiki>
22570
22571 #<nowiki>:foo</nowiki>
22572
22573 #<nowiki>;foo</nowiki>
22574 !!end
22575
22576 !! test
22577 Lists: 2. Inside definition lists
22578 !! options
22579 parsoid=html2wt
22580 !! html/parsoid
22581 <dl><dt>;foo</dt></dl>
22582 <dl><dt>:foo</dt></dl>
22583 <dl><dt>:foo</dt>
22584 <dd>bar</dd></dl>
22585 <dl><dd>:foo</dd></dl>
22586
22587 !! wikitext
22588 ;<nowiki>;foo</nowiki>
22589
22590 ;<nowiki>:foo</nowiki>
22591
22592 ;<nowiki>:foo</nowiki>
22593 :bar
22594
22595 :<nowiki>:foo</nowiki>
22596 !!end
22597
22598 !! test
22599 Lists: 3. Only bullets at start of text should be escaped
22600 !! options
22601 parsoid=html2wt
22602 !! html/parsoid
22603 <ul><li>*foo*bar</li></ul>
22604 <ul><li>*foo<i>it</i>*bar</li></ul>
22605
22606 !! wikitext
22607 *<nowiki>*foo*bar</nowiki>
22608
22609 *<nowiki>*foo</nowiki>''it''*bar
22610 !!end
22611
22612 !! test
22613 Lists: 4. No escapes needed
22614 !! options
22615 parsoid=html2wt
22616 !! html/parsoid
22617 <ul>
22618 <li>foo*bar
22619 </li>
22620 </ul>
22621 <ul>
22622 <li><i>foo</i>*bar
22623 </li>
22624 </ul>
22625 <ul>
22626 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22627 </li>
22628 </ul>
22629 <ul>
22630 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22631 </li>
22632 </ul>
22633 !! wikitext
22634 *foo*bar
22635
22636 *''foo''*bar
22637
22638 *[[Foo]]: bar
22639
22640 *[[Foo]]*bar
22641 !!end
22642
22643 !! test
22644 Lists: 5. No unnecessary escapes
22645 !! options
22646 parsoid=html2wt
22647 !! html/parsoid
22648 <ul><li> bar <span>[[foo]]</span></li></ul>
22649 <ul><li> =bar <span>[[foo]]</span></li></ul>
22650 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22651 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22652 <ul><li> =bar <span>foo]]</span>=</li></ul>
22653 <ul><li> <s></s>: a</li></ul>
22654 <ul><li> <i>* foo</i></li></ul>
22655
22656 !! wikitext
22657 * bar <span><nowiki>[[foo]]</nowiki></span>
22658
22659 * =bar <span><nowiki>[[foo]]</nowiki></span>
22660
22661 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22662
22663 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22664
22665 * =bar <span>foo]]</span>=
22666
22667 * <s></s>: a
22668
22669 * ''* foo''
22670 !!end
22671
22672 !! test
22673 Lists: 6. Escape bullets in SOL position
22674 !! options
22675 parsoid=html2wt
22676 !! html/parsoid
22677 <p><!--cmt-->*foo</p>
22678 !! wikitext
22679 <!--cmt--><nowiki>*</nowiki>foo
22680 !!end
22681
22682 !! test
22683 Lists: 7. Escape bullets in a multi-line context
22684 !! options
22685 parsoid=html2wt
22686 !! html/parsoid
22687 <p>a
22688 *b
22689 </p>
22690 !! wikitext
22691 a
22692 <nowiki>*</nowiki>b
22693 !!end
22694
22695 !! test
22696 Lists: 8. Escape colons only if not present in tags
22697 !! options
22698 parsoid=html2wt
22699 !! html/parsoid
22700 <dl><dt>a:b<i>c:d</i></dt></dl>
22701 !! wikitext
22702 ; <nowiki>a:b</nowiki>''c:d''
22703 !! end
22704
22705 #### --------------- HRs ---------------
22706 #### 1. Single line
22707 #### -----------------------------------
22708
22709 !! test
22710 HRs: 1. Single line
22711 !! options
22712 parsoid=html2wt
22713 !! html/parsoid
22714 <hr />----
22715 <hr />=foo=
22716 <hr />*foo
22717 !! wikitext
22718 ----<nowiki>----</nowiki>
22719 ----=foo=
22720 ----*foo
22721 !! end
22722
22723 #### --------------- Tables ---------------
22724 #### 1a. Simple example
22725 #### 1b. No escaping needed (!foo)
22726 #### 1c. No escaping needed (|foo)
22727 #### 1d. No escaping needed (|}foo)
22728 ####
22729 #### 2a. Nested in td (<td>foo|bar</td>)
22730 #### 2b. Nested in td (<td>foo||bar</td>)
22731 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22732 ####
22733 #### 3a. Nested in th (<th>foo!bar</th>)
22734 #### 3b. Nested in th (<th>foo!!bar</th>)
22735 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22736 ####
22737 #### 4a. Escape -
22738 #### 4b. Escape +
22739 #### 4c. No escaping needed
22740 #### --------------------------------------
22741
22742 !! test
22743 Tables: 1a. Simple example
22744 !! options
22745 parsoid=html2wt
22746 !! html/parsoid
22747 <p>{|
22748 |}
22749 </p>
22750 !! wikitext
22751 <nowiki>{|</nowiki>
22752 |}
22753 !! end
22754
22755 !! test
22756 Tables: 1b. No escaping needed
22757 !! options
22758 parsoid=html2wt
22759 !! html/parsoid
22760 <p>!foo
22761 </p>
22762 !! wikitext
22763 !foo
22764 !! end
22765
22766 !! test
22767 Tables: 1c. No escaping needed
22768 !! options
22769 parsoid=html2wt
22770 !! html/parsoid
22771 <p>|foo
22772 </p>
22773 !! wikitext
22774 |foo
22775 !! end
22776
22777 !! test
22778 Tables: 1d. No escaping needed
22779 !! options
22780 parsoid=html2wt
22781 !! html/parsoid
22782 <p>|}foo
22783 </p>
22784 !! wikitext
22785 |}foo
22786 !! end
22787
22788 !! test
22789 Tables: 2a. Nested in td
22790 !! options
22791 parsoid=html2wt
22792 !! html/parsoid
22793 <table><tbody><tr>
22794 <td>foo|bar</td></tr>
22795 <tr><td>x<div>a|b</div></td>
22796 </tbody></table>
22797 !! wikitext
22798 {|
22799 |<nowiki>foo|bar</nowiki>
22800 |-
22801 |x<div><nowiki>a|b</nowiki></div>
22802 |}
22803 !! html/php+tidy
22804 <table>
22805 <tr>
22806 <td>foo|bar</td>
22807 </tr>
22808 <tr>
22809 <td>x
22810 <div>a|b</div>
22811 </td>
22812 </tr>
22813 </table>
22814 !! end
22815
22816 !! test
22817 Tables: 2b. Nested in td
22818 !! options
22819 parsoid=html2wt
22820 !! html/parsoid
22821 <table><tbody><tr>
22822 <td>foo||bar</td>
22823 <td>a<i>b||c</i></td>
22824 <td>a<i><div>b||c</div></i></td>
22825 </tr></tbody></table>
22826 !! wikitext
22827 {|
22828 |<nowiki>foo||bar</nowiki>
22829 |a''<nowiki>b||c</nowiki>''
22830 |a''<div><nowiki>b||c</nowiki></div>''
22831 |}
22832 !! html/php
22833 <table>
22834 <tr>
22835 <td>foo||bar
22836 </td>
22837 <td>a<i>b||c</i>
22838 </td>
22839 <td>a<i><div>b||c</div></i>
22840 </td></tr></table>
22841
22842 !! end
22843
22844 !! test
22845 Tables: 2c. Nested in td -- no escaping needed
22846 !! options
22847 parsoid=html2wt
22848 !! html/*
22849 <table>
22850
22851 <tr>
22852 <td>foo!!bar
22853 </td></tr></table>
22854
22855 !! wikitext
22856 {|
22857
22858 |foo!!bar
22859 |}
22860 !! end
22861
22862 !! test
22863 Tables: 3a. Nested in th
22864 !! options
22865 parsoid=html2wt
22866 !! html/*
22867 <table>
22868
22869 <tr>
22870 <th>foo!bar
22871 </th></tr></table>
22872
22873 !! wikitext
22874 {|
22875
22876 !foo!bar
22877 |}
22878 !! end
22879
22880 !! test
22881 Tables: 3b. Nested in th
22882 !! options
22883 parsoid=html2wt
22884 !! html/parsoid
22885 <table><tbody>
22886 <tr><th>foo!!bar</th>
22887 <th><i>foo|bar</i></th>
22888 <th><i>foo!!bar</i></th>
22889 <th><i><span>foo!!bar</span></i></th>
22890 </tr></tbody></table>
22891 !! wikitext
22892 {|
22893 !<nowiki>foo!!bar</nowiki>
22894 !''<nowiki>foo|bar</nowiki>''
22895 !''<nowiki>foo!!bar</nowiki>''
22896 !''<span><nowiki>foo!!bar</nowiki></span>''
22897 |}
22898 !! html/php
22899 <table>
22900 <tr>
22901 <th>foo!!bar
22902 </th>
22903 <th><i>foo|bar</i>
22904 </th>
22905 <th><i>foo!!bar</i>
22906 </th>
22907 <th><i><span>foo!!bar</span></i>
22908 </th></tr></table>
22909
22910 !! end
22911
22912 !! test
22913 Tables: 3c. Nested in th
22914 !! options
22915 parsoid=html2wt
22916 !! html/parsoid
22917 <table><tbody>
22918 <tr><th>foo||bar</th>
22919 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22920 </tr></tbody></table>
22921 !! wikitext
22922 {|
22923 !<nowiki>foo||bar</nowiki>
22924 !<nowiki>foo||bar</nowiki>
22925 |}
22926 !! html/php
22927 <table>
22928 <tr>
22929 <th>foo||bar
22930 </th>
22931 <th>foo||bar
22932 </th></tr></table>
22933
22934 !! end
22935
22936 !! test
22937 Tables: 4a. Escape -
22938 !! options
22939 parsoid=html2wt
22940 !! html/*
22941 <table>
22942
22943 <tr>
22944 <th>-bar
22945 </th></tr>
22946 <tr>
22947 <td>-bar
22948 </td></tr></table>
22949
22950 !! wikitext
22951 {|
22952
22953 !-bar
22954
22955 |-
22956 |<nowiki>-bar</nowiki>
22957 |}
22958 !! end
22959
22960 !! test
22961 Tables: 4b. Escape +
22962 !! options
22963 parsoid=html2wt
22964 !! html/*
22965 <table>
22966
22967 <tr>
22968 <th>+bar
22969 </th></tr>
22970 <tr>
22971 <td>+bar
22972 </td></tr></table>
22973
22974 !! wikitext
22975 {|
22976
22977 !+bar
22978
22979 |-
22980 |<nowiki>+bar</nowiki>
22981 |}
22982 !! end
22983
22984 !! test
22985 Tables: 4c. No escaping needed
22986 !! options
22987 parsoid=html2wt
22988 !! html/parsoid
22989 <table><tbody>
22990 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22991 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22992 <tr><td>foo
22993 <p>bar|baz
22994 +bar
22995 -bar</p></td></tr>
22996 <tr><td>x
22997 <div>a|b</div></td>
22998 </tbody></table>
22999 !! wikitext
23000 {|
23001 |foo-bar
23002 |foo+bar
23003 |-
23004 |''foo''-bar
23005 |''foo''+bar
23006 |-
23007 |foo
23008 bar|baz
23009 +bar
23010 -bar
23011 |-
23012 |x
23013 <div>a|b</div>
23014 |}
23015 !! html/php
23016 <table>
23017 <tr>
23018 <td>foo-bar
23019 </td>
23020 <td>foo+bar
23021 </td></tr>
23022 <tr>
23023 <td><i>foo</i>-bar
23024 </td>
23025 <td><i>foo</i>+bar
23026 </td></tr>
23027 <tr>
23028 <td>foo
23029 <p>bar|baz
23030 +bar
23031 -bar
23032 </p>
23033 </td></tr>
23034 <tr>
23035 <td>x
23036 <div>a|b</div>
23037 </td></tr></table>
23038
23039 !! end
23040
23041 !! test
23042 Tables: 4d. No escaping needed
23043 !! options
23044 parsoid=html2wt
23045 !! html/parsoid
23046 <table>
23047 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23048 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23049 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23050 </tbody></table>
23051 !! wikitext
23052 {|
23053 |[[Foo]]-bar
23054 ||+1
23055 ||-2
23056 |}
23057 !! html/php
23058 <table>
23059 <tr>
23060 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23061 </td>
23062 <td>+1
23063 </td>
23064 <td>-2
23065 </td></tr></table>
23066
23067 !! end
23068
23069 !! test
23070 T97430: Don't emit empty nowiki pairs around marker meta tags
23071 !! options
23072 parsoid=html2wt
23073 !! html/parsoid
23074 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23075 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23076 !! wikitext
23077 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23078 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23079 !! end
23080
23081 !! test
23082 Unclosed xmlish element in table line shouldn't eat end delimiters
23083 !! options
23084 parsoid=html2wt
23085 !! html/parsoid
23086 <table>
23087 <tbody><tr><td> &lt;foo</td>
23088 <td> bar></td></tr>
23089 </tbody></table>
23090 !! wikitext
23091 {|
23092 | <foo
23093 | bar>
23094 |}
23095 !! html/php
23096 <table>
23097 <tr>
23098 <td> &lt;foo
23099 </td>
23100 <td> bar&gt;
23101 </td></tr></table>
23102
23103 !! end
23104
23105 #### --------------- Links ----------------
23106 #### 1. Quote marks in link text
23107 #### 2. Wikilinks: Escapes needed
23108 #### 3. Wikilinks: No escapes needed
23109 #### 4. Extlinks: Escapes needed
23110 #### 5. Extlinks: No escapes needed
23111 #### --------------------------------------
23112 !! test
23113 Links 1. WikiLinks: No escapes needed
23114 !! options
23115 parsoid=html2wt
23116 !! html/parsoid
23117 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23118 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23119 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23120 !! wikitext
23121 [[Foo|Foo''boo'']]
23122 [[Foo|[Foobar]]]
23123 [[Foo|x [Foobar] x]]
23124 !! html/php
23125 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23126 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23127 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23128 </p>
23129 !! end
23130
23131 !! test
23132 Links 2. WikiLinks: Escapes needed
23133 !! options
23134 parsoid=html2wt
23135 !! html/parsoid
23136 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23137 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23138 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23139 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23140 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23141 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23142 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23143 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23144 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23145 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23146 !! wikitext
23147 [[Foo|<nowiki>Foobar]</nowiki>]]
23148 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23149 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23150 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23151 [[Foo|<nowiki>|Bar</nowiki>]]
23152 [[Foo|<nowiki>]]bar</nowiki>]]
23153 [[Foo|<nowiki>[[bar</nowiki>]]
23154 [[Foo|<nowiki>x [[ y</nowiki>]]
23155 [[Foo|<nowiki>x ]] y</nowiki>]]
23156 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23157 !! html/php
23158 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23159 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23160 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23161 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23162 <a href="/wiki/Foo" title="Foo">|Bar</a>
23163 <a href="/wiki/Foo" title="Foo">]]bar</a>
23164 <a href="/wiki/Foo" title="Foo">[[bar</a>
23165 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23166 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23167 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23168 </p>
23169 !! end
23170
23171 !! test
23172 Links 3. WikiLinks: No escapes needed
23173 !! options
23174 parsoid=html2wt
23175 !! html/parsoid
23176 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23177 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23178 !! wikitext
23179 [[Foo|[Foobar]]
23180 [[Foo|foo|bar]]
23181 !! html/php
23182 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23183 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23184 </p>
23185 !! end
23186
23187 !! test
23188 Links 4. ExtLinks: Escapes needed
23189 !! options
23190 parsoid=html2wt
23191 !! html/parsoid
23192 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23193 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23194 <p>[http://google.com]</p>
23195 <p>[http://google.com google]</p>
23196 !! wikitext
23197 [http://google.com <nowiki>[google]</nowiki>]
23198 [http://google.com <nowiki>google]</nowiki>]
23199
23200 <nowiki>[http://google.com]</nowiki>
23201
23202 <nowiki>[http://google.com google]</nowiki>
23203
23204 !! html/php
23205 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23206 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23207 </p><p>[http://google.com]
23208 </p><p>[http://google.com google]
23209 </p>
23210 !! end
23211
23212 !! test
23213 Links 5. ExtLinks: No escapes needed
23214 !! options
23215 parsoid=html2wt
23216 !! html/parsoid
23217 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23218 !! wikitext
23219 [http://google.com [google]
23220 !! html/php
23221 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23222 </p>
23223 !! end
23224
23225 !! test
23226 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23227 !! options
23228 parsoid=html2wt
23229 !! html/parsoid
23230 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23231 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23232 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23233 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23234 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23235 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23236 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23237 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23238 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23239 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23240 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23241 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23242 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23243 </p>
23244 !! wikitext
23245 x<nowiki/>http://example.com<nowiki/>y
23246 http://example.com<nowiki/>?x
23247 http://example.com<nowiki/>&x
23248 http://example.com<nowiki/>'x
23249 http://example.com<nowiki/>,x
23250 http://example.com<nowiki/>.x
23251 http://example.com<nowiki/>;x
23252 http://example.com<nowiki/>:x
23253 http://example.com<nowiki/>;x
23254 http://example.com<nowiki/>!x
23255 http://example.com<nowiki/>=x
23256 http://example.com<nowiki/>(x)
23257 http://example.com(x<nowiki/>)
23258 !! end
23259
23260 !! test
23261 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23262 !! options
23263 parsoid=html2wt
23264 !! html/parsoid
23265 <p>x
23266 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23267 y
23268 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23269 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23270 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23271 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23272 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23273 </p>
23274 !! wikitext
23275 x
23276 http://example.com
23277 y
23278 "http://example.com"
23279 (http://example.com)
23280 (http://example.com) foo
23281 http://example.com,
23282 http://example.com, foo
23283 !! html/php
23284 <p>x
23285 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23286 y
23287 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23288 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23289 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23290 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23291 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23292 </p>
23293 !! end
23294
23295 !! test
23296 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23297 !! options
23298 parsoid=html2wt
23299 !! html/parsoid
23300 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23301 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23302 !! wikitext
23303 http://example.com.,;:!?\
23304 -http://example.com:
23305 !! html/php
23306 <p><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>:
23308 </p>
23309 !! end
23310
23311 !! test
23312 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23313 !! options
23314 parsoid=html2wt
23315 !! html/parsoid
23316 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23317 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23318 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23319 !! wikitext
23320 RFC 123<nowiki/>4
23321 RFC 123<nowiki/>y
23322 X<nowiki/>RFC 123<nowiki/>y
23323 !! end
23324
23325 !! test
23326 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23327 !! options
23328 parsoid=html2wt
23329 !! html/parsoid
23330 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23331 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23332 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23333 </p>
23334 !! wikitext
23335 RFC 123?foo
23336 RFC 123&foo
23337 -RFC 123-
23338 !! html/php
23339 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23340 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23341 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23342 </p>
23343 !! end
23344
23345 !! test
23346 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23347 !! options
23348 parsoid=html2wt
23349 !! html/parsoid
23350 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23351 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23352 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23353 !! wikitext
23354 PMID 123<nowiki/>4
23355 PMID 123<nowiki/>y
23356 X<nowiki/>PMID 123<nowiki/>y
23357 !! end
23358
23359 !! test
23360 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23361 !! options
23362 parsoid=html2wt
23363 !! html/parsoid
23364 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23365 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23366 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23367 </p>
23368 !! wikitext
23369 PMID 123?foo
23370 PMID 123&foo
23371 -PMID 123-
23372 !! html/php
23373 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23374 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23375 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23376 </p>
23377 !! end
23378
23379 !! test
23380 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23381 !! options
23382 parsoid=html2wt
23383 !! html/parsoid
23384 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23385 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23386 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23387 </p>
23388 !! wikitext
23389 ISBN 1234567890<nowiki/>1
23390 ISBN 1234567890<nowiki/>x
23391 a<nowiki/>ISBN 1234567890<nowiki/>b
23392 !! end
23393
23394 !! test
23395 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23396 !! options
23397 parsoid=html2wt
23398 !! html/parsoid
23399 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23400 !! wikitext
23401 -ISBN 1234567890's
23402 !! html/php
23403 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23404 </p>
23405 !! end
23406
23407 !! test
23408 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23409 !! options
23410 parsoid=html2wt
23411 !! html/*
23412 <p>this is not a link: http://example.com
23413 </p>
23414 !! wikitext
23415 this is not a link: <nowiki>http://example.com</nowiki>
23416 !! end
23417
23418 !! test
23419 Links 15. Link trails can't become link prefixes.
23420 !! options
23421 language=is
23422 parsoid=html2wt
23423 !! html/parsoid
23424 <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>
23425 !! wikitext
23426 [[Söfnuður]]-[[00]]
23427 !! html/php
23428 <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>
23429 </p>
23430 !! end
23431
23432 #### --------------- Quotes ---------------
23433 #### 1. Quotes inside <b> and <i>
23434 #### 2. Link fragments separated by <i> and <b> tags
23435 #### 3. Link fragments inside <i> and <b>
23436 #### 4. No escaping needed
23437 #### --------------------------------------
23438 !! test
23439 1a. Quotes inside <b> and <i>
23440 !! options
23441 parsoid=html2wt
23442 !! html/*
23443 <p><i>'foo'</i>
23444 <i>''foo''</i>
23445 <i>'''foo'''</i>
23446 <i>foo</i>'s
23447 <b>'foo'</b>
23448 <b>''foo''</b>
23449 <b>'''foo'''</b>
23450 <b>foo'<i>bar'</i>baz</b>
23451 <b>foo</b>'s
23452 '<i>foo</i>
23453 <i>foo</i>'
23454 <i>foo'</i>'
23455 '<i>foo</i>'
23456 '<b>foo</b>
23457 <b>foo</b>'
23458 '<b>foo</b>'
23459 <i>fools'<span> errand</span></i>
23460 <i><span>fool</span>'s errand</i>
23461 '<i>foo</i> bar '<i>baz</i>
23462 a|!*#-:;+-~[]{}b'<i>x</i>
23463 </p>
23464 !! wikitext
23465 ''<nowiki/>'foo'''
23466 ''<nowiki>''foo''</nowiki>''
23467 ''<nowiki>'''foo'''</nowiki>''
23468 ''foo''<nowiki/>'s
23469 '''<nowiki/>'foo''''
23470 '''<nowiki>''foo''</nowiki>'''
23471 '''<nowiki>'''foo'''</nowiki>'''
23472 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23473 '''foo'''<nowiki/>'s
23474 '''foo''
23475 ''foo''<nowiki/>'
23476 ''foo'''<nowiki/>'
23477 '''foo''<nowiki/>'
23478 ''''foo'''
23479 '''foo'''<nowiki/>'
23480 ''''foo'''<nowiki/>'
23481 ''fools'<span> errand</span>''
23482 ''<span>fool</span>'s errand''
23483 '<nowiki/>''foo'' bar '''baz''
23484 a|!*#-:;+-~[]{}b'''x''
23485 !! end
23486
23487 !! test
23488 1b. Quotes inside <b> and <i> with other tags on same line
23489 !! options
23490 parsoid=html2wt
23491 !! html/parsoid
23492 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23493 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23494 <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>
23495 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23496 '<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>
23497 '<i>foo</i> <div title="name">test</div>
23498 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23499 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23500 <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>
23501 </ol>
23502 !! wikitext
23503 '''a'' foo ''[[bar]]''
23504 ''a''' foo ''[[bar]]''
23505 ''a''' foo '''{{echo|[[bar]]}}'''
23506 [[foo]] x'''[[bar]]''
23507 '''foo'' <ref>test</ref>
23508 '''foo'' <div title="name">test</div>
23509 '''foo'' and <br> bar
23510 <references />
23511 !! end
23512
23513 !! test
23514 2. Link fragments separated by <i> and <b> tags
23515 !! options
23516 parsoid=html2wt
23517 !! html/parsoid
23518 <p>[[<i>foo</i>hello]]</p>
23519 <p>[[<b>foo</b>hello]]</p>
23520 !! wikitext
23521 [[''foo''<nowiki>hello]]</nowiki>
23522
23523 [['''foo'''<nowiki>hello]]</nowiki>
23524 !! end
23525
23526 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23527 # this is one of the shortcomings of this format
23528 !! test
23529 3. Link fragments inside <i> and <b>
23530 !! options
23531 parsoid=html2wt
23532 !! html/parsoid
23533 <p><i>[[foo</i>]]</p>
23534 <p><b>[[foo</b>]]</p>
23535 !! wikitext
23536 ''[[foo''<nowiki>]]</nowiki>
23537
23538 '''[[foo'''<nowiki>]]</nowiki>
23539 !! end
23540
23541 !! test
23542 4. No escaping needed
23543 !! options
23544 options=html2wt
23545 !! html/parsoid
23546 <p>'<span><i>bar</i></span>'
23547 '<span><b>bar</b></span>'
23548 'a:b'foo
23549 </p>
23550 !! wikitext
23551 '<span>''bar''</span>'
23552 '<span>'''bar'''</span>'
23553 'a:b'foo
23554 !! end
23555
23556 #### ----------- Paragraphs ---------------
23557 #### 1. No unnecessary escapes
23558 #### --------------------------------------
23559
23560 !! test
23561 1. No unnecessary escapes
23562 !! options
23563 parsoid=html2wt
23564 !! html/parsoid
23565 <p>bar <span>[[foo]]</span>
23566 </p><p>=bar <span>[[foo]]</span>
23567 </p><p>[[bar <span>[[foo]]</span>
23568 </p><p>]]bar <span>[[foo]]</span>
23569 </p><p>=bar <span>foo]]</span>=
23570 </p>
23571 !! wikitext
23572 bar <span><nowiki>[[foo]]</nowiki></span>
23573
23574 =bar <span><nowiki>[[foo]]</nowiki></span>
23575
23576 [[bar <span><nowiki>[[foo]]</nowiki></span>
23577
23578 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23579
23580 =bar <span>foo]]</span><nowiki>=</nowiki>
23581 !!end
23582
23583 #### ----------------------- PRE --------------------------
23584 #### 1. Leading whitespace in SOL context should be escaped
23585 #### ------------------------------------------------------
23586 !! test
23587 1. Leading whitespace in SOL context should be escaped
23588 !! options
23589 parsoid=html2wt
23590 !! html/parsoid
23591 <p> a</p>
23592
23593 <p> a</p>
23594
23595 <p> a(tab)</p>
23596
23597 <p> a
23598 <!--cmt-->
23599 a</p>
23600
23601 <p>a
23602 b</p>
23603
23604 <p>a
23605 b</p>
23606
23607 <p>a
23608 b</p>
23609 !! wikitext
23610 <nowiki> </nowiki>a
23611
23612 <nowiki> </nowiki> a
23613
23614 a(tab)
23615
23616 <nowiki> </nowiki> a
23617 <!--cmt-->
23618 <nowiki> </nowiki>a
23619
23620 a
23621 <nowiki> </nowiki>b
23622
23623 a
23624 b
23625
23626 a
23627 b
23628 !! html/php
23629 <p> a
23630 </p><p> a
23631 </p><p> a(tab)
23632 </p><p> a
23633 a
23634 </p><p>a
23635 b
23636 </p><p>a
23637 b
23638 </p><p>a
23639 b
23640 </p>
23641 !! end
23642
23643 !! test
23644 2. Leading whitespace in non-indent-pre contexts should not be escaped
23645 !! options
23646 parsoid=htm2wt
23647 !! html/parsoid
23648 <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>
23649 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23650 <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>
23651 b</span></li>
23652 </ol>
23653 !! wikitext
23654 foo <ref>''a''
23655 b</ref>
23656 <references />
23657 !! end
23658
23659 !! test
23660 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23661 !! options
23662 parsoid=html2wt
23663 !! html/parsoid
23664 <blockquote>
23665 <p>
23666 a
23667 <span>b</span>
23668 c</p>
23669 </blockquote>
23670 !! wikitext
23671 <blockquote>
23672 a
23673 <span>b</span>
23674 c
23675 </blockquote>
23676 !! end
23677
23678 !! test
23679 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23680 !! options
23681 options=html2wt
23682 !! html/parsoid
23683 <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>
23684 !! wikitext
23685 [[File:Foobar.jpg|thumb|caption]]
23686 !! end
23687
23688 !! test
23689 5. Nowiki escaping should account for indent-pres
23690 !! options
23691 parsoid=html2wt
23692 !! html/parsoid
23693 <pre>==foo==</pre>
23694 !! wikitext
23695 ==foo==
23696 !! end
23697
23698 !!test
23699 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23700 !! options
23701 parsoid=html2wt
23702 !! html/parsoid
23703 <pre>
23704 * foo
23705 * bar
23706 </pre>
23707 !! wikitext
23708 * foo
23709 * bar
23710 !! end
23711
23712 #### --------------- Behavior Switches --------------------
23713
23714 !! test
23715 1. Valid behavior switches should be escaped
23716 !! options
23717 parsoid=html2wt
23718 !! html/parsoid
23719 __TOC__
23720 <i>__TOC__</i>
23721 !! wikitext
23722 <nowiki>__TOC__</nowiki>
23723 ''<nowiki>__TOC__</nowiki>''
23724 !! end
23725
23726 !! test
23727 2. Invalid behavior switches should not be escaped
23728 !! options
23729 parsoid=html2wt
23730 !! html/parsoid
23731 __TOO__
23732 __|__
23733 !! wikitext
23734 __TOO__
23735 __|__
23736 !! end
23737
23738 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23739 !! test
23740 Behavior switches should be SOL-transparent
23741 !! options
23742 parsoid=html2wt
23743 !! html/parsoid
23744 <meta property="mw:PageProp/toc" />
23745
23746 <!-- this one's bogus -->
23747 <pre>__TOO__</pre>
23748
23749 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23750
23751 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23752 !! wikitext
23753 __TOC__
23754
23755 <!-- this one's bogus -->
23756 __TOO__
23757
23758 __TOC__ foo
23759
23760 __TOC__
23761 bar
23762 !! end
23763
23764 #### --------------- HTML tags ---------------
23765 #### 1. a tags
23766 #### 2. other tags
23767 #### 3. multi-line html tag
23768 #### 4. extension tags
23769 #### -----------------------------------------
23770 !! test
23771 1. a tags
23772 !! options
23773 parsoid=html2wt
23774 !! html/parsoid
23775 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23776 !! wikitext
23777 <a href="http://google.com">google</a>
23778 !! end
23779
23780 !! test
23781 2. other tags
23782 !! options
23783 parsoid=html2wt
23784 !! html/parsoid
23785 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23786 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23787 <li> &lt;td&gt;</li></ul>
23788
23789 !! wikitext
23790 * <nowiki><div>foo</div></nowiki>
23791 * <nowiki><div style="color:red">foo</div></nowiki>
23792 * <nowiki><td></nowiki>
23793 !! end
23794
23795 !! test
23796 3. multi-line html tag
23797 !! options
23798 parsoid=html2wt
23799 !! html/parsoid
23800 <p>&lt;div
23801 &gt;foo&lt;/div
23802 &gt;
23803 </p>
23804 !! wikitext
23805 <nowiki><div
23806 >foo</div
23807 ></nowiki>
23808 !! end
23809
23810 !! test
23811 4. extension tags
23812 !! options
23813 parsoid=html2wt
23814 !! html/parsoid
23815 <p>&lt;ref&gt;foo&lt;/ref&gt;
23816 </p><p>&lt;ref&gt;bar
23817 </p><p>baz&lt;/ref&gt;
23818 </p>
23819 !! wikitext
23820 <nowiki><ref>foo</ref></nowiki>
23821
23822 <nowiki><ref>bar</nowiki>
23823
23824 baz<nowiki></ref></nowiki>
23825 !! end
23826
23827 #### --------------- Others ---------------
23828 !! test
23829 Escaping nowikis
23830 !! options
23831 parsoid=html2wt
23832 !! html/parsoid
23833 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23834 </p>
23835 !! wikitext
23836 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23837 !! end
23838
23839 ## The quote-char in the input is necessary for triggering the bug
23840 !! test
23841 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23842 !! options
23843 parsoid=html2wt
23844 !! html/parsoid
23845 <p>foo's bar :</p>
23846 !! wikitext
23847 foo's bar :
23848 !! end
23849
23850 #----------- End of wikitext escaping tests --------------
23851
23852 !! test
23853
23854 Tag-like HTML structures are passed through as text
23855 !! wikitext
23856 <x y>
23857
23858 <x.y>
23859
23860 <x-y>
23861
23862 1>2
23863
23864 x<y
23865
23866 a>b
23867
23868 1<d e>f
23869 !! html
23870 <p>&lt;x y&gt;
23871 </p><p>&lt;x.y&gt;
23872 </p><p>&lt;x-y&gt;
23873 </p><p>1&gt;2
23874 </p><p>x&lt;y
23875 </p><p>a&gt;b
23876 </p><p>1&lt;d e&gt;f
23877 </p>
23878 !! end
23879
23880 !! test
23881 HTML tag with necessary entities in attributes
23882 !! wikitext
23883 <span title="&amp;amp;">foo</span>
23884 !! html
23885 <p><span title="&amp;amp;">foo</span>
23886 </p>
23887 !! end
23888
23889 !! test
23890 HTML tag with 'unnecessary' entity encoding in attributes
23891 !! wikitext
23892 <span title="&amp;">foo</span>
23893 !! html
23894 <p><span title="&amp;">foo</span>
23895 </p>
23896 !! end
23897
23898 !! test
23899 HTML tag with broken attribute value quoting
23900 !! wikitext
23901 <span title="Hello world>Foo</span>
23902 !! html/php
23903 <p><span title="Hello world">Foo</span>
23904 </p>
23905 !! html/parsoid
23906 <p><span title="Hello world">Foo</span>
23907 </p>
23908 !! end
23909
23910 !! test
23911 Self-closed tag with broken attribute value quoting
23912 !! options
23913 parsoid=wt2html,html2html
23914 !! wikitext
23915 <div title="Hello world />Foo
23916 !! html/php+tidy
23917 <div title="Hello world"></div>
23918 <p>Foo</p>
23919 !! html/parsoid
23920 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
23921 !! end
23922
23923 !! test
23924 Table with broken attribute value quoting
23925 !! wikitext
23926 {|
23927 | title="Hello world|Foo
23928 |}
23929 !! html/php
23930 <table>
23931 <tr>
23932 <td title="Hello world">Foo
23933 </td></tr></table>
23934
23935 !! html/parsoid
23936 <table>
23937 <tr>
23938 <td title="Hello world">Foo
23939 </td></tr></table>
23940
23941 !! end
23942
23943 !! test
23944 Table with broken attribute value quoting on consecutive lines
23945 !! wikitext
23946 {|
23947 | title="Hello world|Foo
23948 | style="color:red|Bar
23949 |}
23950 !! html/php
23951 <table>
23952 <tr>
23953 <td title="Hello world">Foo
23954 </td>
23955 <td style="color:red">Bar
23956 </td></tr></table>
23957
23958 !! html/parsoid
23959 <table><tbody>
23960 <tr>
23961 <td title="Hello world">Foo
23962 </td><td style="color: red">Bar
23963 </td></tr></tbody></table>
23964
23965 !! end
23966
23967 !! test
23968 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23969 !! options
23970 parsoid
23971 !! wikitext
23972 {{}}
23973 !! html
23974 {{}}
23975 !! end
23976
23977 !! test
23978 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23979 !! options
23980 parsoid
23981 !! wikitext
23982 }}{{
23983 !! html
23984 }}{{
23985 !! end
23986
23987 !!test
23988 Accept empty td cell attribute
23989 !! wikitext
23990 {|
23991 | align="center" | foo || |
23992 |}
23993 !! html
23994 <table>
23995 <tr>
23996 <td align="center"> foo </td>
23997 <td>
23998 </td></tr></table>
23999
24000 !!end
24001
24002 !!test
24003 Non-empty attributes in th-cells
24004 !! wikitext
24005 {|
24006 ! Foo !! style="color: red" | Bar
24007 |}
24008 !! html
24009 <table>
24010 <tr>
24011 <th> Foo </th>
24012 <th style="color: red"> Bar
24013 </th></tr></table>
24014
24015 !!end
24016
24017 !!test
24018 Accept empty attributes in th-cells
24019 !! wikitext
24020 {|
24021 !| foo !!| bar
24022 |}
24023 !! html
24024 <table>
24025 <tr>
24026 <th> foo </th>
24027 <th> bar
24028 </th></tr></table>
24029
24030 !!end
24031
24032 !!test
24033 Empty table rows go away
24034 !! wikitext
24035 {|
24036 | Hello
24037 | there
24038 |- class="foo"
24039 |-
24040 |}
24041 !! html
24042 <table>
24043 <tr>
24044 <td> Hello
24045 </td>
24046 <td> there
24047 </td></tr>
24048
24049 </table>
24050
24051 !! end
24052
24053 ###
24054 ### Parsoid-centric tests for testing RTing of inter-element separators
24055 ### Edge cases not tested by existing parser tests and specific to
24056 ### Parsoid-specific serialization strategies.
24057 ###
24058
24059 !!test
24060 RT-ed inter-element separators should be valid separators
24061 !! wikitext
24062 {|
24063 |- [[foo]]
24064 |}
24065 !! html/php
24066 <table>
24067
24068 </table>
24069
24070 !! html/parsoid
24071 <table>
24072 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24073 </tbody></table>
24074 !!end
24075
24076 # Parsoid-only since PHP parser relies on Tidy for correct output
24077 !!test
24078 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24079 !!options
24080 parsoid
24081 !! wikitext
24082 {|
24083 |<small>foo
24084 bar
24085 |}
24086
24087 {|
24088 |<small>foo<small>
24089 |}
24090 !! html
24091 <table>
24092 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24093 <p>bar</p></small></td></tr>
24094 </tbody></table>
24095
24096 <table>
24097 <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>
24098 </tbody></table>
24099 !!end
24100
24101 # Note that the "style" attribute is really a template parameter here.
24102 # The = would have to be {{=}} if you wanted the literal.
24103 !!test
24104 Empty TD followed by TD with tpl-generated attribute
24105 !! wikitext
24106 {|
24107 |-
24108 |
24109 |{{echo|style='color:red'}}|foo
24110 |}
24111 !! html
24112 <table>
24113
24114 <tr>
24115 <td>
24116 </td>
24117 <td>foo
24118 </td></tr></table>
24119
24120 !!end
24121
24122 !!test
24123 Indented table with an empty td
24124 !! wikitext
24125 {|
24126 |-
24127 |
24128 |foo
24129 |}
24130 !! html
24131 <table>
24132
24133 <tr>
24134 <td>
24135 </td>
24136 <td>foo
24137 </td></tr></table>
24138
24139 !!end
24140
24141 ## We have some newline diffs RT-ing this edge case
24142 ## and it is not important enough -- we seem to be emitting
24143 ## at most 2 newlines after a </tr> and this is unrelated to
24144 ## the issue from T85627 that this is testing.
24145 !!test
24146 Indented table with blank lines in between (T85627)
24147 !! options
24148 parsoid=wt2html
24149 !! wikitext
24150 {|
24151 |foo
24152
24153
24154 |}
24155 !! html
24156 <table>
24157
24158 <tr>
24159 <td>foo
24160 </td></tr></table>
24161
24162 !!end
24163
24164 !!test
24165 Indented block & table
24166 !! wikitext
24167 <div>foo</div>
24168 {|
24169 |foo
24170 |}
24171 !! html/php
24172 <div>foo</div>
24173 <table>
24174 <tr>
24175 <td>foo
24176 </td></tr></table>
24177
24178 !! html/parsoid
24179 <div data-parsoid='{"stx":"html"}'>foo</div>
24180 <table><tbody>
24181 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24182 </tbody></table>
24183 !!end
24184
24185 !! test
24186 Indent and comment before table row
24187 !! wikitext
24188 {|
24189 <!--hi-->|-
24190 | there
24191 |}
24192 !! html/php
24193 <table>
24194
24195 <tr>
24196 <td> there
24197 </td></tr></table>
24198
24199 !! html/parsoid
24200 <table>
24201 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24202 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24203 </tbody></table>
24204 !! end
24205
24206 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24207 !!test
24208 Empty TR followed by a template-generated TR
24209 !!options
24210 parsoid
24211 !! wikitext
24212 {|
24213 |-
24214 {{echo|<tr><td>foo</td></tr>}}
24215 |}
24216 !! html
24217 <table>
24218 <tbody>
24219 <tr></tr>
24220 <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}}]}'>
24221 <td>foo</td></tr>
24222 </tbody></table>
24223 !!end
24224
24225 ## PHP and parsoid output differ for this, and since this is primarily
24226 ## for testing Parsoid's serializer, marking this Parsoid only
24227 !!test
24228 Empty TR followed by mixed-ws-comment line should RT correctly
24229 !!options
24230 parsoid
24231 !! wikitext
24232 {|
24233 |-
24234 <!--c-->
24235 |-
24236 <!--c--> <!--d-->
24237 |}
24238 !! html
24239 <table>
24240 <tbody>
24241 <tr></tr>
24242 <!--c-->
24243 <tr>
24244 <!--c--> </tr><!--d-->
24245 </tbody></table>
24246
24247 !!end
24248
24249 !!test
24250 Multi-line image caption generated by templates with/without trailing newlines
24251 !! wikitext
24252 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24253 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24254 !! html/parsoid
24255 <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>
24256 <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>
24257 !!end
24258
24259 !! test
24260 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24261 !! options
24262 parsoid=html2wt
24263 !! html/parsoid
24264 <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>
24265
24266 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24267 !! wikitext
24268 <includeonly>foo</includeonly>
24269 new para
24270
24271 [[Category:Foo]]
24272
24273 = new heading =
24274 !! end
24275
24276 ## PHP emits broken html for this, and since this is primarily
24277 ## a Parsoid serializer test, marking this Parsoid only
24278 !!test
24279 Improperly nested inline or quotes tags with whitespace in between
24280 !! wikitext
24281 <span> <s>x</span> </s>
24282 ''' ''x''' ''
24283 !! html/parsoid
24284 <p><span> <s>x</s></span><s> </s>
24285 <b> <i>x</i></b><i> </i>
24286 </p>
24287 !!end
24288
24289 !!test
24290 Encapsulate protected attributes from wt
24291 !! wikitext
24292 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24293 !! html/parsoid
24294 <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>
24295 </body>
24296 !!end
24297
24298 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24299 ## Having nested or stray pre tags results in the attempt to add duplicates,
24300 ## causing an assertion fail. This test tries to prevent that situation.
24301 !!test
24302 Ensure ParagraphWrapper can deal with stray closing pre tags
24303 !!options
24304 parsoid=wt2html
24305 !! wikitext
24306 plain text</pre>
24307 !! html/parsoid
24308 plain text
24309 !!end
24310
24311 !!test
24312 1. Ensure fostered text content is wrapped in element nodes
24313 !!options
24314 parsoid=wt2html
24315 !! wikitext
24316 <table>hi</table><table>ho</table>
24317 !! html/parsoid
24318 <p>hi</p>
24319 <table></table>
24320 <p>ho</p>
24321 <table></table>
24322 !!end
24323
24324 !!test
24325 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24326 !!options
24327 parsoid=wt2html,wt2wt
24328 !! wikitext
24329 <table>
24330 <tr> || ||
24331 <td> a
24332 </table>
24333 !! html/parsoid
24334 <p> || ||
24335 </p><table>
24336 <tbody><tr><td> a</td></tr>
24337 </tbody></table>
24338 !!end
24339
24340 !!test
24341 Encapsulation properly handles null DSR information from foster box
24342 !!options
24343 parsoid=wt2html,wt2wt
24344 !! wikitext
24345 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24346 !! html/parsoid
24347 <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>
24348 !!end
24349
24350 !!test
24351 1. Encapsulate foster-parented transclusion content
24352 !!options
24353 parsoid=wt2wt,wt2html
24354 !! wikitext
24355 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24356 !! html/parsoid
24357 <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>
24358 <tbody>
24359 <tr>
24360 <td>bar</td>
24361 </tr>
24362 </tbody>
24363 </table>
24364 !!end
24365
24366 !!test
24367 2. Encapsulate foster-parented transclusion content
24368 !!options
24369 parsoid=wt2wt,wt2html
24370 !! wikitext
24371 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24372 !! html/parsoid
24373 <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>
24374 <table>
24375 <tbody>
24376 <tr>
24377 <td>bar</td>
24378 </tr>
24379 </tbody>
24380 </table>
24381 !!end
24382
24383 !!test
24384 3. Encapsulate foster-parented transclusion content
24385 !!options
24386 parsoid=wt2wt,wt2html
24387 !! wikitext
24388 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24389 !! html/parsoid
24390 <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;]}">
24391 <p>foo</p>
24392 </div>
24393 <table>
24394 <tbody>
24395 <tr>
24396 <td>bar</td>
24397 </tr>
24398 </tbody>
24399 </table>
24400 !!end
24401
24402 !!test
24403 4. Encapsulate foster-parented transclusion content
24404 !!options
24405 parsoid=wt2wt,wt2html
24406 !! wikitext
24407 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24408 !! html/parsoid
24409 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
24410 <p>foo</p>
24411 </div>
24412 <table>
24413 <tbody>
24414 <tr>
24415 <td>bar</td>
24416 </tr>
24417 </tbody>
24418 </table>
24419 !!end
24420
24421 !!test
24422 5. Encapsulate foster-parented transclusion content
24423 !!options
24424 parsoid=wt2wt,wt2html
24425 !! wikitext
24426 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24427 !! html/parsoid
24428 <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>
24429 <table>
24430 <tbody>
24431 <tr>
24432 <td>
24433 <div>
24434 <p>foo</p>
24435 </div>
24436 </td>
24437 </tr>
24438 </tbody>
24439 </table>
24440 !!end
24441
24442 !!test
24443 6. Encapsulate foster-parented transclusion content
24444 !!options
24445 parsoid=wt2wt,wt2html
24446 !! wikitext
24447 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24448 !! html/parsoid
24449 <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>
24450 <table>
24451 <tbody>
24452 <tr>
24453 <td>
24454 <div>
24455 <p>foo</p>
24456 </div>
24457 </td>
24458 </tr>
24459 </tbody>
24460 </table>
24461 <p>ok</p>
24462 !!end
24463
24464 !!test
24465 7. Encapsulate foster-parented transclusion content
24466 !!options
24467 parsoid=wt2wt,wt2html
24468 !! wikitext
24469 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24470 !! html/parsoid
24471 <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>
24472 <table>
24473 <tbody>
24474 <tr>
24475 <td>bar</td>
24476 </tr>
24477 </tbody>
24478 </table>
24479 !!end
24480
24481 # Note that the wt is broken on purpose: the = should be {{=}} if you
24482 # don't want it to be a template parameter key.
24483 !!test
24484 8. Encapsulate foster-parented transclusion content
24485 !!options
24486 parsoid=wt2wt,wt2html
24487 !! wikitext
24488 {{echo|a
24489 }}{|{{echo|style='color:red'}}
24490 |-
24491 |b
24492 |}
24493 !! html/parsoid
24494 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24495 <span> </span>
24496 <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>
24497 <table>
24498 <tbody>
24499 <tr>
24500 <td>b</td>
24501 </tr>
24502 </tbody>
24503 </table>
24504 !!end
24505
24506 !!test
24507 9. Encapsulate foster-parented transclusion content
24508 !!options
24509 parsoid=wt2wt,wt2html
24510 !! wikitext
24511 <table>{{echo|hi</table>hello}}
24512 !! html/parsoid
24513 <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>
24514 !!end
24515
24516 !!test
24517 Table in fosterable position
24518 !!options
24519 parsoid=wt2html,wt2wt
24520 !! wikitext
24521 {{OpenTable}}
24522 <div>
24523 {|
24524 |}
24525 </div>
24526 |}
24527 !! html/parsoid
24528 <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">
24529 </span>
24530 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24531
24532 <table>
24533 </table>
24534 !!end
24535
24536 # Parsoid only for bug 64747
24537 !! test
24538 Properly encapsulate empty-content transclusions in fosterable positions
24539 !! wikitext
24540 <table>
24541 {{#if:|
24542 <td>foo</td>
24543 }}
24544 </table>
24545 !! html/parsoid
24546 <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":["","","",""]}]]}'>
24547
24548 </table>
24549 !! end
24550
24551 !! test
24552 Always encapsulate foster box when template range is expanded to table
24553 !! options
24554 parsoid=wt2wt
24555 !! wikitext
24556 {|
24557 hello
24558 {{OpenTable}}
24559 |}
24560 !! html/parsoid
24561
24562 !! end
24563
24564 !!test
24565 Support <object> element with .data attribute
24566 !!options
24567 parsoid=html2wt
24568 !! html/parsoid
24569 <object data="test.swf"></object>
24570 !! wikitext
24571 <object data="test.swf"></object>
24572 !!end
24573
24574 !! test
24575 Don't block XML namespace declaration
24576 !! wikitext
24577 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24578 !! html/php
24579 <p><span>MediaWiki</span>
24580 </p>
24581 !! html/parsoid
24582 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24583 !! end
24584
24585 # -----------------------------------------------------------------
24586 # The following section of tests are primarily to spec requirements
24587 # around serialization of new/edited content.
24588 #
24589 # All these tests are marked Parsoid html2wt and html2html only
24590 # ----------------------------------------------------------------
24591
24592 # 'mi' is a localinterwiki prefix as well as a language
24593 !! test
24594 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24595 !! options
24596 parsoid=html2wt
24597 !! html/parsoid
24598 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24599 !! wikitext
24600 [[Foo]]
24601 !! end
24602
24603 # See T93839
24604 !! test
24605 New wikilinks should be serialized properly
24606 !! options
24607 parsoid=html2wt
24608 !! html/parsoid
24609 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24610 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24611 !! wikitext
24612 [[Foo]]
24613 [[Foo]]
24614 !! end
24615
24616 !! test
24617 New wiki links (href variations)
24618 !! options
24619 parsoid=html2wt
24620 !! html/parsoid
24621 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24622 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24623 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24624 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24625 !! wikitext
24626 [[Foo_bar]]
24627 [[Foo_bar]]
24628 [[Foo_bar]]
24629 [[Toxine bactérienne]]
24630 !! end
24631
24632 !! test
24633 New wiki links (content string variations)
24634 !! options
24635 parsoid=html2wt
24636 !! html/parsoid
24637 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24638 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24639 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24640 !! wikitext
24641 [[Foo_bar]]
24642 [[Foo bar]]
24643 [[Foo_bar|./Foo_bar]]
24644 !! end
24645
24646 !! test
24647 New category links (href variations)
24648 !! options
24649 parsoid=html2wt
24650 !! html/parsoid
24651 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24652 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24653 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24654 !! wikitext
24655 [[Category:Toxine bactérienne]]
24656 [[Category:Toxine bactérienne]]
24657 [[Category:Toxine bactérienne]]
24658 !! end
24659
24660 !! test
24661 New sol transparent links don't need indent-pre nowiki protection
24662 !! options
24663 parsoid=html2wt
24664 language=de
24665 !! html/parsoid
24666 <link rel="mw:PageProp/redirect" href="./Main_Page">
24667 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24668 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24669 !! wikitext
24670 #WEITERLEITUNG [[Main Page]]
24671 <!-- this is good --> [[Category:Good]]
24672 <!-- this is great --> [[Kategorie:Great]]
24673 !! end
24674
24675 !! test
24676 New interlanguage links (href variations)
24677 !! options
24678 parsoid=html2wt
24679 !! html/parsoid
24680 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24681 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24682 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24683 !! wikitext
24684 [[es:Toxine bactérienne]]
24685 [[es:Toxine_bactérienne]]
24686 [[es:Toxine_bactérienne]]
24687 !! end
24688
24689 !! test
24690 Image: Modifying size of an image (1)
24691 !! options
24692 parsoid={
24693 "modes": ["wt2wt"],
24694 "changes": [
24695 ["img[height]", "attr", "height", "22"],
24696 ["img[width]", "attr", "width", "200"]
24697 ]
24698 }
24699 !! wikitext
24700 [[Image:Foobar.jpg|230x230px]]
24701 !! wikitext/edited
24702 [[Image:Foobar.jpg|200x200px]]
24703 !!end
24704
24705 !! test
24706 Image: Modifying size of an image (2)
24707 !! options
24708 parsoid={
24709 "modes": ["wt2wt"],
24710 "changes": [
24711 ["img[height]", "attr", "height", "100"],
24712 ["img[width]", "attr", "width", "500"]
24713 ]
24714 }
24715 !! wikitext
24716 [[Image:Foobar.jpg|230x230px]]
24717 !! wikitext/edited
24718 [[Image:Foobar.jpg|500x500px]]
24719 !!end
24720
24721 # Change in size is ignored so long as class='mw-default-size'
24722 !! test
24723 Image: Modifying size of an image (3)
24724 !! options
24725 parsoid={
24726 "modes": ["wt2wt"],
24727 "changes": [
24728 ["figure[class]", "removeClass", "mw-default-size"],
24729 ["figure img", "attr", "height", "19"],
24730 ["figure img", "attr", "width", "170"]
24731 ]
24732 }
24733 !! wikitext
24734 [[Image:Foobar.jpg|thumb]]
24735 !! wikitext/edited
24736 [[Image:Foobar.jpg|thumb|170x170px]]
24737 !!end
24738
24739 !! test
24740 Image: Modifying alignment of an image (bug 48665)
24741 !! options
24742 parsoid={
24743 "modes": ["wt2wt"],
24744 "changes": [
24745 ["figure[class]", "removeClass", "mw-halign-right"],
24746 ["figure[class]", "addClass", "mw-halign-left"]
24747 ]
24748 }
24749 !! wikitext
24750 [[Image:Foobar.jpg|thumb|caption|right]]
24751 !! wikitext/edited
24752 [[Image:Foobar.jpg|thumb|caption|left]]
24753 !! end
24754
24755 !! test
24756 Image: Modifying mw-default-size of an frameless image (bug 62805)
24757 !! options
24758 parsoid={
24759 "modes": ["wt2wt"],
24760 "changes": [
24761 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24762 ]
24763 }
24764 !! wikitext
24765 [[Image:Foobar.jpg|frameless|right]]
24766 !! wikitext/edited
24767 [[Image:Foobar.jpg|frameless|right|220x220px]]
24768 !! end
24769
24770 !! test
24771 Image: Modifying valign of an image (bug 49221)
24772 !! options
24773 parsoid={
24774 "modes": ["wt2wt"],
24775 "changes": [
24776 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24777 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24778 ]
24779 }
24780 !! wikitext
24781 [[File:Foobar.jpg|20px|middle]]
24782 !! wikitext/edited
24783 [[File:Foobar.jpg|20px|text-top]]
24784 !! end
24785
24786 !! test
24787 Image: Modifying alt attribute of an image (bug 56400)
24788 !! options
24789 parsoid={
24790 "modes": ["wt2wt"],
24791 "changes": [
24792 ["img[alt]", "attr", "alt", "some alternate edited text"]
24793 ]
24794 }
24795 !! wikitext
24796 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24797 !! wikitext/edited
24798 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24799 !!end
24800
24801 !! test
24802 Image: Modifying caption of an image
24803 !! options
24804 parsoid={
24805 "modes": ["wt2wt"],
24806 "changes": [
24807 ["figcaption", "text", "new caption"]
24808 ]
24809 }
24810 !! wikitext
24811 [[Image:Foobar.jpg|thumb|original caption]]
24812 !! wikitext/edited
24813 [[Image:Foobar.jpg|thumb|new caption]]
24814 !!end
24815
24816 !! test
24817 Image: empty alt attribute (bug 48924)
24818 !! options
24819 parsoid
24820 !! wikitext
24821 [[File:Foobar.jpg|thumb|alt=|bar]]
24822 !! html
24823 <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>
24824 !! end
24825
24826 !! test
24827 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24828 !! options
24829 parsoid=html2wt
24830 language=ar
24831 disabled
24832 !! html/parsoid
24833 <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>
24834 !! wikitext
24835 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24836 !! end
24837
24838 !! test
24839 Image: Block level image should have \n before and after
24840 !! wikitext
24841 123
24842 [[File:Foobar.jpg|right|thumb|150x150px]]
24843 456
24844 !! html/parsoid
24845 <p>123</p>
24846 <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>
24847 <p>456</p>
24848 !!end
24849
24850 !! test
24851 Image: New block level image should have \n before and after (existing content)
24852 !! wikitext
24853 123
24854 [[File:Foobar.jpg|right|thumb|150x150px]]
24855 456
24856 !! html/parsoid
24857 <p>123</p>
24858 <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>
24859 <p>456</p>
24860 !!end
24861
24862 !! test
24863 Image: upright option (parsoid)
24864 !! wikitext
24865 [[File:Foobar.jpg|thumb|upright|caption]]
24866 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24867 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24868 !! html/parsoid
24869 <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>
24870 <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>
24871 <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>
24872 !!end
24873
24874 !! test
24875 Image: upright option is ignored on inline and frame images (parsoid)
24876 !! wikitext
24877 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24878 !! html/parsoid
24879 <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>
24880 !!end
24881
24882 !! test
24883 Image: from basic HTML (1)
24884 !! options
24885 parsoid=html2wt
24886 !! html/parsoid
24887 <span typeof="mw:Image">
24888 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24889 </span>
24890 !! wikitext
24891 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24892 !! end
24893
24894 !! test
24895 Image: from basic HTML (2)
24896 !! options
24897 parsoid=html2wt
24898 !! html/parsoid
24899 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24900 !! wikitext
24901 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24902 !! end
24903
24904 !! test
24905 Image: from basic HTML (3)
24906 !! options
24907 parsoid=html2wt
24908 !! html/parsoid
24909 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24910 !! wikitext
24911 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24912 !! end
24913
24914 !! test
24915 Image: from basic HTML (4)
24916 !! options
24917 parsoid=html2wt
24918 !! html/parsoid
24919 <img src="./File:Foobar.jpg">
24920 !! wikitext
24921 [[File:Foobar.jpg|link=]]
24922 !! end
24923
24924 !! test
24925 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24926 !! options
24927 parsoid=html2wt
24928 !! html/parsoid
24929 <ul>
24930 <li><p>foo</p></li>
24931 </ul>
24932 !! wikitext
24933 * foo
24934 !! end
24935
24936 !! test
24937 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24938 !! options
24939 parsoid=html2wt
24940 !! html/parsoid
24941 <ul> <li>foo</li></ul>
24942 !! wikitext
24943 * foo
24944 !! end
24945
24946 !! test
24947 Don't strip leading whitespace when handling indent-pre suppressing tags
24948 !! options
24949 parsoid=html2wt
24950 !! html/parsoid
24951 <table>
24952 <tr><td> indented row</td></tr>
24953 </table>
24954 <blockquote><p>
24955 <b>This is very bold of you!</b>
24956 </p>
24957 <table><tr><td>
24958 indented cell (no pre-wrapping!)
24959 </td></tr></table>
24960 </blockquote>
24961 <p>foo</p>
24962 <div>bar</div>
24963 !! wikitext
24964 {|
24965 | indented row
24966 |}
24967 <blockquote>
24968 '''This is very bold of you!'''
24969
24970 {|
24971 |
24972 indented cell (no pre-wrapping!)
24973 |}
24974 </blockquote>
24975 foo
24976 <div>bar</div>
24977 !! end
24978
24979 !! test
24980 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24981 !! options
24982 parsoid=html2wt
24983 !! html/parsoid
24984 <p>foo</p>
24985 <span>bar</span>
24986
24987 <span>foo2
24988 </span>bar2
24989
24990 <div>foo</div>
24991 <span>bar</span>
24992
24993 <div>
24994 <span>foo</span>
24995 </div>
24996 !! wikitext
24997 foo
24998
24999 <span>bar</span>
25000
25001 <span>foo2
25002 <nowiki> </nowiki></span>bar2
25003
25004 <div>foo</div>
25005 <nowiki> </nowiki><span>bar</span>
25006
25007 <div>
25008 <nowiki> </nowiki><span>foo</span>
25009 </div>
25010 !! end
25011
25012 !! test
25013 Lists: Dont insert newlines in a serialized list item.
25014 !! options
25015 parsoid=html2wt
25016 !! html/parsoid
25017 <ul><li>a<br>b</li><li>c</li></ul>
25018 !! wikitext
25019 * a<br>b
25020 * c
25021 !! end
25022
25023 !! test
25024 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25025 !! options
25026 parsoid={
25027 "modes": ["html2wt"],
25028 "scrubWikitext": false
25029 }
25030 !! html/parsoid
25031 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25032 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25033
25034 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25035 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25036
25037 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25038
25039 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25040 !! wikitext
25041 == hello there [[Category:A1]] ==
25042
25043 == [[Category:A2]] hi pal ==
25044
25045 == <!--foo--> [[Category:A3]] how goes it ==
25046
25047 == it goes well [[Category:A4]] <!--bar--> ==
25048
25049 ==howdy [[Category:A5]]==
25050
25051 == __TOC__ ok ==
25052 !! end
25053
25054 !! test
25055 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25056 !! options
25057 parsoid={
25058 "modes": ["html2wt"],
25059 "scrubWikitext": true
25060 }
25061 !! html/parsoid
25062 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25063 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25064
25065 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25066 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25067
25068 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25069 !! wikitext
25070 == hello there ==
25071 [[Category:A1]]
25072 [[Category:A2]]
25073
25074 == hi pal ==
25075
25076 <!--foo--> [[Category:A3]]
25077
25078 == how goes it ==
25079
25080 == it goes well ==
25081 [[Category:A4]] <!--bar-->
25082
25083 __TOC__
25084
25085 == ok ==
25086 !! end
25087
25088 !! test
25089 Headings: Don't hoist metas that come from templates
25090 !! options
25091 parsoid={
25092 "modes": ["html2wt"],
25093 "scrubWikitext": true
25094 }
25095 !! html/parsoid
25096 <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>
25097 !! wikitext
25098 == {{echo|foo [[Category:Foo]]}} ==
25099 !! end
25100
25101 !! test
25102 Headings: Category in ref isn't hoisted
25103 !! options
25104 parsoid={
25105 "modes": ["html2wt"],
25106 "scrubWikitext": true
25107 }
25108 !! html/parsoid
25109 <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>
25110
25111 <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>
25112 !! wikitext
25113 == foo <ref>bar
25114 [[Category:Baz]] </ref> ==
25115
25116 <references />
25117 !! end
25118
25119 !! test
25120 Parsoid: Serialize positional parameters with = in them as named parameter
25121 !! options
25122 parsoid=html2wt
25123 !! html/parsoid
25124 <p about="#mwt1" typeof="mw:Transclusion"
25125 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25126
25127 <p about="#mwt1" typeof="mw:Transclusion"
25128 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25129
25130 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25131 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25132 <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>
25133 !! wikitext
25134 {{echo|1 = f=oo}}
25135
25136 {{echo|1 = f=oo|2 = bar}}
25137
25138 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25139 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25140 {{echo|<nowiki>f=oo</nowiki>|bar}}
25141 !! end
25142
25143 !! test
25144 Parsoid: Serialize positional parameters with = in extlink as named parameter
25145 !! options
25146 parsoid=html2wt
25147 !! html/parsoid
25148 <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>
25149 !! wikitext
25150 {{echo|1 = http://stuff?is=ok}}
25151 !! end
25152
25153 !! test
25154 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25155 !! options
25156 parsoid=html2wt
25157 !! html/parsoid
25158 <div>a<p>b</p></div>
25159 <div>a
25160 <p>b</p></div>
25161 <div>
25162 a
25163 <p>b</p></div>
25164 !! wikitext
25165 <div>a
25166 b
25167 </div>
25168 <div>a
25169 b
25170 </div>
25171 <div>
25172 a
25173
25174 b
25175 </div>
25176 !! end
25177
25178 !! test
25179 Substrings resembling wikitext in hrefs should not get nowiki escapes
25180 !! options
25181 parsoid=html2wt
25182 !! html/parsoid
25183 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25184 !! wikitext
25185 [[Foo''bar''baz]]
25186 !! end
25187
25188 !! test
25189 Enforce single-line context in the serializer
25190 !! options
25191 parsoid=html2wt
25192 !! html/parsoid
25193 <h2>testing
25194 123</h2>
25195
25196 <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">
25197 </span><span about="#mwt1">you</span> </h2>
25198
25199 <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>
25200
25201 <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
25202 there</span></li></ol>
25203
25204 <ul><li>asd
25205 sdf</li></ul>
25206
25207 <ul><li>foo
25208 bar
25209 baz</li>
25210 <li>foo <b>bar</b>
25211 baz</li></ul>
25212
25213 <dl><dt>hi
25214 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25215 ho</dd></dl>
25216
25217 <dl><dd> <table>
25218 <tbody><tr><td> ha
25219 ha
25220 ha</td></tr>
25221 </tbody></table></dd></dl>
25222 !! wikitext
25223 == testing 123 ==
25224
25225 == hi {{bogus|there
25226 you}} ==
25227
25228 == foo <ref>hello
25229 there</ref> ==
25230
25231 <references />
25232
25233 * asd sdf
25234
25235 * foo bar baz
25236 * foo '''bar''' baz
25237
25238 ; hi ho : hi ho
25239
25240 : {|
25241 | ha
25242 ha
25243 ha
25244 |}
25245 !! end
25246
25247 !! test
25248 Serialize new placeholder space without spans
25249 !! options
25250 parsoid=html2wt
25251 !! html/parsoid
25252 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25253
25254 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25255
25256 <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>
25257 !! wikitext
25258 foo : bar
25259
25260 foo : bar
25261
25262 <ref>foo : bar</ref>ok
25263 !! end
25264
25265
25266 #-----------------------
25267 # Tag minimization tests
25268 #-----------------------
25269
25270 !! test
25271 1. I/B quote minimization: wikitext-only tags should be combined
25272 !! options
25273 parsoid=html2wt
25274 !! html/parsoid
25275 <p><i>A</i><i>B</i></p>
25276 <p><b>A</b><b>B</b></p>
25277 <p><i>A</i><b><i>B</i></b></p>
25278 <p><b>A</b><i><b>B</b></i></p>
25279 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25280 <p><i><b>A</b></i><i><b>B</b></i></p>
25281 <p><i><b>A</b></i><b><i>B</i></b></p>
25282 <p><b><i>A</i></b><i><b>B</b></i></p>
25283 !! wikitext
25284 ''AB''
25285
25286 '''AB'''
25287
25288 ''A'''B'''''
25289
25290 '''A''B'''''
25291
25292 '''A''BC''D'''
25293
25294 '''''AB'''''
25295
25296 '''''AB'''''
25297
25298 '''''AB'''''
25299 !! end
25300
25301 !! test
25302 2. I/B quote minimization: wikitext and html tags should not be combined
25303 !! options
25304 parsoid=html2wt
25305 !! html/parsoid
25306 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25307 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25308 !! wikitext
25309 ''A''<i>B</i>
25310
25311 ''A''<nowiki/>'''<i>B</i>'''
25312 !! end
25313
25314 !! test
25315 3. I/B quote minimization: templated content stops minimization
25316 !! options
25317 parsoid=html2wt
25318 !! html/parsoid
25319 <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>
25320 <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>
25321 !! wikitext
25322 ''A''{{echo|''B''}}
25323
25324 ''A''{{echo|'''''B'''''}}
25325 !! end
25326
25327 !! test
25328 4. I/B quote minimization: new content should be mimimized with adjacent old content
25329 !! options
25330 parsoid=html2wt
25331 !! html/parsoid
25332 <p><i>A</i><i>B</i></p>
25333 <p><b>A</b><b>B</b></p>
25334 <p><i>A</i><b><i>B</i></b></p>
25335 !! wikitext
25336 ''AB''
25337
25338 '''AB'''
25339
25340 ''A'''B'''''
25341 !! end
25342
25343 !! test
25344 5a. Merge adjacent quote nodes if they've been edited
25345 !! options
25346 parsoid={
25347 "modes": ["wt2wt", "selser"],
25348 "changes": [
25349 ["p", "contents", "remove", ":contains('b')"]
25350 ]
25351 }
25352 !! wikitext
25353 ''a''b''c''
25354 !! wikitext/edited
25355 ''ac''
25356 !! end
25357
25358 !! test
25359 5b. Merge adjacent quote nodes if they've been edited
25360 !! options
25361 parsoid={
25362 "modes": ["wt2wt", "selser"],
25363 "changes": [
25364 ["#x", "remove"]
25365 ]
25366 }
25367 !! wikitext
25368 ''a''<span id="x">b</span>''c''
25369 !! wikitext/edited
25370 ''ac''
25371 !! end
25372
25373 !! test
25374 1. Merge adjacent link nodes as long as at least one element is new
25375 !! options
25376 parsoid={
25377 "modes": ["html2wt"],
25378 "scrubWikitext": true
25379 }
25380 !! html/parsoid
25381 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25382 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25383 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25384 !! wikitext
25385 [[Football]]
25386 [[Football]]
25387 [[Football|Foot]][[Football|ball]]
25388 !! end
25389
25390 !! test
25391 2. Merge adjacent link nodes and enable additional normalizations
25392 !! options
25393 parsoid={
25394 "modes": ["html2wt"],
25395 "scrubWikitext": true
25396 }
25397 !! html/parsoid
25398 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25399 !! wikitext
25400 [[Football|''Football'']]
25401 !! end
25402
25403 !! test
25404 3. Don't merge adjacent link nodes if scrubWikitext is false
25405 !! options
25406 parsoid={
25407 "modes": ["html2wt"],
25408 "scrubWikitext": false
25409 }
25410 !! html/parsoid
25411 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25412 !! wikitext
25413 [[Football|Foot]][[Football|ball]]
25414 !! end
25415
25416 #------------------------------
25417 # End of tag minimization tests
25418 #------------------------------
25419
25420 !!test
25421 Bug 54262: New entities
25422 !! options
25423 parsoid=html2wt
25424 !! html/parsoid
25425 <span typeof="mw:Entity">&nbsp;</span>
25426 !! wikitext
25427 &nbsp;
25428 !! end
25429
25430 ## Note that there is no wikitext output for 'unknownproperty' ##
25431 ## Unknown magic words are silently dropped ##
25432
25433 !! test
25434 Magic words
25435 !! options
25436 parsoid=html2wt
25437 !! html/parsoid
25438 <meta property='mw:PageProp/toc' />
25439 <meta property='mw:PageProp/notoc' />
25440 <meta property='mw:PageProp/forcetoc' />
25441 <meta property='mw:PageProp/index' />
25442 <meta property='mw:PageProp/noindex' />
25443 <meta property='mw:PageProp/nogallery' />
25444 <meta property='mw:PageProp/noeditsection' />
25445 <meta property='mw:PageProp/notitleconvert' />
25446 <meta property='mw:PageProp/nocontentconvert' />
25447 <meta property='mw:PageProp/unknownproperty' />
25448 !! wikitext
25449 __TOC__
25450 __NOTOC__
25451 __FORCETOC__
25452 __INDEX__
25453 __NOINDEX__
25454 __NOGALLERY__
25455 __NOEDITSECTION__
25456 __NOTITLECONVERT__
25457 __NOCONTENTCONVERT__
25458 !! end
25459
25460 !! test
25461 Consecutive <pre>s should not get merged
25462 !! options
25463 parsoid=html2wt,html2html
25464 !! html/parsoid
25465 <pre>a</pre><pre>b</pre>
25466
25467 <pre>c
25468 </pre><pre>
25469 d</pre>
25470
25471 <pre>e
25472
25473 </pre><pre>
25474
25475 f</pre>
25476 !! wikitext
25477 a
25478
25479 b
25480
25481 c
25482
25483 d
25484
25485 e
25486
25487
25488
25489 f
25490 !! end
25491
25492 !! test
25493 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25494 !! options
25495 parsoid=html2wt
25496 !! html/parsoid
25497 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25498 !! wikitext
25499 [[Special:BookSources/1234567890|ISBN 1234567895]]
25500 !! end
25501
25502 !! test
25503 Edited RFC links not serializable as RFC links should serialize as extlinks
25504 !! options
25505 parsoid=html2wt
25506 !! html/parsoid
25507 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25508 !! wikitext
25509 [//tools.ietf.org/html/rfc123 New RFC]
25510 !! end
25511
25512 !! test
25513 Edited PMID links not serializable as PMID links should serialize as extlinks
25514 !! options
25515 parsoid=html2wt
25516 !! html/parsoid
25517 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25518 !! wikitext
25519 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25520 !! end
25521
25522 !! test
25523 WTS of autolinks with trailing/surrounding context
25524 !! options
25525 parsoid=html2wt
25526 !! html/parsoid
25527 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25528 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25529 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25530 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25531 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25532 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25533 !! wikitext
25534 http://cscott.net'''foo'''
25535
25536 http://cscott.net<b>foo</b>
25537
25538 '''http://cscott.net'''
25539
25540 '''http://cscott.net '''
25541
25542 '''http://cscott.net<nowiki/>x'''
25543
25544 http://cscott.net<nowiki/>x
25545 !! end
25546
25547 !! test
25548 WTS of autolinks with nowikis (round-trip)
25549 !! wikitext
25550 x<nowiki/>http://cscott.net<nowiki/>x
25551 !! html/parsoid
25552 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25553 !! end
25554
25555 # this is the "easy" test because it leaves in place all the
25556 # data-parsoid information indicating this is an autolink
25557 !! test
25558 WTS of autolinks with escapes (editing)
25559 !! options
25560 parsoid={
25561 "modes": ["wt2wt"],
25562 "changes": [
25563 [ "meta", "remove" ]
25564 ]
25565 }
25566 !! wikitext
25567 x<nowiki/>http://cscott.net<nowiki/>x
25568 !! wikitext/edited
25569 x<nowiki/>http://cscott.net<nowiki/>x
25570 !! end
25571
25572 !! test
25573 WTS of edited autolink-like text (T103364)
25574 !! options
25575 parsoid={
25576 "modes": ["wt2wt"],
25577 "changes": [
25578 [ "span[typeof]", "removeAttr", "typeof" ]
25579 ]
25580 }
25581 !! wikitext
25582 Not a link: <nowiki>http://example.com</nowiki>.
25583 !! wikitext/edited
25584 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25585 !! end
25586
25587 !! test
25588 WTS of newly-authored autolink-like text (T103364)
25589 !! options
25590 parsoid=html2wt
25591 !! html/parsoid
25592 <p>http://example.com is not a link.</p>
25593 !! wikitext
25594 <nowiki>http://example.com</nowiki> is not a link.
25595 !! end
25596
25597 !! test
25598 WTS of autolink-like text after an autolink (T108563)
25599 !! options
25600 parsoid=html2wt
25601 !! html/parsoid
25602 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25603 !! wikitext
25604 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25605 !! end
25606
25607 !! test
25608 Magic links inside links (not autolinked)
25609 !! wikitext
25610 [[Foo|http://example.com]]
25611 [[Foo|RFC 1234]]
25612 [[Foo|PMID 1234]]
25613 [[Foo|ISBN 123456789x]]
25614
25615 [http://foo.com http://example.com]
25616 [http://foo.com RFC 1234]
25617 [http://foo.com PMID 1234]
25618 [http://foo.com ISBN 123456789x]
25619 !! html+tidy
25620 <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>
25621 <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>
25622 !! html/parsoid
25623 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25624 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25625 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25626 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25627
25628 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25629 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25630 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25631 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25632 !! end
25633
25634 !! test
25635 Magic links inside image captions (autolinked)
25636 !! wikitext
25637 [[File:Foobar.jpg|thumb|http://example.com]]
25638 [[File:Foobar.jpg|thumb|RFC 1234]]
25639 [[File:Foobar.jpg|thumb|PMID 1234]]
25640 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25641 !! html+tidy
25642 <div class="thumb tright">
25643 <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>
25644 <div class="thumbcaption">
25645 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25646 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25647 </div>
25648 </div>
25649 <div class="thumb tright">
25650 <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>
25651 <div class="thumbcaption">
25652 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25653 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25654 </div>
25655 </div>
25656 <div class="thumb tright">
25657 <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>
25658 <div class="thumbcaption">
25659 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25660 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25661 </div>
25662 </div>
25663 <div class="thumb tright">
25664 <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>
25665 <div class="thumbcaption">
25666 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25667 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25668 </div>
25669 </div>
25670 !! html/parsoid
25671 <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>
25672 <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>
25673 <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>
25674 <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>
25675 !! end
25676
25677 !! test
25678 WTS of magic word text (T109371)
25679 !! options
25680 parsoid=html2wt
25681 !! html/parsoid
25682 <p>RFC 1234</p>
25683 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25684 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25685 !! wikitext
25686 <nowiki>RFC 1234</nowiki>
25687
25688 [http://foo.com RFC 1234]
25689
25690 [[Foo|RFC 1234]]
25691 !! end
25692
25693 !! test
25694 Edited Redirect link should emit a non-piped wikitext link
25695 !! options
25696 parsoid=html2wt
25697 !! html/parsoid
25698 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25699 !! wikitext
25700 #REDIRECT [[Bar]]
25701 !! end
25702
25703 !! test
25704 T75121: Infer extension name from typeOf if data-mw is not present
25705 !! options
25706 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25707 !! html/parsoid
25708 <div typeOf="mw:Extension/foo"></div>
25709 !! wikitext
25710 <foo />
25711 !! end
25712
25713 # Note that the <p> wrapping isn't present in PHP parser output
25714 # The important thing for this test is that P-wrapping doesn't
25715 # interfere with the <nowiki> protection for leading - in <td>
25716 # (which isn't necessary for <th>).
25717 !! test
25718 T88318: p-wrapped dash in table.
25719 !! options
25720 parsoid=html2wt,wt2wt
25721 !! html/parsoid
25722 <table><tbody>
25723 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25724 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25725 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25726 </tbody></table>
25727 !! wikitext
25728 {|
25729 !-
25730 !-
25731 |-
25732 |<nowiki>-</nowiki>
25733 |<nowiki>- </nowiki>
25734 |-
25735 |<small>-</small>
25736 |<br>
25737 -
25738 |<br>
25739 -
25740 |}
25741 !! html/php+tidy
25742 <table>
25743 <tr>
25744 <th>-</th>
25745 <th>-</th>
25746 </tr>
25747 <tr>
25748 <td>-</td>
25749 <td>-</td>
25750 </tr>
25751 <tr>
25752 <td><small>-</small></td>
25753 <td><br />
25754 <p>-</p>
25755 </td>
25756 <td><br />
25757 <p>-</p>
25758 </td>
25759 </tr>
25760 </table>
25761 !! end
25762
25763 !! test
25764 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25765 !! options
25766 parsoid=html2wt
25767 !! html/parsoid
25768 <table id='mwAb'>
25769 <td id='mwAc'>foo</td>
25770 <td id='serialize-this'>bar</td>
25771 </table>
25772 !! wikitext
25773 {|
25774 |foo
25775 | id="serialize-this" |bar
25776 |}
25777 !! end
25778
25779 !! test
25780 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25781 !! options
25782 parsoid=html2wt
25783 !! html/parsoid
25784 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25785 !! wikitext
25786 <div id="hello">ok</div>
25787 !! end
25788
25789 !! test
25790 WTS change modes
25791 !! options
25792 parsoid={
25793 "modes": ["wt2wt"],
25794 "changes": [
25795 [ "#xyz", "before", "<b>before</b> stuff " ],
25796 [ "#xyz", "after", " stuff <i>after</i>" ],
25797 [ "#xyz", "html", "x <b>y</b> z" ]
25798 ]
25799 }
25800 !! wikitext
25801 <span id="xyz">hello</span>
25802 !! wikitext/edited
25803 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25804 !! end
25805
25806 !! test
25807 Never serialize a-tag as html, regardless of what data-parsoid has to say
25808 !! options
25809 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25810 !! html/parsoid
25811 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25812 !! wikitext
25813 [[Foo]]
25814 !! end
25815
25816 ## SSS FIXME: This is broken output nevertheless.
25817 ## What might be a reasonable non-broken output for this?
25818 ## This is an edge case unlikely to be seen in production
25819 ## that I am not wasting more time on this right now.
25820 !! test
25821 Never serialize a-tag as html, no matter what attributes it has
25822 !! options
25823 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25824 !! html/parsoid
25825 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25826 !! wikitext
25827 [http://boo.org http://boohoo.org]
25828 !! end
25829
25830 # Misnested is an indication that selser can reuse the source but these have
25831 # shown to sneak through on occasion. See T101768.
25832 # The original wikitext here is: [http://test.com [[one]] two three]
25833 !! test
25834 Strip span tags added to mark misnested links
25835 !! options
25836 parsoid=html2wt
25837 !! html/parsoid
25838 <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>
25839 !! wikitext
25840 [http://test.com][[one]] two three
25841 !! end
25842
25843 !! test
25844 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25845 !! options
25846 parsoid=html2wt
25847 !! html/parsoid
25848 <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|}"]}'>
25849 <tbody><tr><td>d
25850 </td></tr>
25851 </tbody></table>
25852 !! wikitext
25853 {{echo|a}}
25854 {|{{echo|c
25855 {{!}}d
25856 }}
25857 |}
25858 !! end
25859
25860 ## This test verifies the presence and computation of this attribute indirectly
25861 ## by making an edit and ensuring that the serialization is correct (which it would be
25862 ## only if firstWikitextNode is properly set).
25863 !! test
25864 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25865 !! options
25866 parsoid= {
25867 "modes": ["wt2wt"],
25868 "changes": [
25869 [ "div#x", "remove" ],
25870 [ "div", "before", "<div>new</div>" ]
25871 ]
25872 }
25873 !! wikitext
25874 <div id="x">foo</div>
25875 {|
25876 {{echo|<div>boo</div>
25877 {{!}}b}}
25878 |c
25879 |}
25880 !! wikitext/edited
25881
25882 <div>new</div>
25883 {|
25884 {{echo|<div>boo</div>
25885 {{!}}b}}
25886 |c
25887 |}
25888 !! end
25889
25890 # --------------------------------------------
25891 # Tests spec'ing wikitext serialization norms |
25892 # --------------------------------------------
25893
25894 !! test
25895 1. Categories should always be serialized on their own line
25896 !! options
25897 parsoid=html2wt
25898 !! html/parsoid
25899 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
25900 !! wikitext
25901 foo
25902 [[Category:Foo]]
25903 bar
25904 !! end
25905
25906 !! test
25907 2. Categories that are part of templates should not introduce a line break
25908 !! wikitext
25909 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
25910 !! html/parsoid
25911 <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>
25912 !! end
25913
25914 # Careful while editing these next 2 tests. There are \u200f characters
25915 # before and after the <link> tags in the HTML and following some
25916 # of the categories in wikitext
25917 # Do not remove these characters in edits.
25918 #
25919 # As part of the serialization, these bidi characters will get stripped.
25920 !! test
25921 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
25922 !! options
25923 parsoid={
25924 "modes": ["html2wt"],
25925 "scrubWikitext": true
25926 }
25927 !! html/parsoid
25928 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
25929 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
25930 !! wikitext
25931 [[קטגוריה:טקסים]]
25932 [[קטגוריה: שיטות משפט]]
25933 !! end
25934
25935 !! test
25936 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
25937 !! options
25938 parsoid={
25939 "modes": ["html2wt"],
25940 "scrubWikitext": true
25941 }
25942 !! html/parsoid
25943 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
25944 !! wikitext
25945 [[קטגוריה:טקסים]]
25946 ‏y
25947 !! end
25948
25949 !! test
25950 Lists: Add space after bullets
25951 !! options
25952 parsoid=html2wt
25953 !! html/parsoid
25954 <ul>
25955 <li>foo</li>
25956 <li> bar</li>
25957 <li><span> baz</span></li>
25958 </ul>
25959 !! wikitext
25960 * foo
25961 * bar
25962 * <span> baz</span>
25963 !! end
25964
25965 !! test
25966 1. Headings: Add space before/after == (T53744)
25967 !! options
25968 parsoid=html2wt
25969 !! html/parsoid
25970 <h2>foo</h2>
25971 <h2> bar</h2>
25972 <h2>baz </h2>
25973 <h2><span> baz</span></h2>
25974 !! wikitext
25975 == foo ==
25976
25977 == bar ==
25978
25979 == baz ==
25980
25981 == <span> baz</span> ==
25982 !! end
25983
25984 !! test
25985 2. Headings: Add space before/after == even after hoisted content
25986 !! options
25987 parsoid={
25988 "modes": ["html2wt"],
25989 "scrubWikitext": true
25990 }
25991 !! html/parsoid
25992 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25993 !! wikitext
25994 [[Category:A2]]
25995
25996 == ok ==
25997 !! end
25998
25999 !! test
26000 1. Headings: suppress newly created empty headings
26001 !! options
26002 parsoid={
26003 "modes": ["html2wt"],
26004 "scrubWikitext": true
26005 }
26006 !! html/parsoid
26007 <h2></h2>
26008 !! wikitext
26009 !! end
26010
26011 !! test
26012 2. Headings: don't suppress empty headings if scrubWikitext is false
26013 !! options
26014 parsoid=html2wt
26015 !! html/parsoid
26016 <h2></h2>
26017 !! wikitext
26018 ==<nowiki/>==
26019 !! end
26020
26021 !! test
26022 3. Headings: suppress empty headings on edits
26023 !! options
26024 parsoid={
26025 "modes": ["selser"],
26026 "scrubWikitext": true,
26027 "changes": [
26028 [ "#x", "remove"]
26029 ]
26030 }
26031 !! wikitext
26032 ==<span id="x">foo</span>==
26033 !! wikitext/edited
26034 !! end
26035
26036 !! test
26037 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26038 !! options
26039 parsoid={
26040 "modes": ["html2wt"],
26041 "scrubWikitext": true
26042 }
26043 !! html/parsoid
26044 <h2>foo<br/>bar</h2>
26045 <h2>foo <span><br/>bar</span> baz</h2>
26046 !! wikitext
26047 == foo bar ==
26048
26049 == foo <span> bar</span> baz ==
26050 !! end
26051
26052 !! test
26053 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26054 !! options
26055 parsoid={
26056 "modes": ["html2wt"],
26057 "scrubWikitext": false
26058 }
26059 !! html/parsoid
26060 <h2>foo<br/>bar</h2>
26061 !! wikitext
26062 == foo<br> bar ==
26063 !! end
26064
26065 !! test
26066 1. WT Quote Tags: suppress newly created empty style tags
26067 !! options
26068 parsoid={
26069 "modes": ["html2wt"],
26070 "scrubWikitext": true
26071 }
26072 !! html/parsoid
26073 <i></i><b></b>
26074 !! wikitext
26075 !! end
26076
26077 !! test
26078 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26079 !! options
26080 parsoid=html2wt
26081 !! html/parsoid
26082 <i></i><b></b>
26083 !! wikitext
26084 ''<nowiki/>'''''<nowiki/>'''
26085 !! end
26086
26087 !! test
26088 3. WT Quote Tags: suppress empty style tags on edits
26089 !! options
26090 parsoid={
26091 "modes": ["selser"],
26092 "scrubWikitext": true,
26093 "changes": [
26094 [ "#x", "remove"]
26095 ]
26096 }
26097 !! wikitext
26098 '''<span id="x">foo</span>'''
26099 !! wikitext/edited
26100 !! end
26101
26102 !! test
26103 1. Anchors: suppress newly created empty anchors
26104 !! options
26105 parsoid={
26106 "modes": ["html2wt"],
26107 "scrubWikitext": true
26108 }
26109 !! html/parsoid
26110 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26111 !! wikitext
26112 !! end
26113
26114 !! test
26115 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26116 !! options
26117 parsoid={
26118 "modes": ["html2wt"],
26119 "scrubWikitext": false
26120 }
26121 !! html/parsoid
26122 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26123 !! wikitext
26124 [[Test|<nowiki/>]]
26125 !! end
26126
26127 !! test
26128 3. Anchors: suppress empty anchors on edits
26129 !! options
26130 parsoid={
26131 "modes": ["selser"],
26132 "scrubWikitext": true,
26133 "changes": [
26134 [ "#x", "remove"]
26135 ]
26136 }
26137 !! wikitext
26138 [[Test|<span id="x">foo</span>]]
26139 !! wikitext/edited
26140 !! end
26141
26142 !! test
26143 3a. Anchors: do not suppress numbered extlinks
26144 !! options
26145 parsoid={
26146 "modes": ["wt2wt"],
26147 "scrubWikitext": true
26148 }
26149 !! wikitext
26150 [http://foo.com]
26151 !! html/parsoid
26152 <a rel="mw:ExtLink" href="http://foo.com"></a>
26153 !! end
26154
26155 !! test
26156 3b. Anchors: do not suppress numbered extlinks
26157 !! options
26158 parsoid={
26159 "modes": ["wt2wt"],
26160 "scrubWikitext": true,
26161 "changes": [
26162 [ "#x", "remove"]
26163 ]
26164 }
26165 !! wikitext
26166 [http://foo.com <span id="x">foo</span>]
26167 !! wikitext/edited
26168 [http://foo.com]
26169 !! end
26170
26171 !!test
26172 Normalizations should be restricted to edited content
26173 !!options
26174 parsoid={
26175 "modes": ["selser"],
26176 "scrubWikitext": true,
26177 "changes": [
26178 [ "h1", "before", "<i></i>"]
26179 ]
26180 }
26181 !!wikitext
26182 a
26183 = =
26184 b
26185 !!wikitext/edited
26186 a
26187 = =
26188 b
26189 !!end
26190
26191 !! test
26192 1. Multiple normalizations (html2wt)
26193 !! options
26194 parsoid={
26195 "modes": ["html2wt"],
26196 "scrubWikitext": true
26197 }
26198 !! html
26199 <h2><i></i></h2>
26200 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26201 </a><b><i></i></b>x</p>
26202 !! wikitext
26203
26204 [[foo]]
26205 x
26206
26207 !! end
26208
26209 !! test
26210 2. Multiple normalizations (selser)
26211 !! options
26212 parsoid={
26213 "modes": ["selser"],
26214 "scrubWikitext": true,
26215 "changes": [
26216 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26217 ]
26218 }
26219 !! wikitext
26220 <span id="x">foo</span>
26221 !! wikitext/edited
26222 <span id="x">foo</span>
26223
26224 x
26225 !! end
26226
26227 !! test
26228 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26229 !! options
26230 parsoid={
26231 "modes": ["html2wt"],
26232 "scrubWikitext": true
26233 }
26234 !! html/parsoid
26235 <p> hi</p>
26236 <p> hello</p>
26237 !! wikitext
26238 hi
26239
26240 hello
26241 !! end
26242
26243 !! test
26244 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26245 !! options
26246 parsoid=html2wt
26247 !! html/parsoid
26248 <p> hi</p>
26249 <p> hello</p>
26250 !! wikitext
26251 <nowiki> </nowiki>hi
26252
26253 <nowiki> </nowiki> hello
26254 !! end
26255
26256 !! test
26257 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26258 !! options
26259 parsoid={
26260 "modes": ["html2wt"],
26261 "scrubWikitext": true
26262 }
26263 !! html/parsoid
26264 <p>Foo
26265 bar
26266 baz</p>
26267
26268 <table><tr><td>Foo
26269 bar
26270 baz bang</td></tr></table>
26271
26272 <p><!--boo--> foo
26273 bar</p>
26274
26275 <p> foo
26276 bar<span>boo</span></p>
26277 !! wikitext
26278 Foo
26279 bar
26280 baz
26281
26282 {|
26283 |Foo
26284 bar
26285 baz bang
26286 |}
26287
26288 <!--boo-->foo
26289 bar
26290
26291 foo
26292 bar<span>boo</span>
26293 !! end
26294
26295 !! test
26296 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26297 !! options
26298 parsoid={
26299 "modes": ["selser"],
26300 "scrubWikitext": true,
26301 "changes": [
26302 [ "p", "html", " a\n b" ]
26303 ]
26304 }
26305 !! wikitext
26306 xyz
26307 !! wikitext/edited
26308 a
26309 b
26310 !! end
26311
26312 !! test
26313 1. New links that end in spaces
26314 !! options
26315 parsoid={
26316 "modes": ["html2wt"],
26317 "scrubWikitext": false
26318 }
26319 !! html/parsoid
26320 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26321 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26322 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26323 !! wikitext
26324 [[Berlin ]]<nowiki/>is the capital of Germany.
26325
26326 [[Foo ]]'''bar'''
26327
26328 [[Boston ]] is a city.
26329 !! end
26330
26331 !! test
26332 2. New links that end in spaces
26333 !! options
26334 parsoid={
26335 "modes": ["html2wt"],
26336 "scrubWikitext": true
26337 }
26338 !! html/parsoid
26339 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26340 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26341 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26342 !! wikitext
26343 [[Berlin]] is the capital of Germany.
26344
26345 [[Foo]] '''bar'''
26346
26347 [[Boston]] is a city.
26348 !! end
26349
26350 !! test
26351 1. Table cells with escapable prefixes
26352 !! options
26353 parsoid={
26354 "modes": ["html2wt"],
26355 "scrubWikitext": false
26356 }
26357 !! html
26358 <table>
26359 <tr><td>a</td></tr>
26360 <tr><td>-</td></tr>
26361 <tr><td>+</td></tr>
26362 </table>
26363 !! wikitext
26364 {|
26365 |a
26366 |-
26367 |<nowiki>-</nowiki>
26368 |-
26369 |<nowiki>+</nowiki>
26370 |}
26371 !! end
26372
26373 !! test
26374 2. Table cells with escapable prefixes
26375 !! options
26376 parsoid={
26377 "modes": ["html2wt"],
26378 "scrubWikitext": true
26379 }
26380 !! html
26381 <table>
26382 <tr><td>a</td></tr>
26383 <tr><td>-</td></tr>
26384 <tr><td>+</td></tr>
26385 </table>
26386 !! wikitext
26387 {|
26388 |a
26389 |-
26390 | -
26391 |-
26392 | +
26393 |}
26394 !! end
26395
26396 !! test
26397 3a. Table cells with escapable prefixes after edits
26398 !! options
26399 parsoid={
26400 "modes": ["selser"],
26401 "scrubWikitext": true,
26402 "changes": [
26403 [ "table tbody tr:first-child td:first-child", "remove"]
26404 ]
26405 }
26406 !! wikitext
26407 {|
26408 |a||-
26409 |}
26410 !! wikitext/edited
26411 {|
26412 | -
26413 |}
26414 !! end
26415
26416 !! test
26417 3b. Table cells with escapable prefixes after edits
26418 !! options
26419 parsoid={
26420 "modes": ["selser"],
26421 "scrubWikitext": true,
26422 "changes": [
26423 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26424 [ "#x", "remove" ]
26425 ]
26426 }
26427 !! wikitext
26428 {|
26429 |pqr
26430 |<span id="x">foo</span>+
26431 |}
26432 !! wikitext/edited
26433 {|
26434 | -
26435 | +
26436 |}
26437 !! end
26438
26439 # FIXME: This test will fail because
26440 # normalization doesn't realize that the id attribute
26441 # will eliminate the escapable scenario
26442 !! test
26443 4a. Table cells without escapable prefixes after edits
26444 !! options
26445 parsoid={
26446 "modes": ["selser"],
26447 "scrubWikitext": true,
26448 "changes": [
26449 [ "#x", "html", "-" ]
26450 ]
26451 }
26452 !! wikitext
26453 {|
26454 | id="x" |abcd
26455 |}
26456 !! wikitext/edited
26457 {|
26458 | id="x" |-
26459 |}
26460 !! end
26461
26462 ## This tests normalizer's ability to discriminate between
26463 ## cells having identical content.
26464 !! test
26465 4b. Table cells without escapable prefixes after edits
26466 !! options
26467 parsoid={
26468 "modes": ["selser"],
26469 "scrubWikitext": true,
26470 "changes": [
26471 [ "td", "html", "-" ]
26472 ]
26473 }
26474 !! wikitext
26475 {|
26476 |a||b
26477 |}
26478 !! wikitext/edited
26479 {|
26480 | -||-
26481 |}
26482 !! end
26483
26484 ## This tests normalizer's ability to not be tripped by
26485 ## comments (and whitespace)
26486 !! test
26487 4c. Table cells without escapable prefixes after edits
26488 !! options
26489 parsoid={
26490 "modes": ["selser"],
26491 "scrubWikitext": true,
26492 "changes": [
26493 [ "table tbody tr td:first-child", "remove" ]
26494 ]
26495 }
26496 !! wikitext
26497 {|
26498 |-
26499 <!--foo--> |a||-
26500 |}
26501 !! wikitext/edited
26502 {|
26503 |-
26504 <!--foo--> | -
26505 |}
26506 !! end
26507
26508 ## This tests normalizer's ability to handle HTML cells
26509 !! test
26510 4d. Table cells without escapable prefixes after edits
26511 !! options
26512 parsoid={
26513 "modes": ["selser"],
26514 "scrubWikitext": true,
26515 "changes": [
26516 [ "td", "html", "-" ]
26517 ]
26518 }
26519 !! wikitext
26520 <table>
26521 <tr><td>a</td></tr>
26522 </table>
26523 !! wikitext/edited
26524 <table>
26525 <tr><td>-</td></tr>
26526 </table>
26527 !! end
26528
26529 ## T111151 Remove font elements without attributes
26530 !! test
26531 5a. font tags without attributes should be dropped in scrubWikitext mode
26532 !! options
26533 parsoid={
26534 "modes": ["html2wt"],
26535 "scrubWikitext": true
26536 }
26537 !! html
26538 <font>foo</font>
26539 <font><font>bar</font></font>
26540 <font class="x">boo</font>
26541 !! wikitext
26542 foo
26543 bar
26544 <font class="x">boo</font>
26545 !! end
26546
26547 !! test
26548 5b. font tags should not be dropped without scrubWikitext being enabled
26549 !! options
26550 parsoid={
26551 "modes": ["html2wt"],
26552 "scrubWikitext": false
26553 }
26554 !! html
26555 <font>foo</font>
26556 !! wikitext
26557 <font>foo</font>
26558 !! end
26559
26560 !! test
26561 Escape nowiki DOM elements
26562 !! options
26563 parsoid=html2wt
26564 !! html/parsoid
26565 <nowiki><i>foo</i></nowiki>
26566 !! wikitext
26567 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26568 !! end
26569
26570 # This is meant to be an interim fix while we go about figuring out
26571 # how to not introduce these trailing <nowiki/>s in the first place.
26572 !! test
26573 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26574 !! options
26575 parsoid=html2wt
26576 !! html/parsoid
26577 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26578 y</p>
26579 <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>
26580 <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>
26581 !! wikitext
26582 x
26583 y
26584
26585 {{echo|
26586 1 = <nowiki/>}}
26587
26588 {{echo|
26589 1 = <nowiki/>
26590 }}
26591 !! end
26592
26593 # ---------------------------------------------------
26594 # End of tests spec'ing wikitext serialization norms |
26595 # ---------------------------------------------------
26596
26597 # T104032
26598 !! test
26599 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26600 !! options
26601 parsoid=html2wt
26602 !! html/parsoid
26603 a<p>b</p>
26604 <b>c</b><p>d</p>
26605 <table><tr>
26606 <td>a<p>b</p></td>
26607 <td><b>c</b><p>d</p></td>
26608 </tr></table>
26609 !! wikitext
26610 a
26611
26612 b
26613
26614 '''c'''
26615
26616 d
26617 {|
26618 |a
26619 b
26620 |'''c'''
26621 d
26622 |}
26623 !! end
26624
26625 # -----------------------------------------------------------------
26626 # End of section for Parsoid-only html2wt tests for serialization
26627 # of new content
26628 # -----------------------------------------------------------------
26629
26630 # -----------------------------------------------------------------
26631 # The following section of tests are primarily to spec behavior of
26632 # the selective serializer. All these tests have manual selser
26633 # changes. The automated selser changes for all tests handle the
26634 # wide variation of changes, but these tests here capture specs
26635 # deterministically.
26636 # ----------------------------------------------------------------
26637
26638 ## T90517
26639 !! test
26640 Selser: New comments should not be lost
26641 !! options
26642 parsoid={
26643 "modes": ["selser"],
26644 "changes": [
26645 [ "#a", "after", "<!--c1-->" ],
26646 [ "#b", "before", "<!--c2-->" ]
26647 ]
26648 }
26649 !! wikitext
26650 <span id="a">a</span>
26651
26652 <span id="b">b</span>
26653 !! wikitext/edited
26654 <span id="a">a</span><!--c1-->
26655
26656 <!--c2--><span id="b">b</span>
26657 !! end
26658
26659 ## T89383
26660 !! test
26661 Selser: Check for validity of DSR before using it
26662 !! options
26663 parsoid={
26664 "modes": ["selser"],
26665 "changes": [
26666 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26667 ]
26668 }
26669 !! wikitext
26670 <span id="a">a</span>
26671 !! wikitext/edited
26672 {{DISPLAYTITLE:foo}}
26673 <span id="a">a</span>
26674 !! end
26675
26676 !! test
26677 1. DOMDiff: Changes to <ref> content should be looked up using id
26678 !! options
26679 parsoid={
26680 "modes": ["selser"],
26681 "changes": [
26682 ["#X", "after", "bar"],
26683 ["#Y", "after", "baz"]
26684 ]
26685 }
26686 !! wikitext
26687 X <ref><span id="X">foo</span></ref>
26688 Y <ref name="a" />
26689 <references>
26690 <ref name="a"><span id="Y">foo</span></ref>
26691 </references>
26692 !! wikitext/edited
26693 X <ref><span id="X">foo</span>bar</ref>
26694 Y <ref name="a" />
26695 <references>
26696 <ref name="a"><span id="Y">foo</span>baz</ref>
26697 </references>
26698 !! end
26699
26700 !! test
26701 2. DOMDiff: Changes to <ref> content should be looked up using id
26702 !! options
26703 parsoid={
26704 "modes": ["selser"],
26705 "changes": [
26706 ["#Z", "after", "bar"]
26707 ]
26708 }
26709 !! wikitext
26710 A <ref>foo bar for a</ref>
26711 B <ref group="X" name="b" />
26712
26713 <references />
26714
26715 <references group="X">
26716 <ref name="b"><span id="Z">foo</span></ref>
26717 </references>
26718 !! wikitext/edited
26719 A <ref>foo bar for a</ref>
26720 B <ref group="X" name="b" />
26721
26722 <references />
26723
26724 <references group="X">
26725 <ref name="b"><span id="Z">foo</span>bar</ref>
26726 </references>
26727 !! end
26728
26729 !! test
26730 Empty LI (T49673)
26731 !! wikitext
26732 * a
26733 *
26734 *
26735 * b
26736 !! html/php+tidy
26737 <ul>
26738 <li>a</li>
26739 <li class="mw-empty-li"></li>
26740 <li class="mw-empty-li"></li>
26741 <li>b</li>
26742 </ul>
26743 !! end