Match html5 unquoted attribute parsing
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # noxml don't check for XML well-formedness
22 # title=[[XXX]] run test using article title XXX
23 # language=XXX set content language to XXX for this test
24 # variant=XXX set the variant of language for this test (eg zh-tw)
25 # disabled do not run test
26 # parsoid parsoid-specific options (not run by PHP parser unless
27 # the test includes an html/php section)
28 # php php-only test (not run by the parsoid parser unless
29 # the test includes an html/parsoid section)
30 # showtitle make the first line the title
31 # showindicators make the first lines the page status indicators
32 # comment run through Linker::formatComment() instead of main parser
33 # local format section links in edit comment text as local links
34 # notoc disable table of contents
35 # thumbsize=NNN set the default thumb size to NNNpx for this test
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 ###
275 ### Basic tests
276 ###
277 !! test
278 Blank input
279 !! wikitext
280 !! html
281 !! end
282
283
284 !! test
285 Simple paragraph
286 !! wikitext
287 This is a simple paragraph.
288 !! html
289 <p>This is a simple paragraph.
290 </p>
291 !! end
292
293 !! test
294 Paragraphs with extra newline spacing
295 !! wikitext
296 foo
297
298 bar
299
300
301 baz
302
303
304
305 booz
306 !! html
307 <p>foo
308 </p><p>bar
309 </p><p><br />
310 baz
311 </p><p><br />
312 </p><p>booz
313 </p>
314 !! end
315
316 !! test
317 Paragraphs with newline spacing with comment lines in between
318 !! wikitext
319 ----
320 a
321 <!--foo-->
322 b
323 ----
324 a
325 <!--foo--><!--More than 1 comment, still stripped-->
326 b
327 ----
328 a
329 <!--foo--> <!----> <!-- bar -->
330 b
331 ----
332 a
333 <!--foo-->
334
335 b
336 ----
337 a
338
339 <!--foo-->
340 b
341 ----
342 a
343 <!--foo-->
344
345
346 b
347 ----
348 a
349
350
351 <!--foo-->
352 b
353 ----
354 !! html
355 <hr />
356 <p>a
357 b
358 </p>
359 <hr />
360 <p>a
361 b
362 </p>
363 <hr />
364 <p>a
365 b
366 </p>
367 <hr />
368 <p>a
369 </p><p>b
370 </p>
371 <hr />
372 <p>a
373 </p><p>b
374 </p>
375 <hr />
376 <p>a
377 </p><p><br />
378 b
379 </p>
380 <hr />
381 <p>a
382 </p><p><br />
383 b
384 </p>
385 <hr />
386
387 !! end
388
389 !! test
390 Paragraphs with newline spacing with non-empty white-space lines in between
391 !! wikitext
392 ----
393 a
394
395 b
396 ----
397 a
398
399
400 b
401 ----
402 !! html
403 <hr />
404 <p>a
405 </p><p>b
406 </p>
407 <hr />
408 <p>a
409 </p><p><br />
410 b
411 </p>
412 <hr />
413
414 !! end
415
416 !! test
417 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
418 !! wikitext
419 ----
420 a
421 <!--foo-->
422 b
423 ----
424 a
425 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
426 b
427 ----
428 a
429
430 <!--foo-->
431 <!--bar-->
432 b
433 ----
434 a
435
436 <!--foo-->
437 <!--bar-->
438
439 b
440 ----
441 !! html
442 <hr />
443 <p>a
444 b
445 </p>
446 <hr />
447 <p>a
448 b
449 </p>
450 <hr />
451 <p>a
452 </p><p>b
453 </p>
454 <hr />
455 <p>a
456 </p><p><br />
457 b
458 </p>
459 <hr />
460
461 !! end
462
463 !! test
464 Extra newlines: More paragraphs with indented comment
465 !! wikitext
466 a
467
468 <!--boo-->
469
470 b
471 !! html
472 <p>a
473 </p><p><br />
474 b
475 </p>
476 !!end
477
478 !! test
479 Extra newlines followed by heading
480 !! wikitext
481 a
482
483
484
485 =b=
486 [[a]]
487
488
489 =b=
490 !! html
491 <p>a
492 </p><p><br />
493 </p>
494 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
495 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
496 </p><p><br />
497 </p>
498 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
499
500 !! end
501
502 !! test
503 Extra newlines between heading and content are swallowed
504 !! wikitext
505 =b=
506
507
508
509 [[a]]
510 !! html
511 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
512 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
513 </p>
514 !! end
515
516 !! test
517 Parsing an URL
518 !! wikitext
519 http://fr.wikipedia.org/wiki/🍺
520 <!-- EasterEgg we love beer, better be able be able to link to it -->
521 !! html
522 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
523 </p>
524 !! end
525
526 # Note that the html+tidy output removes the spaces after the <li>,
527 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
528 # This is an issue for all tests with lists. We intentionally do
529 # *not* add html+tidy clauses for these, as we don't want to
530 # document/test the broken behavior. (Parsoid matches the non-tidy
531 # output in these cases.)
532
533 !! test
534 Simple list
535 !! wikitext
536 * Item 1
537 * Item 2
538 !! html
539 <ul><li> Item 1</li>
540 <li> Item 2</li></ul>
541
542 !! end
543
544 !! test
545 Italics and bold
546 !! wikitext
547 * plain
548 * plain''italic''plain
549 * plain''italic''plain''italic''plain
550 * plain'''bold'''plain
551 * plain'''bold'''plain'''bold'''plain
552 * plain''italic''plain'''bold'''plain
553 * plain'''bold'''plain''italic''plain
554 * plain''italic'''bold-italic'''italic''plain
555 * plain'''bold''bold-italic''bold'''plain
556 * plain'''''bold-italic'''italic''plain
557 * plain'''''bold-italic''bold'''plain
558 * plain''italic'''bold-italic'''''plain
559 * plain'''bold''bold-italic'''''plain
560 * plain l'''italic''plain
561 * plain l''''bold''' plain
562 !! html
563 <ul><li> plain</li>
564 <li> plain<i>italic</i>plain</li>
565 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
566 <li> plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
568 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
569 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
570 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
573 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
574 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
575 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
576 <li> plain l'<i>italic</i>plain</li>
577 <li> plain l'<b>bold</b> plain</li></ul>
578
579 !! end
580
581 # this example taken from the [[simple:Moon]] article (bug 47326)
582 !! test
583 Italics and possessives (1)
584 !! wikitext
585 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
586 !! html
587 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
588 </p>
589 !! end
590
591 # this example taken from [[en:Flaming Pie]] (bug 49926)
592 !! test
593 Italics and possessives (2)
594 !! wikitext
595 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
596 !! html
597 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
598 </p>
599 !! end
600
601 # this example taken from [[en:Dictionary]] (bug 49926)
602 !! test
603 Italics and possessives (3)
604 !! wikitext
605 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
606 !! html
607 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
608 </p>
609 !! end
610
611
612 ###
613 ### 2-quote opening sequence tests
614 ###
615 !! test
616 Italics and bold: 2-quote opening sequence: (2,2)
617 !! wikitext
618 ''foo''
619 !! html
620 <p><i>foo</i>
621 </p>
622 !!end
623
624 !! test
625 Italics and bold: 2-quote opening sequence: (2,3)
626 !! wikitext
627 ''foo'''
628 !! html/*
629 <p><i>foo'</i>
630 </p>
631 !!end
632
633 !! test
634 Italics and bold: 2-quote opening sequence: (2,4)
635 !! options
636 parsoid=wt2html
637 !! wikitext
638 ''foo''''
639 !! html/*
640 <p><i>foo''</i>
641 </p>
642 !!end
643
644 # same html as previous, but wikitext adjusted to match parsoid html2wt
645 !! test
646 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
647 !! wikitext
648 ''foo<nowiki>''</nowiki>''
649 !! html
650 <p><i>foo''</i>
651 </p>
652 !! end
653
654 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,5)
657 !! options
658 parsoid=wt2html
659 !! wikitext
660 ''foo'''''
661 !! html/php
662 <p><i>foo</i>
663 </p>
664 !! html/parsoid
665 <p><i>foo</i><b></b>
666 </p>
667 !!end
668
669 # same html as previous, but wikitext adjusted to match parsoid html2wt
670 !! test
671 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
672 !! wikitext
673 ''foo'''''<nowiki/>'''
674 !! html/php
675 <p><i>foo</i>
676 </p>
677 !! html/parsoid
678 <p><i>foo</i><b></b>
679 </p>
680 !! end
681
682
683 ###
684 ### 3-quote opening sequence tests
685 ###
686
687 !! test
688 Italics and bold: 3-quote opening sequence: (3,2)
689 !! wikitext
690 '''foo''
691 !! html/*
692 <p>'<i>foo</i>
693 </p>
694 !!end
695
696 !! test
697 Italics and bold: 3-quote opening sequence: (3,3)
698 !! wikitext
699 '''foo'''
700 !! html
701 <p><b>foo</b>
702 </p>
703 !!end
704
705 !! test
706 Italics and bold: 3-quote opening sequence: (3,4)
707 !! wikitext
708 '''foo''''
709 !! html/*
710 <p><b>foo'</b>
711 </p>
712 !!end
713
714 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
715 !! test
716 Italics and bold: 3-quote opening sequence: (3,5)
717 !! options
718 parsoid=wt2html
719 !! wikitext
720 '''foo'''''
721 !! html/php
722 <p><b>foo</b>
723 </p>
724 !! html/parsoid
725 <p><b>foo</b><i></i>
726 </p>
727 !!end
728
729 # same html as previous, but wikitext adjusted to match parsoid html2wt
730 !! test
731 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
732 !! wikitext
733 '''foo'''''<nowiki/>''
734 !! html/php
735 <p><b>foo</b>
736 </p>
737 !! html/parsoid
738 <p><b>foo</b><i></i>
739 </p>
740 !! end
741
742
743 ###
744 ### 4-quote opening sequence tests
745 ###
746
747 !! test
748 Italics and bold: 4-quote opening sequence: (4,2)
749 !! options
750 parsoid=wt2html
751 !! wikitext
752 ''''foo''
753 !! html/*
754 <p>''<i>foo</i>
755 </p>
756 !!end
757
758 # same html as previous, but wikitext adjusted to match parsoid html2wt
759 !! test
760 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
761 !! wikitext
762 <nowiki>''</nowiki>''foo''
763 !! html
764 <p>''<i>foo</i>
765 </p>
766 !! end
767
768 !! test
769 Italics and bold: 4-quote opening sequence: (4,3)
770 !! wikitext
771 ''''foo'''
772 !! html/*
773 <p>'<b>foo</b>
774 </p>
775 !!end
776
777 !! test
778 Italics and bold: 4-quote opening sequence: (4,4)
779 !! options
780 parsoid=wt2html
781 !! wikitext
782 ''''foo''''
783 !! html/*
784 <p>'<b>foo'</b>
785 </p>
786 !!end
787
788 # same html as previous, but wikitext adjusted to match parsoid html2wt
789 !! test
790 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
791 !! wikitext
792 '<nowiki/>'''foo''''
793 !! html
794 <p>'<b>foo'</b>
795 </p>
796 !! end
797
798 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,5)
801 !! options
802 parsoid=wt2html
803 !! wikitext
804 ''''foo'''''
805 !! html/php
806 <p>'<b>foo</b>
807 </p>
808 !! html/parsoid
809 <p>'<b>foo</b><i></i>
810 </p>
811 !!end
812
813 # same html as previous, but wikitext adjusted to match parsoid html2wt
814 !! test
815 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
816 !! wikitext
817 '<nowiki/>'''foo'''''<nowiki/>''
818 !! html/php
819 <p>'<b>foo</b>
820 </p>
821 !! html/parsoid
822 <p>'<b>foo</b><i></i>
823 </p>
824 !! end
825
826
827 ###
828 ### 5-quote opening sequence tests
829 ###
830
831 !! test
832 Italics and bold: 5-quote opening sequence: (5,2)
833 !! options
834 parsoid=wt2html
835 !! wikitext
836 '''''foo''
837 !! html/*
838 <p><b><i>foo</i></b>
839 </p>
840 !!end
841
842 # same html as previous, but wikitext adjusted to match parsoid html2wt
843 !! test
844 Italics and bold: 5-quote opening sequence: (5,2+3)
845 !! wikitext
846 '''''foo'''''
847 !! html/*
848 <p><i><b>foo</b></i>
849 </p>
850 !! end
851
852 !! test
853 Italics and bold: 5-quote opening sequence: (5,3)
854 !! options
855 parsoid=wt2html
856 !! wikitext
857 '''''foo'''
858 !! html/*
859 <p><i><b>foo</b></i>
860 </p>
861 !!end
862
863 # same html as previous, but wikitext adjusted to match parsoid html2wt
864 !! test
865 Italics and bold: 5-quote opening sequence: (5,3+2)
866 !! wikitext
867 '''''foo'''''
868 !! html
869 <p><i><b>foo</b></i>
870 </p>
871 !! end
872
873 !! test
874 Italics and bold: 5-quote opening sequence: (5,4)
875 !! options
876 parsoid=wt2html
877 !! wikitext
878 '''''foo''''
879 !! html/*
880 <p><i><b>foo'</b></i>
881 </p>
882 !!end
883
884 !! test
885 Italics and bold: 5-quote opening sequence: (5,5)
886 !! wikitext
887 '''''foo'''''
888 !! html
889 <p><i><b>foo</b></i>
890 </p>
891 !!end
892
893 !! test
894 Italics and bold: 5-quote opening sequence: (5,6)
895 !! wikitext
896 '''''foo''''''
897 !! html/*
898 <p><i><b>foo'</b></i>
899 </p>
900 !! end
901
902 ###
903 ### multiple quote sequences in a line
904 ###
905 !! test
906 Italics and bold: multiple quote sequences: (2,4,2)
907 !! options
908 parsoid=wt2html
909 !! wikitext
910 ''foo''''bar''
911 !! html/*
912 <p><i>foo'<b>bar</b></i>
913 </p>
914 !!end
915
916
917 # same html as previous, but wikitext adjusted to match parsoid html2wt
918 !! test
919 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
920 !! wikitext
921 ''foo'<nowiki/>'''bar'''''
922 !! html
923 <p><i>foo'<b>bar</b></i>
924 </p>
925 !! end
926
927
928 !! test
929 Italics and bold: multiple quote sequences: (2,4,3)
930 !! options
931 parsoid=wt2html
932 !! wikitext
933 ''foo''''bar'''
934 !! html/*
935 <p><i>foo'<b>bar</b></i>
936 </p>
937 !!end
938
939
940 # same html as previous, but wikitext adjusted to match parsoid html2wt
941 !! test
942 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
943 !! wikitext
944 ''foo'<nowiki/>'''bar'''''
945 !! html
946 <p><i>foo'<b>bar</b></i>
947 </p>
948 !! end
949
950
951 !! test
952 Italics and bold: multiple quote sequences: (2,4,4)
953 !! options
954 parsoid=wt2html
955 !! wikitext
956 ''foo''''bar''''
957 !! html/*
958 <p><i>foo'<b>bar'</b></i>
959 </p>
960 !!end
961
962
963 # same html as previous, but wikitext adjusted to match parsoid html2wt
964 !! test
965 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
966 !! wikitext
967 ''foo'<nowiki/>'''bar'<nowiki/>'''''
968 !! html
969 <p><i>foo'<b>bar'</b></i>
970 </p>
971 !! end
972
973
974 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
975 !! test
976 Italics and bold: multiple quote sequences: (3,4,2)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 '''foo''''bar''
981 !! html/php
982 <p><b>foo'</b>bar
983 </p>
984 !! html/parsoid
985 <p><b>foo'</b>bar<i></i>
986 </p>
987 !!end
988
989 # same html as previous, but wikitext adjusted to match parsoid html2wt
990 !! test
991 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
992 !! options
993 parsoid
994 !! wikitext
995 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
996 !! html/php
997 <p><b>foo'</b>bar
998 </p>
999 !! html/parsoid
1000 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1001 </p>
1002 !! end
1003
1004
1005 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,3)
1008 !! options
1009 parsoid=wt2html
1010 !! wikitext
1011 '''foo''''bar'''
1012 !! html/php
1013 <p><b>foo'</b>bar
1014 </p>
1015 !! html/parsoid
1016 <p><b>foo'</b>bar<b></b>
1017 </p>
1018 !!end
1019
1020 # same html as previous, but wikitext adjusted to match parsoid html2wt
1021 !! test
1022 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1023 !! wikitext
1024 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1025 !! html/php
1026 <p><b>foo'</b>bar
1027 </p>
1028 !! html/parsoid
1029 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1030 </p>
1031 !! end
1032
1033 ###
1034 ### other quote tests
1035 ###
1036 !! test
1037 Italics and bold: other quote tests: (2,3,5)
1038 !! wikitext
1039 ''this is about '''foo's family'''''
1040 !! html
1041 <p><i>this is about <b>foo's family</b></i>
1042 </p>
1043 !!end
1044
1045
1046 !! test
1047 Italics and bold: other quote tests: (2,(3,3),2)
1048 !! wikitext
1049 ''this is about '''foo's''' family''
1050 !! html
1051 <p><i>this is about <b>foo's</b> family</i>
1052 </p>
1053 !!end
1054
1055
1056 !! test
1057 Italics and bold: other quote tests: (3,2,3,2)
1058 !! options
1059 parsoid=wt2html
1060 !! wikitext
1061 '''this is about ''foo'''s family''
1062 !! html/*
1063 <p><b>this is about <i>foo</i></b><i>s family</i>
1064 </p>
1065 !!end
1066
1067
1068 # same html as previous, but wikitext adjusted to match parsoid html2wt
1069 !! test
1070 Italics and bold: other quote tests: (3,2,3+2+2,2)
1071 !! wikitext
1072 '''this is about ''foo'''''<nowiki/>''s family''
1073 !! html
1074 <p><b>this is about <i>foo</i></b><i>s family</i>
1075 </p>
1076 !! end
1077
1078
1079 !! test
1080 Italics and bold: other quote tests: (3,2,3,3)
1081 !! wikitext
1082 '''this is about ''foo'''s family'''
1083 !! html/*
1084 <p>'<i>this is about </i>foo<b>s family</b>
1085 </p>
1086 !!end
1087
1088
1089 !! test
1090 Italics and bold: other quote tests: (3,(2,2),3)
1091 !! wikitext
1092 '''this is about ''foo's'' family'''
1093 !! html
1094 <p><b>this is about <i>foo's</i> family</b>
1095 </p>
1096 !!end
1097
1098
1099 !! test
1100 Italicized possessive
1101 !! wikitext
1102 The ''[[Main Page]]'''s talk page.
1103 !! html/php
1104 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1105 </p>
1106 !! html/parsoid
1107 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1108 !! end
1109
1110 !! test
1111 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1112 (Requires tidy for PHP parser output to be fixed up)
1113 !! options
1114 parsoid=wt2html,wt2wt
1115 !! wikitext
1116 {|
1117 !''a!!''b
1118 |''a||''b
1119 |}
1120 !! html/php+tidy
1121 <table>
1122 <tr>
1123 <th><i>a</i></th>
1124 <th><i>b</i></th>
1125 <td><i>a</i></td>
1126 <td><i>b</i></td>
1127 </tr>
1128 </table>
1129 !! html/parsoid
1130 <table>
1131 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1132 <td><i>a</i></td><td><i>b</i></td></tr>
1133 </tbody></table>
1134 !! end
1135
1136 ###
1137 ### Non-html5 tags
1138 ###
1139
1140 !! test
1141 Non-html5 tags should be accepted
1142 !! wikitext
1143 <center>''foo''</center>
1144 <big>''foo''</big>
1145 <font>''foo''</font>
1146 <strike>''foo''</strike>
1147 <tt>''foo''</tt>
1148 !! html
1149 <center><i>foo</i></center>
1150 <p><big><i>foo</i></big>
1151 <font><i>foo</i></font>
1152 <strike><i>foo</i></strike>
1153 <tt><i>foo</i></tt>
1154 </p>
1155 !! end
1156
1157 !! test
1158 <wbr> is valid wikitext (bug 52468)
1159 !! wikitext
1160 <wbr>
1161 !! html
1162 <p><wbr />
1163 </p>
1164 !! end
1165
1166 # <strike> is HTML4, <s> is HTML4/5.
1167 !! test
1168 <s> or <strike> for strikethrough
1169 !! wikitext
1170 <strike>strike</strike>
1171
1172 <s>s</s>
1173 !! html
1174 <p><strike>strike</strike>
1175 </p><p><s>s</s>
1176 </p>
1177 !! end
1178
1179 ## a not permitted
1180 ## i,b,br omitted
1181 !! test
1182 Text-level semantic html elements in wikitext
1183 !! wikitext
1184 <em>text</em>
1185 <strong>text</strong>
1186 <small>text</small>
1187 <s>text</s>
1188 <cite>text</cite>
1189 <q>text</q>
1190 <dfn>text</dfn>
1191 <abbr>text</abbr>
1192 <data>text</data>
1193 <time>text</time>
1194 <code>text</code>
1195 <var>text</var>
1196 <samp>text</samp>
1197 <kbd>text</kbd>
1198 <sub>text</sub>
1199 <u>text</u>
1200 <mark>text</mark>
1201 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1202 <bdi>text</bdi>
1203 <bdo>text</bdo>
1204 <span>text</span>
1205 <wbr />
1206 !! html
1207 <p><em>text</em>
1208 <strong>text</strong>
1209 <small>text</small>
1210 <s>text</s>
1211 <cite>text</cite>
1212 <q>text</q>
1213 <dfn>text</dfn>
1214 <abbr>text</abbr>
1215 <data>text</data>
1216 <time>text</time>
1217 <code>text</code>
1218 <var>text</var>
1219 <samp>text</samp>
1220 <kbd>text</kbd>
1221 <sub>text</sub>
1222 <u>text</u>
1223 <mark>text</mark>
1224 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1225 <bdi>text</bdi>
1226 <bdo>text</bdo>
1227 <span>text</span>
1228 <wbr />
1229 </p>
1230 !! end
1231
1232 # test cases taken from
1233 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1234 !! test
1235 Ruby markup (W3C-style)
1236 !! wikitext
1237 ; Mono-ruby for individual base characters
1238 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1239 ; Group ruby
1240 : <ruby>今日<rt>きょう</rt></ruby>
1241 ; Jukugo ruby
1242 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1243 ; Inline ruby
1244 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1245 ; Double-sided ruby
1246 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1247 <ruby>
1248 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1249 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1250 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1251 </ruby>
1252 !! html
1253 <dl><dt> Mono-ruby for individual base characters</dt>
1254 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1255 <dt> Group ruby</dt>
1256 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1257 <dt> Jukugo ruby</dt>
1258 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1259 <dt> Inline ruby</dt>
1260 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1261 <dt> Double-sided ruby</dt>
1262 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1263 <p><ruby>
1264 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1265 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1266 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1267 </ruby>
1268 </p>
1269 !! end
1270
1271 # The next two test different paths in the sanitizer.
1272 !! test
1273 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1274 !! wikitext
1275 <blockquote|>a</blockquote>
1276
1277 <b→> doesn't terminate </b→>
1278
1279 <bä> doesn't terminate </bä>
1280
1281 <boo> doesn't terminate </boo>
1282
1283 <s.foo> doesn't terminate </s.foo>
1284
1285 <sub-ID#1>
1286 !! html
1287 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1288 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1289 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1290 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1291 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1292 </p><p>&lt;sub-ID#1&gt;
1293 </p>
1294 !! end
1295
1296 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1297 # If the non-word-character tag made it through the sanitizer, tidy
1298 # would munge it up.
1299 !! test
1300 Non-word characters don't terminate tag names + tidy
1301 !! wikitext
1302 <blockquote|>a</blockquote>
1303
1304 <b→> doesn't terminate </b→>
1305
1306 <bä> doesn't terminate </bä>
1307
1308 <boo> doesn't terminate </boo>
1309
1310 <s.foo> doesn't terminate </s.foo>
1311
1312 <sub-ID#1>
1313 !! html+tidy
1314 <p>&lt;blockquote|&gt;a</p>
1315 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1316 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1317 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1318 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1319 <p>&lt;sub-ID#1&gt;</p>
1320 !! end
1321
1322 ###
1323 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1324 ### This checks that HTML5 tags (with non-word characters in the tag
1325 ### name) make it safely through the parser -- the Sanitizer will
1326 ### munge them later, as it should.
1327 ###
1328 !! test
1329 Non-word characters are valid in extension tags (T19663)
1330 !! wikitext
1331 <tåg>tåg</tåg>
1332 !! html/php
1333 <pre>
1334 'tåg'
1335 array (
1336 )
1337 </pre>
1338
1339 !! html/parsoid
1340 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1341 !! end
1342
1343 !! test
1344 Isolated close tags should be treated as literal text (bug 52760)
1345 !! options
1346 parsoid=wt2html
1347 !! wikitext
1348 </b>
1349
1350 <s.foo>s</s>
1351 !! html/php+tidy
1352 <p>&lt;s.foo&gt;s</p>
1353 !! html/parsoid
1354 <p>&lt;s.foo&gt;s</p>
1355 !! end
1356
1357 ###
1358 ### Special characters
1359 ###
1360
1361 !! test
1362 Bare pipe character (bug 52363)
1363 !! wikitext
1364 |
1365 !! html
1366 <p>|
1367 </p>
1368 !! end
1369
1370 !! test
1371 Bare pipe character from a template (bug 52363)
1372 !! wikitext
1373 {{pipe}}
1374 !! html
1375 <p>|
1376 </p>
1377 !! end
1378
1379 ###
1380 ### <nowiki> test cases
1381 ###
1382
1383 !! test
1384 <nowiki> unordered list
1385 !! wikitext
1386 <nowiki>* This is not an unordered list item.</nowiki>
1387 !! html/php
1388 <p>* This is not an unordered list item.
1389 </p>
1390 !! html/parsoid
1391 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1392 !! end
1393
1394 !! test
1395 <nowiki> spacing
1396 !! wikitext
1397 <nowiki>Lorem ipsum dolor
1398
1399 sed abit.
1400 sed nullum.
1401
1402 :and a colon
1403 </nowiki>
1404 !! html/php
1405 <p>Lorem ipsum dolor
1406
1407 sed abit.
1408 sed nullum.
1409
1410 :and a colon
1411
1412 </p>
1413 !! html/parsoid
1414 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1415
1416 sed abit.
1417 sed nullum.
1418
1419 :and a colon
1420 </span></p>
1421 !! end
1422
1423 !! test
1424 nowiki 3
1425 !! wikitext
1426 :There is not nowiki.
1427 :There is <nowiki>nowiki</nowiki>.
1428
1429 #There is not nowiki.
1430 #There is <nowiki>nowiki</nowiki>.
1431
1432 *There is not nowiki.
1433 *There is <nowiki>nowiki</nowiki>.
1434 !! html/php
1435 <dl><dd>There is not nowiki.</dd>
1436 <dd>There is nowiki.</dd></dl>
1437 <ol><li>There is not nowiki.</li>
1438 <li>There is nowiki.</li></ol>
1439 <ul><li>There is not nowiki.</li>
1440 <li>There is nowiki.</li></ul>
1441
1442 !! html/parsoid
1443 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1444 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1445
1446 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1447 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1448
1449 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1450 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1451 !! end
1452
1453 !! test
1454 Entities inside <nowiki>
1455 !! wikitext
1456 <nowiki>&lt;</nowiki>
1457 !! html
1458 <p>&lt;
1459 </p>
1460 !! end
1461
1462 !! test
1463 Entities inside template parameters
1464 !! wikitext
1465 {{echo|&ndash;}}
1466 !! html/php+tidy
1467 <p>–</p>
1468 !! html/parsoid
1469 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1470 !! end
1471
1472 !! test
1473 Properly escape nowiki when combined with other wiki markup
1474 !! options
1475 parsoid=html2wt
1476 !! html/parsoid
1477 <p>* &lt;/nowiki&gt; tag</p>
1478 !! wikitext
1479 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1480 !! end
1481
1482 !! test
1483 T93824: Put escaped HTML tags inside nowiki
1484 !! options
1485 parsoid=html2wt
1486 !! html/parsoid
1487 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1488 !! wikitext
1489 <nowiki><h2>foo</h2></nowiki>
1490 !! end
1491
1492 !! test
1493 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1494 !! options
1495 parsoid=html2wt
1496 !! html/parsoid
1497 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1499 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1500 !! wikitext
1501 This text: L'[[Foo]]
1502 This text: L<nowiki>''</nowiki>[[Foo]]
1503 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1504 !! end
1505
1506 # This test fails because wikitext whitespace is not normalized before comparing.
1507 !! test
1508 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1509 !! options
1510 parsoid=html2wt
1511 !! html/parsoid
1512 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1513 </p>
1514 !! wikitext
1515 This text : L<nowiki>''</nowiki>[[Foo]]
1516 !! end
1517
1518 # This test and the next one are html2wt only as they test that incorrect wikitext
1519 # passed in template arguments gets escaped or wrapped in nowikis where required.
1520 !! test
1521 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1522 !! options
1523 parsoid=html2wt
1524 !! html/parsoid
1525 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1526 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1527 !! wikitext
1528 {{echo|foo{{!}}bar}}
1529 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1530 !! end
1531
1532 !! test
1533 T53961: Output correct nowikis in template arguments
1534 !! options
1535 parsoid=html2wt
1536 !! html/parsoid
1537 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1538 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1539 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1540 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1541 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1542 !! wikitext
1543 {{echo|a [ b}}
1544 {{echo|a <nowiki>}}</nowiki> b}}
1545 {{echo|<nowiki>a [[ b</nowiki>}}
1546 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1547 {{echo|a <nowiki>}</nowiki>}}
1548 !! end
1549
1550 !! test
1551 Cases where "!!" needs nowiki protection
1552 !! options
1553 parsoid=html2wt
1554 !! html/parsoid
1555 <table>
1556 <tr><th>this needs protection !! here</th></tr>
1557 </table>
1558
1559 <table>
1560 <tr><th>this does not need
1561 protection !! here</th></tr>
1562 </table>
1563 !! wikitext
1564 {|
1565 !<nowiki>this needs protection !! here</nowiki>
1566 |}
1567
1568 {|
1569 !this does not need
1570 protection !! here
1571 |}
1572 !! end
1573
1574 ###
1575 ### Comments
1576 ###
1577 !! test
1578 Comments and Indent-Pre
1579 !! wikitext
1580 <!-- comment 1 --> asdf
1581
1582 <!-- comment 1 --> asdf
1583 <!-- comment 2 -->
1584
1585 <!-- comment 1 --> asdf
1586 <!-- comment 2 -->xyz
1587
1588 <!-- comment 1 --> asdf
1589 <!-- comment 2 --> xyz
1590 !! html
1591 <pre>asdf
1592 </pre>
1593 <pre>asdf
1594 </pre>
1595 <pre>asdf
1596 </pre>
1597 <p>xyz
1598 </p>
1599 <pre>asdf
1600 xyz
1601 </pre>
1602 !! end
1603
1604 !! test
1605 Comment test 2a
1606 !! wikitext
1607 asdf
1608 <!-- comment 1 -->
1609 jkl
1610 !! html
1611 <p>asdf
1612 jkl
1613 </p>
1614 !! end
1615
1616 !! test
1617 Comment test 2b
1618 !! wikitext
1619 asdf
1620 <!-- comment 1 -->
1621
1622 jkl
1623 !! html
1624 <p>asdf
1625 </p><p>jkl
1626 </p>
1627 !! end
1628
1629 !! test
1630 Comment test 3
1631 !! wikitext
1632 asdf
1633 <!-- comment 1 -->
1634 <!-- comment 2 -->
1635 jkl
1636 !! html
1637 <p>asdf
1638 jkl
1639 </p>
1640 !! end
1641
1642 !! test
1643 Comment test 4
1644 !! wikitext
1645 asdf<!-- comment 1 -->jkl
1646 !! html
1647 <p>asdfjkl
1648 </p>
1649 !! end
1650
1651 !! test
1652 Comment spacing
1653 !! wikitext
1654 a
1655 <!-- foo --> b <!-- bar -->
1656 c
1657 !! html
1658 <p>a
1659 </p>
1660 <pre> b
1661 </pre>
1662 <p>c
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment whitespace
1668 !! wikitext
1669 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1670 !! html
1671
1672 !! end
1673
1674 !! test
1675 Comment semantics and delimiters
1676 !! wikitext
1677 <!-- --><!----><!-----><!------>
1678 !! html/php
1679
1680 !! html/parsoid
1681 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1682 !! end
1683
1684 !! test
1685 Comment semantics and delimiters, redux
1686 !! wikitext
1687 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1688 -- foo -- funky huh? ... -->
1689 !! html/php
1690
1691 !! html/parsoid
1692 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1693 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1694 !! end
1695
1696 !! test
1697 Comment semantics and delimiters: directors cut
1698 !! wikitext
1699 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1700 everything starting with < followed by !-- until the first -- and > we see,
1701 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1702 -->-->
1703 !! html/php
1704 <p>--&gt;
1705 </p>
1706 !! html/parsoid
1707 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1708 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1709 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1710 --><p>--></p>
1711 !! end
1712
1713 !! test
1714 Comment semantics: nesting
1715 !! wikitext
1716 <!--<!-- no, we're not going to do anything fancy here -->-->
1717 !! html/php
1718 <p>--&gt;
1719 </p>
1720 !! html/parsoid
1721 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1722 !! end
1723
1724 # Parsoid closes the unclosed comment, even if it means a slight
1725 # round-trip diff.
1726 !! test
1727 Comment semantics: unclosed comment at end
1728 !! options
1729 parsoid=wt2html,html2html
1730 !! wikitext
1731 <!--This comment will run out to the end of the document
1732 !! html/php
1733
1734 !! html/parsoid
1735 <!--This comment will run out to the end of the document-->
1736 !! end
1737
1738 !! test
1739 Comment semantics: normalize comments to play nice with XML and browsers
1740 !! wikitext
1741 <!-- Browsers --!> think this is closed -->
1742 <!--> This would normally be text -->
1743 <!---> As would this -->
1744 <!-- XML doesn't like trailing dashes -------->
1745 <!-- Nor doubled hyphens -- anywhere in the data -->
1746 But this is not a comment.
1747 !! html/php
1748 <p>But this is not a comment.
1749 </p>
1750 !! html/parsoid
1751 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1752 <!--&#x3E; This would normally be text -->
1753 <!--&#x2D;&#x3E; As would this -->
1754 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1755 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1756 <p>But this is not a comment.</p>
1757 !! end
1758
1759 !! test
1760 Comment semantics: round-trip even text which contains encoded -->
1761 !! wikitext
1762 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1763 !! html/parsoid
1764 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1765 !! end
1766
1767 !! test
1768 Comment in template title
1769 !! wikitext
1770 {{f<!---->oo}}
1771 !! html
1772 <p>FOO
1773 </p>
1774 !! end
1775
1776 !! test
1777 Comment on its own line post-expand
1778 !! wikitext
1779 a
1780 {{blank}}<!---->
1781 b
1782 !! html
1783 <p>a
1784 </p><p>b
1785 </p>
1786 !! end
1787
1788 !! test
1789 Comment on its own line post-expand with non-significant whitespace
1790 !! wikitext
1791 a
1792 {{blank}} <!---->
1793 b
1794 !! html
1795 <p>a
1796 </p><p>b
1797 </p>
1798 !! end
1799
1800 !! test
1801 Multiple comments should still parse as SOL-transparent
1802 !! options
1803 parsoid=wt2html,wt2wt
1804 !! wikitext
1805 <!--c1-->*a
1806 <!--c2--><!--c3--><!--c4-->*b
1807 !! html/php
1808 <ul><li>a</li>
1809 <li>b</li></ul>
1810
1811 !! html/parsoid
1812 <!--c1--><ul>
1813 <li>a
1814 </li>
1815 <!--c2--><!--c3--><!--c4-->
1816 <li>b
1817 </li>
1818 </ul>
1819 !! end
1820
1821 ###
1822 ### paragraph wrapping tests
1823 ###
1824 !! test
1825 No block tags
1826 !! wikitext
1827 a
1828
1829 b
1830 !! html
1831 <p>a
1832 </p><p>b
1833 </p>
1834 !! end
1835
1836 !! test
1837 Block tag on one line (<div>)
1838 !! wikitext
1839 a <div>foo</div>
1840
1841 b
1842 !! html
1843 a <div>foo</div>
1844 <p>b
1845 </p>
1846 !! html+tidy
1847 <p>a</p>
1848 <div>foo</div>
1849 <p>b</p>
1850 !! end
1851
1852 !! test
1853 Block tag on one line (<blockquote>)
1854 !! wikitext
1855 a <blockquote>foo</blockquote>
1856
1857 b
1858 !! html
1859 a <blockquote>foo</blockquote>
1860 <p>b
1861 </p>
1862 !! html+tidy
1863 <p>a</p>
1864 <blockquote>
1865 <p>foo</p>
1866 </blockquote>
1867 <p>b</p>
1868 !! end
1869
1870 !! test
1871 Block tag on both lines (<div>)
1872 !! wikitext
1873 a <div>foo</div>
1874
1875 b <div>foo</div>
1876 !! html
1877 a <div>foo</div>
1878 b <div>foo</div>
1879
1880 !! html+tidy
1881 <p>a</p>
1882 <div>foo</div>
1883 <p>b</p>
1884 <div>foo</div>
1885 !! end
1886
1887 !! test
1888 Block tag on both lines (<blockquote>)
1889 !! wikitext
1890 a <blockquote>foo</blockquote>
1891
1892 b <blockquote>foo</blockquote>
1893 !! html
1894 a <blockquote>foo</blockquote>
1895 b <blockquote>foo</blockquote>
1896
1897 !! html+tidy
1898 <p>a</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 <p>b</p>
1903 <blockquote>
1904 <p>foo</p>
1905 </blockquote>
1906 !! end
1907
1908 !! test
1909 Multiple lines without block tags
1910 !! wikitext
1911 <div>foo</div> a
1912 b
1913 c
1914 d<!--foo--> e
1915 x <div>foo</div> z
1916 !! html
1917 <div>foo</div> a
1918 <p>b
1919 c
1920 d e
1921 </p>
1922 x <div>foo</div> z
1923
1924 !! html+tidy
1925 <div>foo</div>
1926 <p>a</p>
1927 <p>b c d e</p>
1928 <p>x</p>
1929 <div>foo</div>
1930 <p>z</p>
1931 !! end
1932
1933 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1934 # So, we have a separate section for Parsoid. We don't want
1935 # to mimic this stripping behavior in Parsoid. It affects
1936 # editing experience and also requires us to maintain additional
1937 # info for RT-ing.
1938 !! test
1939 Empty lines between lines with block tags
1940 !! wikitext
1941 <div></div>
1942
1943
1944 <div></div>a
1945
1946 b
1947 <div>a</div>b
1948
1949 <div>b</div>d
1950
1951
1952 <div>e</div>
1953 !! html
1954 <div></div>
1955 <p><br />
1956 </p>
1957 <div></div>a
1958 <p>b
1959 </p>
1960 <div>a</div>b
1961 <div>b</div>d
1962 <p><br />
1963 </p>
1964 <div>e</div>
1965
1966 !! html+tidy
1967 <p><br /></p>
1968 <p>a</p>
1969 <p>b</p>
1970 <div>a</div>
1971 <p>b</p>
1972 <div>b</div>
1973 <p>d</p>
1974 <p><br /></p>
1975 <div>e</div>
1976 !! html/parsoid
1977 <div data-parsoid='{"stx":"html"}'></div>
1978
1979 <p><br /></p>
1980 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1981
1982 <p>b</p>
1983 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1984
1985 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1986
1987 <p><br /></p>
1988 <div data-parsoid='{"stx":"html"}'>e</div>
1989 !! end
1990
1991 ## PHP parser emits output which is broken
1992 !! test
1993 Unclosed HTML p-tags should be handled properly
1994 !! wikitext
1995 <div><p>foo</div>
1996 a
1997
1998 b
1999 !! html/php+tidy
2000 <div>
2001 <p>foo</p>
2002 </div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! html/parsoid
2006 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2007 <p>a</p>
2008 <p>b</p>
2009 !! end
2010
2011 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2012 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2013 ## them for now.
2014 !! test
2015 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2016 !! options
2017 parsoid=wt2html
2018 !! wikitext
2019 a [[Category:A1]] [[Category:A2]]
2020 [[Category:A3]]
2021 [[Category:A4]]
2022 !! html/parsoid
2023 <p>a</p>
2024 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2025 !! end
2026
2027 !! test
2028 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2029 !! options
2030 parsoid=wt2html
2031 !! wikitext
2032 [[Category:A1]]a
2033 !! html/parsoid
2034 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2035 !! end
2036
2037 ###
2038 ### Preformatted text
2039 ###
2040 !! test
2041 Preformatted text
2042 !! wikitext
2043 This is some
2044 Preformatted text
2045 With ''italic''
2046 And '''bold'''
2047 And a [[Main Page|link]]
2048 !! html
2049 <pre>This is some
2050 Preformatted text
2051 With <i>italic</i>
2052 And <b>bold</b>
2053 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2054 </pre>
2055 !! end
2056
2057 !! test
2058 Tabs don't trigger preformatted text
2059 !! wikitext
2060 This is not
2061 preformatted text.
2062 This is preformatted text.
2063 So is this.
2064 !! html/php
2065 <p> This is not
2066 preformatted text.
2067 </p>
2068 <pre>This is preformatted text.
2069 So is this.
2070 </pre>
2071 !! html/parsoid
2072 <p> This is not
2073 preformatted text.</p>
2074 <pre>This is preformatted text.
2075 So is this.</pre>
2076 !! end
2077
2078 !! test
2079 Space before tab needs nowiki pre protection
2080 !! options
2081 parsoid=html2wt
2082 !! html/parsoid
2083 <p> a</p>
2084 !! wikitext
2085 <nowiki> </nowiki> a
2086 !! end
2087
2088 !! test
2089 Ident preformatting with inline content
2090 !! wikitext
2091 a
2092 ''b''
2093 !! html
2094 <pre>a
2095 <i>b</i>
2096 </pre>
2097 !! end
2098
2099 !! test
2100 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2101 !! wikitext
2102 <pre><nowiki>
2103 <b>
2104 <cite>
2105 <em>
2106 </nowiki></pre>
2107 !! html
2108 <pre>
2109 &lt;b&gt;
2110 &lt;cite&gt;
2111 &lt;em&gt;
2112 </pre>
2113
2114 !! end
2115
2116 !! test
2117 Regression with preformatted in <center>
2118 !! wikitext
2119 <center>
2120 Blah
2121 </center>
2122 !! html
2123 <center>
2124 <pre>Blah
2125 </pre>
2126 </center>
2127
2128 !! end
2129
2130 !! test
2131 Bug 52763: Preformatted in <blockquote>
2132 !! wikitext
2133 <blockquote>
2134 Blah
2135 {|
2136 |
2137 indented cell (no pre-wrapping!)
2138 |}
2139 </blockquote>
2140 !! html
2141 <blockquote>
2142 <p> Blah
2143 </p>
2144 <table>
2145 <tr>
2146 <td>
2147 <p> indented cell (no pre-wrapping!)
2148 </p>
2149 </td></tr></table>
2150 </blockquote>
2151
2152 !! end
2153
2154 !! test
2155 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2156 !! wikitext
2157 <blockquote>
2158 Foo
2159
2160 Bar
2161 </blockquote>
2162 !! html
2163 <blockquote>
2164 <p>Foo
2165 </p><p>Bar
2166 </p>
2167 </blockquote>
2168
2169 !! end
2170
2171 !! test
2172 Bug 15491: <ins>/<del> in blockquote
2173 !! wikitext
2174 <blockquote>
2175 Foo <del>bar</del> <ins>baz</ins> quux
2176 </blockquote>
2177 !! html
2178 <blockquote>
2179 <p>Foo <del>bar</del> <ins>baz</ins> quux
2180 </p>
2181 </blockquote>
2182
2183 !! end
2184
2185 # Note that the p-wrapping is newline sensitive, which could be
2186 # considered a bug: tidy will wrap only the 'Foo' in the example
2187 # below in a <p> tag. (see comment 23-25 of bug #6200)
2188 !! test
2189 Bug 15491: <ins>/<del> in blockquote (2)
2190 !! wikitext
2191 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2192 </blockquote>
2193 !! html
2194 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2195 </blockquote>
2196
2197 !! html+tidy
2198 <blockquote>
2199 <p>Foo</p>
2200 <del>bar</del> <ins>baz</ins> quux</blockquote>
2201 !! end
2202
2203 !! test
2204 <pre> with attributes (bug 3202)
2205 !! wikitext
2206 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2207 !! html
2208 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2209
2210 !! end
2211
2212 !! test
2213 <pre> with width attribute (bug 3202)
2214 !! wikitext
2215 <pre width="8">Narrow screen goodies</pre>
2216 !! html
2217 <pre width="8">Narrow screen goodies</pre>
2218
2219 !! end
2220
2221 !! test
2222 <pre> with forbidden attribute (bug 3202)
2223 !! wikitext
2224 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2225 !! html
2226 <pre width="8">Narrow screen goodies</pre>
2227
2228 !! end
2229
2230 !! test
2231 Entities inside <pre>
2232 !! wikitext
2233 <pre>&lt;</pre>
2234 !! html
2235 <pre>&lt;</pre>
2236
2237 !! end
2238
2239 !! test
2240 <pre> with forbidden attribute values (bug 3202)
2241 !! wikitext
2242 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2243 !! html
2244 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2245
2246 !! end
2247
2248 !! test
2249 <nowiki> inside <pre> (bug 13238)
2250 !! wikitext
2251 <pre>
2252 <nowiki>
2253 </pre>
2254 <pre>
2255 <nowiki></nowiki>
2256 </pre>
2257 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2258 !! html
2259 <pre>
2260 &lt;nowiki&gt;
2261 </pre>
2262 <pre>
2263
2264 </pre>
2265 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2266
2267 !! end
2268
2269 !! test
2270 <nowiki> and <pre> preference (first one wins)
2271 !! wikitext
2272 <pre>
2273 <nowiki>
2274 </pre>
2275 </nowiki>
2276 </pre>
2277
2278 <nowiki>
2279 <pre>
2280 <nowiki>
2281 </pre>
2282 </nowiki>
2283 </pre>
2284
2285 !! html/php
2286 <pre>
2287 &lt;nowiki&gt;
2288 </pre>
2289 <p>&lt;/nowiki&gt;
2290 &lt;/pre&gt;
2291 </p><p>
2292 &lt;pre&gt;
2293 &lt;nowiki&gt;
2294 &lt;/pre&gt;
2295
2296 &lt;/pre&gt;
2297 </p>
2298 !! html/parsoid
2299 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2300 </pre>
2301 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2302 &lt;/pre></p>
2303
2304 <p><span typeof="mw:Nowiki">
2305 &lt;pre>
2306 &lt;nowiki>
2307 &lt;/pre>
2308 </span>
2309 &lt;/pre></p>
2310 !! end
2311
2312 !! test
2313 </pre> inside nowiki
2314 !! wikitext
2315 <nowiki></pre></nowiki>
2316 !! html
2317 <p>&lt;/pre&gt;
2318 </p>
2319 !! end
2320
2321 # Parsoid doesn't strip empty tags, like Tidy does.
2322 !! test
2323 Empty pre; pre inside other HTML tags (bug 54946)
2324 !! options
2325 parsoid=wt2html,wt2wt
2326 !! wikitext
2327 a
2328
2329 <div><pre>
2330 foo
2331 </pre></div>
2332 <pre></pre>
2333 !! html/php
2334 <p>a
2335 </p>
2336 <div><pre>
2337 foo
2338 </pre></div>
2339 <pre></pre>
2340
2341 !! html/php+tidy
2342 <p>a</p>
2343 <div>
2344 <pre>
2345 foo
2346 </pre></div>
2347 !! html/parsoid
2348 <p>a</p>
2349
2350 <div><pre>foo
2351 </pre></div>
2352 <pre></pre>
2353 !! end
2354
2355 !! test
2356 HTML pre followed by indent-pre
2357 !! wikitext
2358 <pre>foo</pre>
2359 bar
2360 !! html
2361 <pre>foo</pre>
2362 <pre>bar
2363 </pre>
2364 !! end
2365
2366 # Note that tidy removes the empty <p> tags from the start and end.
2367 # Parsoid does not, by design.
2368 !!test
2369 Block tag pre
2370 !! wikitext
2371 <p><pre>foo</pre></p>
2372 !! html/php+tidy
2373 <pre>
2374 foo
2375 </pre>
2376 !! html/parsoid
2377 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2378 !!end
2379
2380 !!test
2381 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2382 !! wikitext
2383 {{echo|}}
2384 !! html
2385
2386 !!end
2387
2388 !!test
2389 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2390 !! wikitext
2391 {{echo|
2392 foo}}
2393 !! html
2394 <p>foo
2395 </p>
2396 !!end
2397
2398 !! test
2399 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2400 !! wikitext
2401 {{echo|a
2402 b}}
2403 !! html
2404 <pre>a
2405 </pre>
2406 <p>b
2407 </p>
2408 !!end
2409
2410 !! test
2411 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2412 !! wikitext
2413 {{echo|a
2414 b
2415 c
2416 d
2417 e
2418 }}
2419 !! html
2420 <pre>a
2421 </pre>
2422 <p>b
2423 c
2424 </p>
2425 <pre>d
2426 </pre>
2427 <p>e
2428 </p>
2429 !!end
2430
2431 !!test
2432 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2433 !! wikitext
2434 {{echo| foo}}
2435
2436 {{echo| foo}}{{echo| bar}}
2437
2438 {{echo| foo}}
2439 {{echo| bar}}
2440
2441 {{echo|<!--cmt--> foo}}
2442
2443 <!--cmt-->{{echo| foo}}
2444
2445 {{echo|{{echo| }}bar}}
2446 !! html
2447 <pre>foo
2448 </pre>
2449 <pre>foo bar
2450 </pre>
2451 <pre>foo
2452 bar
2453 </pre>
2454 <pre>foo
2455 </pre>
2456 <pre>foo
2457 </pre>
2458 <pre>bar
2459 </pre>
2460 !!end
2461
2462 !! test
2463 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2464 !! wikitext
2465 {{echo| }}a
2466
2467 {{echo|
2468 }}a
2469
2470 {{echo|
2471 b}}
2472
2473 {{echo|a
2474 }}b
2475
2476 {{echo|a
2477 }} b
2478 !! html
2479 <pre>a
2480 </pre>
2481 <p><br />
2482 </p>
2483 <pre>a
2484 </pre>
2485 <p><br />
2486 </p>
2487 <pre>b
2488 </pre>
2489 <p>a
2490 </p>
2491 <pre>b
2492 </pre>
2493 <p>a
2494 </p>
2495 <pre>b
2496 </pre>
2497 !!end
2498
2499 !! test
2500 Pres with newline attributes
2501 !! wikitext
2502 <pre class="one
2503 two">hi</pre>
2504 !! html/php
2505 <pre class="one two">hi</pre>
2506
2507 !! html/parsoid
2508 <pre class="one
2509 two" data-parsoid='{"stx":"html"}'>hi</pre>
2510 !! end
2511
2512 !! test
2513 Things that look like <pre> tags aren't treated as such
2514 !! wikitext
2515 Barack Obama <President> of the United States
2516 <President></President>
2517 !! html
2518 <p>Barack Obama &lt;President&gt; of the United States
2519 &lt;President&gt;&lt;/President&gt;
2520 </p>
2521 !! end
2522
2523 ## PHP parser discards the "<pre " string
2524 !! test
2525 Handle broken pre-like tags (bug 64025)
2526 !! options
2527 parsoid=wt2html
2528 !! wikitext
2529 {{echo|<pre <pre>x</pre>}}
2530
2531 <table><pre </table>
2532 !! html/php
2533 <pre>x</pre>
2534 <table><pre></pre></table>
2535
2536 !! html/parsoid
2537 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2538
2539
2540 <p>&lt;pre </p>
2541
2542 <table></table>
2543 !! end
2544
2545 !! test
2546 Parsoid: handle pre with space after attribute
2547 !! options
2548 parsoid=wt2html
2549 !! wikitext
2550 <pre style="width:50%;" >{{echo|foo}}</pre>
2551 !! html/php
2552 <pre style="width:50%;">{{echo|foo}}</pre>
2553
2554 !! html/parsoid
2555 <pre style="width:50%;">{{echo|foo}}</pre>
2556 !! end
2557
2558 # TODO / maybe: fix wt2wt for this
2559 !! test
2560 Parsoid: Don't paragraph-wrap fosterable content
2561 !! options
2562 parsoid=wt2html
2563 !! wikitext
2564 {|
2565 <td></td>
2566 <td></td>
2567
2568
2569
2570 |}
2571 !! html
2572 <table>
2573
2574 <tbody>
2575 <tr>
2576 <td></td>
2577
2578 <td></td></tr>
2579
2580
2581
2582 </tbody></table>
2583 !! end
2584
2585 !! test
2586 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2587 !! options
2588 parsoid=wt2html
2589 !! wikitext
2590 {|
2591 <td>
2592 <td>
2593 </td>
2594
2595
2596
2597 |}
2598 !! html
2599 <table>
2600
2601 <tbody>
2602 <tr>
2603 <td></td>
2604
2605 <td>
2606 </td></tr>
2607
2608
2609
2610 </tbody></table>
2611 !! end
2612
2613
2614 #--------------------------------------------------------------------
2615 # Transclusion parameter whitespace stripping tests
2616 # Behavior is different for positional and named parameters
2617 #--------------------------------------------------------------------
2618 !! test
2619 Templates: Strip leading and trailing whitespace from named-param values
2620 !! wikitext
2621 {{echo|1= a }}
2622
2623 {{echo|1= {{echo|b}} }}
2624
2625 {{echo| 1 =
2626 c }}
2627
2628 {{echo| 1 =
2629 * d
2630 }}
2631 !! html
2632 <p>a
2633 </p><p>b
2634 </p><p>c
2635 </p>
2636 <ul><li> d</li></ul>
2637
2638 !! end
2639
2640 !! test
2641 Templates: Don't strip whitespace from positional-param values
2642 !! wikitext
2643 {{echo|a }}
2644
2645 {{echo|{{echo|b}} }}
2646
2647 {{echo| c
2648 }}
2649
2650 {{echo| {{echo|d}}
2651 }}
2652
2653 {{echo|
2654 e}}
2655
2656 {{echo|
2657 * f}}
2658
2659 {{echo|
2660 }}g
2661 !! html
2662 <p>a
2663 </p><p>b
2664 </p>
2665 <pre>c
2666 </pre>
2667 <p><br />
2668 </p>
2669 <pre>d
2670 </pre>
2671 <p><br />
2672 </p>
2673 <pre>e
2674 </pre>
2675 <p><br />
2676 </p>
2677 <ul><li> f</li></ul>
2678 <p><br />
2679 </p>
2680 <pre>g
2681 </pre>
2682 !! end
2683
2684 !! test
2685 Templates: Handle empty comment-and-ws-only lines correctly
2686 !! wikitext
2687 {{echo|foo
2688 <!--should be ignored-->
2689 <!--should be ignored as well-->
2690 bar}}
2691 !! html
2692 <p>foo
2693 bar
2694 </p>
2695 !! end
2696
2697 !! test
2698 Templates: Handle comments in the target
2699 !! wikitext
2700 {{echo
2701 <!-- should be ignored -->
2702 |foo}}
2703
2704 {{echo<!-- should be ignored -->
2705 |foo}}
2706
2707 {{echo<!-- should be ignored -->|foo}}
2708
2709 {{<!-- should be ignored -->echo|foo}}
2710 !!html/parsoid
2711 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2712
2713 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2714
2715 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2716
2717 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2718 !!end
2719
2720 !! test
2721 Templates: Handle comments in parameter names (bug 67657)
2722 !! wikitext
2723 {{echo|1
2724 <!-- should be ignored -->
2725 =foo}}
2726
2727 {{echo|
2728 <!-- should be ignored -->
2729 1 = foo}}
2730
2731 {{echo|1<!-- should be ignored --> = foo}}
2732
2733 {{echo|<!-- should be ignored -->1 = foo}}
2734 !!html/parsoid
2735 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2736
2737 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2738
2739 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2740
2741 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2742 !!end
2743
2744 !! test
2745 Templates: Other wikitext in parameter names (bug 67657)
2746 !! wikitext
2747 {{echo|''1''=foo}}
2748 !!html/parsoid
2749 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2750 !!html/php
2751 <p>{{{1}}}
2752 </p>
2753 !!end
2754
2755 #--------------------------------------------------------------------
2756 # Transclusion parameter escaping tests
2757 #--------------------------------------------------------------------
2758 !! test
2759 Templates: Parsoid parameter escaping test 1
2760 !! wikitext
2761 {{echo|[foo]|{{echo|[bar]}}}}
2762 !! html/php+tidy
2763 <p>[foo]</p>
2764 !! html/parsoid
2765 <p about="#mwt1" typeof="mw:Transclusion"
2766 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2767 !! end
2768
2769 !! test
2770 Parsoid: Pipes in external links in template parameter
2771 !! wikitext
2772 {{echo|[{{echo|http://example.com}} link]}}
2773 !! html/php+tidy
2774 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2775 !! html/parsoid
2776 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2777 !! end
2778
2779 !! test
2780 Parsoid: pipe in transclusion parameter
2781 !! wikitext
2782 {{echo|http://foo.com/a&#124;b}}
2783 !! html/php+tidy
2784 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2785 !! html/parsoid
2786 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2787 typeof="mw:Transclusion"
2788 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2789 !! end
2790
2791 !! test
2792 Parsoid: Pipe in external link target and content in template parameter
2793 !! options
2794 parsoid=html2wt,wt2wt
2795 !! wikitext
2796 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2797 !! html/php+tidy
2798 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2799 !! html/parsoid
2800 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2801 typeof="mw:Transclusion"
2802 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2803 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2804 !! end
2805
2806 !! test
2807 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2808 !! options
2809 parsoid
2810 !! wikitext
2811 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2812 !! html
2813 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2814 !! end
2815
2816 !! test
2817 Templates: Don't escape already nowiki-escaped text in template parameters
2818 !! options
2819 parsoid=html2wt,wt2wt
2820 !! wikitext
2821 {{echo|foo<nowiki>|</nowiki>bar}}
2822 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2823 {{echo|<nowiki></nowiki>}}
2824 !! html/php+tidy
2825 <p>foo|bar &lt;div&gt;</p>
2826 !! html/parsoid
2827 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2828 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2829 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2830 </p>
2831 !! end
2832
2833 ## Bug 52824
2834 !! test
2835 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2836 !! options
2837 parsoid=html2wt,wt2wt
2838 !! wikitext
2839 {{echo|{{echo|1=bar}}}}
2840 !! html/php+tidy
2841 <p>bar</p>
2842 !! html/parsoid
2843 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2844 !! end
2845
2846 ## Bug 56733
2847 !! test
2848 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2849 !! wikitext
2850 {{echo|a : b}}
2851 !! html/php+tidy
2852 <p>a&#160;: b</p>
2853 !! html/parsoid
2854 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2855 !! end
2856
2857 ## Bug T73412
2858 !! test
2859 Templates: Preserve blank parameter names
2860 !! wikitext
2861 {{echo|=foo}}
2862 !! html/php+tidy
2863 <p>{{{1}}}</p>
2864 !! html/parsoid
2865 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2866 !! end
2867
2868 !! test
2869 Templates: Preserve blank parameter names in other positions
2870 !! wikitext
2871 {{blank_param|bar|=foo}}
2872 !! html/php+tidy
2873 <p>bar foo</p>
2874 !! html/parsoid
2875 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2876 foo</p>
2877 !! end
2878
2879 ###
2880 ### Parsoid-centric tests for testing RT edge cases for pre
2881 ###
2882
2883 !!test
2884 1a. Indent-Pre and Comments
2885 !! wikitext
2886 a
2887 <!--a-->
2888 c
2889 !! html
2890 <pre>a
2891 </pre>
2892 <p>c
2893 </p>
2894 !!end
2895
2896 !!test
2897 1b. Indent-Pre and Comments
2898 !! wikitext
2899 a
2900 <!--a-->
2901 c
2902 !! html
2903 <pre>a
2904 </pre>
2905 <p>c
2906 </p>
2907 !!end
2908
2909 !!test
2910 1c. Indent-Pre and Comments
2911 !! wikitext
2912 <!--a--> a
2913
2914 <!--a--> a
2915 !! html
2916 <pre> a
2917 </pre>
2918 <pre> a
2919 </pre>
2920 !!end
2921
2922 !!test
2923 1d. Indent-Pre and Comments
2924 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2925 !! wikitext
2926 <!--a--> a
2927
2928 <!--b-->b
2929 !! html
2930 <pre>a
2931 </pre>
2932 <pre>b
2933 </pre>
2934 !!end
2935
2936 !!test
2937 2a. Indent-Pre and tables
2938 !! wikitext
2939 {|
2940 |-
2941 !h1!!h2
2942 |foo||bar
2943 |}
2944 !! html
2945 <table>
2946
2947 <tr>
2948 <th>h1</th>
2949 <th>h2
2950 </th>
2951 <td>foo</td>
2952 <td>bar
2953 </td></tr></table>
2954
2955 !!end
2956
2957 !!test
2958 2b. Indent-Pre and tables
2959 !! wikitext
2960 {|
2961 |-
2962 |foo
2963 |}
2964 !! html
2965 <table>
2966
2967 <tr>
2968 <td>foo
2969 </td></tr></table>
2970
2971 !!end
2972
2973 !!test
2974 2c. Indent-Pre and tables (bug 42252)
2975 !! wikitext
2976 {|
2977 |+ foo
2978 ! | bar
2979 |}
2980 !! html
2981 <table>
2982 <caption> foo
2983 </caption>
2984 <tr>
2985 <th> bar
2986 </th></tr></table>
2987
2988 !!end
2989
2990 !!test
2991 2d. Indent-Pre and tables
2992 !! wikitext
2993 a
2994 {|
2995 | b
2996 |}
2997 !! html/php
2998 <pre>a
2999 </pre>
3000 <table>
3001 <tr>
3002 <td> b
3003 </td></tr></table>
3004
3005 !! html/parsoid
3006 <pre>a</pre>
3007 <table>
3008 <tbody><tr><td> b</td></tr>
3009 </tbody></table>
3010 !!end
3011
3012 !!test
3013 2e. Indent-Pre and table-line syntax
3014 !! wikitext
3015 a
3016 | b
3017 | c
3018 !! html/php
3019 <pre>a
3020 | b
3021 | c
3022 </pre>
3023 !!end
3024
3025 !!test
3026 2f. Indent-pre started by table-line syntax
3027 !! wikitext
3028 a
3029 | b
3030 | c
3031 !! html/php
3032 <p>a
3033 </p>
3034 <pre>| b
3035 | c
3036 </pre>
3037 !! html/parsoid
3038 <p>a</p>
3039 <pre>
3040 | b
3041 | c</pre>
3042 !!end
3043
3044 !!test
3045 3a. Indent-Pre and block tags (single-line html)
3046 !! wikitext
3047 a <p> foo </p>
3048 b <div> foo </div>
3049 c <blockquote> foo </blockquote>
3050 <span> foo </span>
3051 !! html
3052 a <p> foo </p>
3053 b <div> foo </div>
3054 c <blockquote> foo </blockquote>
3055 <pre><span> foo </span>
3056 </pre>
3057 !! html/parsoid
3058 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3059 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3060 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3061 <pre><span> foo </span>
3062 </pre>
3063 !! html+tidy
3064 <p>a</p>
3065 <p>foo</p>
3066 <p>b</p>
3067 <div>foo</div>
3068 <p>c</p>
3069 <blockquote>
3070 <p>foo</p>
3071 </blockquote>
3072 <pre>
3073 <span> foo </span>
3074 </pre>
3075 !! end
3076
3077 !!test
3078 3b. Indent-Pre and block tags (multi-line html)
3079 !! wikitext
3080 a <span>foo</span>
3081 b <div> foo </div>
3082 !! html
3083 <pre>a <span>foo</span>
3084 </pre>
3085 b <div> foo </div>
3086
3087 !! html/parsoid
3088 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3089 b <div data-parsoid='{"stx":"html"}'> foo </div>
3090 !! html+tidy
3091 <pre>
3092 a <span>foo</span>
3093 </pre>
3094 <p>b</p>
3095 <div>foo</div>
3096 !!end
3097
3098 !!test
3099 3c. Indent-Pre and block tags (pre-content on separate line)
3100 !! wikitext
3101 <p>
3102 foo
3103 </p>
3104
3105 <div>
3106 foo
3107 </div>
3108
3109 <center>
3110 foo
3111 </center>
3112
3113 <blockquote>
3114 foo
3115 </blockquote>
3116
3117 <blockquote>
3118 <pre>
3119 foo
3120 </pre>
3121 </blockquote>
3122
3123 <table><tr><td>
3124 foo
3125 </td></tr></table>
3126
3127 <ul><li>
3128 foo
3129 </li></ul>
3130
3131 !! html
3132 <p>
3133 foo
3134 </p>
3135 <div>
3136 <pre>foo
3137 </pre>
3138 </div>
3139 <center>
3140 <pre>foo
3141 </pre>
3142 </center>
3143 <blockquote>
3144 <p> foo
3145 </p>
3146 </blockquote>
3147 <blockquote>
3148 <pre>
3149 foo
3150 </pre>
3151 </blockquote>
3152 <table><tr><td>
3153 <pre>foo
3154 </pre>
3155 </td></tr></table>
3156 <ul><li>
3157 foo
3158 </li></ul>
3159
3160 !!end
3161
3162 !!test
3163 4. Indent-Pre and extension tags
3164 !! wikitext
3165 a <gallery>
3166 File:foobar.jpg
3167 </gallery>
3168 !! html
3169 a <ul class="gallery mw-gallery-traditional">
3170 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3171 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3172 <div class="gallerytext">
3173 </div>
3174 </div></li>
3175 </ul>
3176
3177 !! html+tidy
3178 <p>a</p>
3179 <ul class="gallery mw-gallery-traditional">
3180 <li class="gallerybox" style="width: 155px">
3181 <div style="width: 155px">
3182 <div class="thumb" style="width: 150px;">
3183 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3184 </div>
3185 <div class="gallerytext"></div>
3186 </div>
3187 </li>
3188 </ul>
3189 !!end
3190
3191 !! test
3192 Table wikitext syntax outside wiki-tables
3193 !! wikitext
3194 a
3195 ! not a table heading
3196 |- not a table row
3197 | not a table cell
3198 | class="foo bar" | baz
3199 b
3200 |}
3201 |-
3202 c
3203 !! html
3204 <p>a
3205 ! not a table heading
3206 |- not a table row
3207 | not a table cell
3208 | class="foo bar" | baz
3209 b
3210 |}
3211 |-
3212 c
3213 </p>
3214 !! end
3215
3216 !!test
3217 Render paragraphs when indent-pre is suppressed in blocklevels
3218 !! wikitext
3219 <blockquote>
3220 foo
3221
3222 bar
3223 </blockquote>
3224 !! html
3225 <blockquote>
3226 <p> foo
3227 </p><p> bar
3228 </p>
3229 </blockquote>
3230
3231 !!end
3232
3233 !!test
3234 4. Multiple spaces at start-of-line
3235 !! wikitext
3236 <p> foo </p>
3237 foo
3238 {|
3239 |foo
3240 |}
3241 !! html
3242 <p> foo </p>
3243 <pre> foo
3244 </pre>
3245 <table>
3246 <tr>
3247 <td>foo
3248 </td></tr></table>
3249
3250 !!end
3251
3252 ## NOTE: the leading white-space chars on empty line are significant
3253 !! test
3254 5a. White-space in indent-pre
3255 !! wikitext
3256 a<br />
3257
3258 b
3259 !! html
3260 <pre>a<br />
3261
3262 b
3263 </pre>
3264 !! end
3265
3266 ## NOTE: the leading white-space chars on empty line are significant
3267 !! test
3268 5b. White-space in indent-pre
3269 !! wikitext
3270 a
3271
3272 b
3273
3274
3275 c
3276 !! html
3277 <pre>a
3278
3279 b
3280
3281
3282 c
3283 </pre>
3284 !! end
3285
3286 !! test
3287 5c. White-space in indent-pre
3288 !! wikitext
3289 ''a''
3290 ''b''
3291 ''c''
3292 !! html
3293 <pre><i>a</i>
3294 <i>b</i>
3295 <i>c</i>
3296 </pre>
3297 !! end
3298
3299 !! test
3300 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3301 !! wikitext
3302 a
3303
3304 <!-- continue -->
3305 b
3306
3307 c
3308
3309 d
3310 !! html
3311 <pre>a
3312
3313 b
3314 </pre>
3315 <pre>c
3316
3317 </pre>
3318 <p>d
3319 </p>
3320 !! end
3321
3322 !! test
3323 7a. Indent-pre and category links
3324 !! options
3325 parsoid=wt2html,wt2wt
3326 !! wikitext
3327 [[Category:foo]] <!-- No pre-wrapping -->
3328 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3329 !! html/php+tidy
3330 !! html/parsoid
3331 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3332 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3333 !! end
3334
3335 ## We used to, but no longer wt2wt this test since the default serializer
3336 ## will normalize all categories to serialize on their own line.
3337 ## This wikitext usage is going to be fairly uncommon in production and
3338 ## selser will take care of preserving formatting in those scenarios.
3339 !! test
3340 7b. Indent-pre and category links
3341 !! options
3342 parsoid=wt2html
3343 !! wikitext
3344 [[Category:foo]] a
3345 [[Category:foo]] {{echo|b}}
3346 !! html/parsoid
3347 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3348 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3349 !! end
3350
3351 !! test
3352 Indent-Pre: Newlines in comments shouldn't affect sol state
3353 !! wikitext
3354 a <!--
3355 foo
3356 --> b
3357 !! html/php+tidy
3358 <p>a b</p>
3359 !! html/parsoid
3360 <p>a <!--
3361 foo
3362 --> b</p>
3363 !! end
3364
3365 ###
3366 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3367 ###
3368
3369 !!test
3370 HTML-pre: 1. embedded newlines
3371 !! wikitext
3372 <pre>foo</pre>
3373
3374 <pre>
3375 foo
3376 </pre>
3377
3378 <pre>
3379
3380 foo
3381 </pre>
3382
3383 <pre>
3384
3385
3386 foo
3387 </pre>
3388 !! html/php+tidy
3389 <pre>
3390 foo
3391 </pre>
3392 <pre>
3393 foo
3394 </pre>
3395 <pre>
3396
3397 foo
3398 </pre>
3399 <pre>
3400
3401
3402 foo
3403 </pre>
3404 !! html/parsoid
3405 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3406
3407 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3408 foo
3409 </pre>
3410
3411 <pre data-parsoid='{"stx":"html"}'>
3412
3413 foo
3414 </pre>
3415
3416 <pre data-parsoid='{"stx":"html"}'>
3417
3418
3419 foo
3420 </pre>
3421 !!end
3422
3423 !! test
3424 HTML-pre: big spaces
3425 !! wikitext
3426 <pre>
3427
3428
3429
3430
3431 haha
3432
3433
3434
3435
3436 haha
3437
3438
3439
3440
3441 </pre>
3442 !! html/php+tidy
3443 <pre>
3444
3445
3446
3447
3448 haha
3449
3450
3451
3452
3453 haha
3454
3455
3456
3457
3458 </pre>
3459 !! html/parsoid
3460 <pre data-parsoid='{"stx":"html"}'>
3461
3462
3463
3464
3465 haha
3466
3467
3468
3469
3470 haha
3471
3472
3473
3474
3475 </pre>
3476 !! end
3477
3478 !!test
3479 HTML-pre: 2: indented text
3480 !! wikitext
3481 <pre>
3482 foo
3483 </pre>
3484 !! html
3485 <pre>
3486 foo
3487 </pre>
3488
3489 !!end
3490
3491 !!test
3492 HTML-pre: 3: other wikitext
3493 !! wikitext
3494 <pre>
3495 * foo
3496 # bar
3497 = no-h =
3498 '' no-italic ''
3499 [[ NoLink ]]
3500 </pre>
3501 !! html/php
3502 <pre>
3503 * foo
3504 # bar
3505 = no-h =
3506 '' no-italic ''
3507 [[ NoLink ]]
3508 </pre>
3509
3510 !! html/parsoid
3511 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3512 # bar
3513 = no-h =
3514 '' no-italic ''
3515 [[ NoLink ]]
3516 </pre>
3517 !!end
3518
3519 ###
3520 ### Definition lists
3521 ###
3522 !! test
3523 Simple definition
3524 !! wikitext
3525 ; name : Definition
3526 !! html
3527 <dl><dt> name&#160;</dt>
3528 <dd> Definition</dd></dl>
3529
3530 !! end
3531
3532 !! test
3533 Definition list for indentation only
3534 !! wikitext
3535 : Indented text
3536 !! html
3537 <dl><dd> Indented text</dd></dl>
3538
3539 !! end
3540
3541 !! test
3542 Definition list with no space
3543 !! wikitext
3544 ;name:Definition
3545 !! html
3546 <dl><dt>name</dt>
3547 <dd>Definition</dd></dl>
3548
3549 !!end
3550
3551 !! test
3552 Definition list with URL link
3553 !! wikitext
3554 ; http://example.com/ : definition
3555 !! html
3556 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3557 <dd> definition</dd></dl>
3558
3559 !! end
3560
3561 !! test
3562 Definition list with bracketed URL link
3563 !! wikitext
3564 ;[http://www.example.com/ Example]:Something about it
3565 !! html
3566 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3567 <dd>Something about it</dd></dl>
3568
3569 !! end
3570
3571 !! test
3572 Definition list with wikilink containing colon
3573 !! wikitext
3574 ; [[Help:FAQ]]: The least-read page on Wikipedia
3575 !! html
3576 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3577 <dd> The least-read page on Wikipedia</dd></dl>
3578
3579 !! end
3580
3581 # At Brion's and JeLuF's insistence... :)
3582 !! test
3583 Definition list with news link containing colon
3584 !! wikitext
3585 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3586 !! html/php
3587 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3588 <dd> This isn't even a real newsgroup!</dd></dl>
3589
3590 !! html/parsoid
3591 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3592 !! end
3593
3594 !! test
3595 Malformed definition list with colon
3596 !! wikitext
3597 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3598 !! html
3599 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3600
3601 !! end
3602
3603 !! test
3604 Definition lists: colon in external link text
3605 !! wikitext
3606 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3607 !! html
3608 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3609 <dd> OK, I made that up</dd></dl>
3610
3611 !! end
3612
3613 !! test
3614 Definition lists: colon in HTML attribute
3615 !! wikitext
3616 ;<b style="display: inline">bold</b>
3617 !! html
3618 <dl><dt><b style="display: inline">bold</b></dt></dl>
3619
3620 !! end
3621
3622 !! test
3623 Definition lists: self-closed tag
3624 !! wikitext
3625 ;one<br/>two : two-line fun
3626 !! html
3627 <dl><dt>one<br />two&#160;</dt>
3628 <dd> two-line fun</dd></dl>
3629
3630 !! end
3631
3632 !! test
3633 Bug 11748: Literal closing tags
3634 !! wikitext
3635 <dl>
3636 <dt>test 1</dt>
3637 <dd>test test test test test</dd>
3638 <dt>test 2</dt>
3639 <dd>test test test test test</dd>
3640 </dl>
3641 !! html
3642 <dl>
3643 <dt>test 1</dt>
3644 <dd>test test test test test</dd>
3645 <dt>test 2</dt>
3646 <dd>test test test test test</dd>
3647 </dl>
3648
3649 !! end
3650
3651 !! test
3652 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3653 !! wikitext
3654 <ul><li>
3655 ; term : description
3656 * unordered
3657 </li></ul>
3658 !! html
3659 <ul><li>
3660 <dl><dt> term&#160;</dt>
3661 <dd> description</dd></dl>
3662 <ul><li> unordered</li></ul>
3663 </li></ul>
3664
3665 !! end
3666
3667 !! test
3668
3669 Definition list with empty definition and following paragraph
3670 !! wikitext
3671 ; term:
3672 Paragraph text
3673 !! html
3674 <dl><dt> term</dt>
3675 <dd></dd></dl>
3676 <p>Paragraph text
3677 </p>
3678 !! end
3679
3680 !! test
3681 Nested definition lists using html syntax
3682 !! wikitext
3683 <dl><dt>x</dt>
3684 <dd>a</dd>
3685 <dd>b</dd></dl>
3686
3687 !! end
3688
3689 !! test
3690 Definition Lists: No nesting: Multiple dd's
3691 !! wikitext
3692 ;x
3693 :a
3694 :b
3695 !! html
3696 <dl><dt>x</dt>
3697 <dd>a</dd>
3698 <dd>b</dd></dl>
3699
3700 !! end
3701
3702 !! test
3703 Definition Lists: Indentation: Regular
3704 !! wikitext
3705 :i1
3706 ::i2
3707 :::i3
3708 !! html
3709 <dl><dd>i1
3710 <dl><dd>i2
3711 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3712
3713 !! end
3714
3715 !! test
3716 Definition Lists: Indentation: Missing 1st level
3717 !! wikitext
3718 ::i2
3719 :::i3
3720 !! html
3721 <dl><dd><dl><dd>i2
3722 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3723
3724 !! end
3725
3726 !! test
3727 Definition Lists: Indentation: Multi-level indent
3728 !! wikitext
3729 :::i3
3730 !! html
3731 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3732
3733 !! end
3734
3735 !! test
3736 Definition Lists: Hacky use to indent tables
3737 !! wikitext
3738 ::{|
3739 |foo
3740 |bar
3741 |}
3742 this text
3743 should be left alone
3744 !! html
3745 <dl><dd><dl><dd><table>
3746 <tr>
3747 <td>foo
3748 </td>
3749 <td>bar
3750 </td></tr></table></dd></dl></dd></dl>
3751 <p>this text
3752 should be left alone
3753 </p>
3754 !! end
3755
3756 !! test
3757 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3758 !! wikitext
3759 <!-- foo -->
3760 ::{|
3761 |foo
3762 |bar
3763 |}<!-- bar -->
3764 this text
3765 should be left alone
3766 !! html/parsoid
3767 <!-- foo -->
3768 <dl><dd><dl><dd><table><tr>
3769 <td>foo</td>
3770 <td>bar</td>
3771 </tr></table><!-- bar --></dd></dl></dd></dl>
3772 <p>this text
3773 should be left alone</p>
3774 !! end
3775
3776 !! test
3777 Definition Lists: Hacky use to indent tables, with comment before table
3778 !! wikitext
3779 ::<!-- foo -->{|
3780 |foo
3781 |}
3782 !! html/parsoid
3783 <dl><dd><dl><dd><!-- foo --><table><tr>
3784 <td>foo</td>
3785 </tr></table></dd></dl></dd></dl>
3786 !! end
3787
3788 # The trailing whitespace in this test is to catch a regression in
3789 # Parsoid after T54473.
3790 !! test
3791 Definition Lists: Hacky use to indent tables (WS-insensitive)
3792 !! wikitext
3793 : {|
3794 |a
3795 |}
3796 !! html/php
3797 <dl><dd><table>
3798 <tr>
3799 <td>a
3800 </td></tr></table></dd></dl>
3801
3802 !! html/parsoid
3803 <dl><dd> <table>
3804 <tbody><tr><td>a</td></tr>
3805 </tbody></table> </dd></dl>
3806 !! end
3807
3808 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3809 ## as an empty dt item. It also ignores all but the last ";" when followed
3810 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3811 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3812 ## ";"s.
3813 ##
3814 ## Ex: ";;t2 ::d2" is transformed into:
3815 ##
3816 ## <dl>
3817 ## <dt>t2 </dt>
3818 ## <dd>
3819 ## <dl>
3820 ## <dt></dt>
3821 ## <dd>d2</dd>
3822 ## </dl>
3823 ## </dd>
3824 ## </dl>
3825 ##
3826 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3827 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3828 ##
3829 ## <dl>
3830 ## <dt>
3831 ## <dl>
3832 ## <dt>t2 </dt>
3833 ## <dd>:d2</dd>
3834 ## </dl>
3835 ## </dt>
3836 ## </dl>
3837 ##
3838 ## All Parsoid only definition list tests have this difference.
3839 ##
3840 ## See also: https://phabricator.wikimedia.org/T8569
3841 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3842
3843 !! test
3844 Table / list interaction: indented table with lists in table contents
3845 !! wikitext
3846 :{|
3847 |-
3848 | a
3849 * b
3850 |-
3851 | c
3852 * d
3853 |}
3854 !! html
3855 <dl><dd><table>
3856
3857 <tr>
3858 <td> a
3859 <ul><li> b</li></ul>
3860 </td></tr>
3861 <tr>
3862 <td> c
3863 <ul><li> d</li></ul>
3864 </td></tr></table></dd></dl>
3865
3866 !! end
3867
3868 !!test
3869 Table / list interaction: lists nested in tables nested in indented lists
3870 !! wikitext
3871 :{|
3872 |
3873 :a
3874 :b
3875 |
3876 *c
3877 *d
3878 |}
3879
3880 *e
3881 *f
3882 !! html
3883 <dl><dd><table>
3884 <tr>
3885 <td>
3886 <dl><dd>a</dd>
3887 <dd>b</dd></dl>
3888 </td>
3889 <td>
3890 <ul><li>c</li>
3891 <li>d</li></ul>
3892 </td></tr></table></dd></dl>
3893 <ul><li>e</li>
3894 <li>f</li></ul>
3895
3896 !!end
3897
3898 !! test
3899 Definition Lists: Nesting: Multi-level (Parsoid only)
3900 !! options
3901 parsoid
3902 !! wikitext
3903 ;t1 :d1
3904 ;;t2 ::d2
3905 ;;;t3 :::d3
3906 !! html
3907 <dl>
3908 <dt>t1 </dt>
3909 <dd>d1</dd>
3910 <dt>
3911 <dl>
3912 <dt>t2 </dt>
3913 <dd>:d2</dd>
3914 <dt>
3915 <dl>
3916 <dt>t3 </dt>
3917 <dd>::d3</dd>
3918 </dl>
3919 </dt>
3920 </dl>
3921 </dt>
3922 </dl>
3923
3924
3925 !! end
3926
3927
3928 !! test
3929 Definition Lists: Nesting: Test 2 (Parsoid only)
3930 !! wikitext
3931 ;t1
3932 ::d2
3933 !! html/php+tidy
3934 <dl>
3935 <dt>t1</dt>
3936 <dd>
3937 <dl>
3938 <dd>d2</dd>
3939 </dl>
3940 </dd>
3941 </dl>
3942 !! html/parsoid
3943 <dl>
3944 <dt>t1</dt>
3945 <dd>
3946 <dl>
3947 <dd>d2</dd>
3948 </dl>
3949 </dd>
3950 </dl>
3951
3952 !! end
3953
3954
3955 !! test
3956 Definition Lists: Nesting: Test 3 (Parsoid only)
3957 !! wikitext
3958 :;t1
3959 ::::d2
3960 !! html/php+tidy
3961 <dl>
3962 <dd>
3963 <dl>
3964 <dt>t1</dt>
3965 <dd>
3966 <dl>
3967 <dd>
3968 <dl>
3969 <dd>d2</dd>
3970 </dl>
3971 </dd>
3972 </dl>
3973 </dd>
3974 </dl>
3975 </dd>
3976 </dl>
3977 !! html/parsoid
3978 <dl>
3979 <dd>
3980 <dl>
3981 <dt>t1</dt>
3982 <dd>
3983 <dl>
3984 <dd>
3985 <dl>
3986 <dd>d2</dd>
3987 </dl>
3988 </dd>
3989 </dl>
3990 </dd>
3991 </dl>
3992 </dd>
3993 </dl>
3994
3995 !! end
3996
3997
3998 !! test
3999 Definition Lists: Nesting: Test 4
4000 !! wikitext
4001 ::;t3
4002 :::d3
4003 !! html
4004 <dl><dd><dl><dd><dl><dt>t3</dt>
4005 <dd>d3</dd></dl></dd></dl></dd></dl>
4006
4007 !! end
4008
4009
4010 ## The Parsoid team believes the following three test exposes a
4011 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4012 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4013 ## It also exposes a "misfeature" in tidy, which doesn't like
4014 ## <dl> tags with a single <dt> child; it converts the <dt> into
4015 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4016 !! test
4017 Definition Lists: Mixed Lists: Test 1
4018 !! wikitext
4019 :;* foo
4020 ::* bar
4021 :; baz
4022 !! html/php
4023 <dl><dd><dl><dt><ul><li> foo</li>
4024 <li> bar</li></ul></dt></dl>
4025 <dl><dt> baz</dt></dl></dd></dl>
4026
4027 !! html/php+tidy
4028 <dl>
4029 <dd>
4030 <dl>
4031 <dd>
4032 <ul>
4033 <li>foo</li>
4034 <li>bar</li>
4035 </ul>
4036 </dd>
4037 </dl>
4038 <dl>
4039 <dt>baz</dt>
4040 </dl>
4041 </dd>
4042 </dl>
4043 !! html/parsoid
4044 <dl>
4045 <dd><dl>
4046 <dt><ul>
4047 <li> foo
4048 </li>
4049 </ul></dt>
4050 <dd><ul>
4051 <li> bar
4052 </li>
4053 </ul></dd>
4054 <dt> baz</dt>
4055 </dl></dd>
4056 </dl>
4057 !! end
4058
4059 !! test
4060 Definition Lists: Mixed Lists: Test 2
4061 !! wikitext
4062 *: d1
4063 *: d2
4064 !! html
4065 <ul><li><dl><dd> d1</dd>
4066 <dd> d2</dd></dl></li></ul>
4067
4068 !! end
4069
4070
4071 !! test
4072 Definition Lists: Mixed Lists: Test 3
4073 !! wikitext
4074 *::: d1
4075 *::: d2
4076 !! html
4077 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4078 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4079
4080 !! end
4081
4082
4083 !! test
4084 Definition Lists: Mixed Lists: Test 4
4085 !! wikitext
4086 *;d1 :d2
4087 *;d3 :d4
4088 !! html
4089 <ul><li><dl><dt>d1&#160;</dt>
4090 <dd>d2</dd>
4091 <dt>d3&#160;</dt>
4092 <dd>d4</dd></dl></li></ul>
4093
4094 !! end
4095
4096
4097 !! test
4098 Definition Lists: Mixed Lists: Test 5
4099 !! wikitext
4100 *:d1
4101 *:: d2
4102 !! html
4103 <ul><li><dl><dd>d1
4104 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4105
4106 !! end
4107
4108
4109 !! test
4110 Definition Lists: Mixed Lists: Test 6
4111 !! wikitext
4112 #*:d1
4113 #*::: d3
4114 !! html
4115 <ol><li><ul><li><dl><dd>d1
4116 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4117
4118 !! end
4119
4120
4121 !! test
4122 Definition Lists: Mixed Lists: Test 7
4123 !! wikitext
4124 :* d1
4125 :* d2
4126 !! html
4127 <dl><dd><ul><li> d1</li>
4128 <li> d2</li></ul></dd></dl>
4129
4130 !! end
4131
4132
4133 !! test
4134 Definition Lists: Mixed Lists: Test 8
4135 !! wikitext
4136 :* d1
4137 ::* d2
4138 !! html
4139 <dl><dd><ul><li> d1</li></ul>
4140 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4141
4142 !! end
4143
4144
4145 !! test
4146 Definition Lists: Mixed Lists: Test 9
4147 !! wikitext
4148 *;foo :bar
4149 !! html
4150 <ul><li><dl><dt>foo&#160;</dt>
4151 <dd>bar</dd></dl></li></ul>
4152
4153 !! end
4154
4155
4156 !! test
4157 Definition Lists: Mixed Lists: Test 10
4158 !! wikitext
4159 *#;foo :bar
4160 !! html
4161 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4162 <dd>bar</dd></dl></li></ol></li></ul>
4163
4164 !! end
4165
4166 # The Parsoid team disagrees with the PHP parser's seemingly-random
4167 # rules regarding dd/dt on the next two tests. Parsoid is more
4168 # consistent, and recognizes the shared nesting and keeps the
4169 # still-open tags around until the nesting is complete.
4170 # (And tidy again converts <dt> to <dd> before 'bar'.)
4171
4172 !! test
4173 Definition Lists: Mixed Lists: Test 11
4174 !! wikitext
4175 *#*#;*;;foo :bar
4176 *#*#;boo :baz
4177 !! html/php
4178 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4179 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4180 <dl><dt>boo&#160;</dt>
4181 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4182
4183 !! html/php+tidy
4184 <ul>
4185 <li>
4186 <ol>
4187 <li>
4188 <ul>
4189 <li>
4190 <ol>
4191 <li>
4192 <dl>
4193 <dt>foo&#160;</dt>
4194 <dd>
4195 <ul>
4196 <li>
4197 <dl>
4198 <dd>
4199 <dl>
4200 <dt>bar</dt>
4201 </dl>
4202 </dd>
4203 </dl>
4204 </li>
4205 </ul>
4206 </dd>
4207 </dl>
4208 <dl>
4209 <dt>boo&#160;</dt>
4210 <dd>baz</dd>
4211 </dl>
4212 </li>
4213 </ol>
4214 </li>
4215 </ul>
4216 </li>
4217 </ol>
4218 </li>
4219 </ul>
4220 !! html/parsoid
4221 <ul>
4222 <li>
4223 <ol>
4224 <li>
4225 <ul>
4226 <li>
4227 <ol>
4228 <li>
4229 <dl>
4230 <dt>
4231 <ul>
4232 <li>
4233 <dl>
4234 <dt>
4235 <dl>
4236 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4237 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4238 </dl></dt>
4239 </dl></li>
4240 </ul></dt>
4241 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4242 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4243 </dl></li>
4244 </ol></li>
4245 </ul></li>
4246 </ol></li>
4247 </ul>
4248 !! end
4249
4250
4251 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4252 # From whitelist:
4253 # * The test is wrong, there are two colons where there should be :;
4254 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4255 !! test
4256 Definition Lists: Weird Ones: Test 1
4257 !! wikitext
4258 *#;*::;; foo : bar (who uses this?)
4259 !! html/php
4260 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4261 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4262
4263 !! html/php+tidy
4264 <ul>
4265 <li>
4266 <ol>
4267 <li>
4268 <dl>
4269 <dt>foo&#160;</dt>
4270 <dd>
4271 <ul>
4272 <li>
4273 <dl>
4274 <dd>
4275 <dl>
4276 <dd>
4277 <dl>
4278 <dd>
4279 <dl>
4280 <dt>bar (who uses this?)</dt>
4281 </dl>
4282 </dd>
4283 </dl>
4284 </dd>
4285 </dl>
4286 </dd>
4287 </dl>
4288 </li>
4289 </ul>
4290 </dd>
4291 </dl>
4292 </li>
4293 </ol>
4294 </li>
4295 </ul>
4296 !! html/parsoid
4297 <ul>
4298 <li>
4299 <ol>
4300 <li>
4301 <dl>
4302 <dt>
4303 <ul>
4304 <li>
4305 <dl>
4306 <dd>
4307 <dl>
4308 <dd>
4309 <dl>
4310 <dt>
4311 <dl>
4312 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4313 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4314 </dl></dt>
4315 </dl></dd>
4316 </dl></dd>
4317 </dl></li>
4318 </ul></dt>
4319 </dl></li>
4320 </ol></li>
4321 </ul>
4322 !! end
4323
4324 !! test
4325 Definition Lists: colons occurring in tags
4326 !! wikitext
4327 ;a:b
4328 ;'''a:b'''
4329 ;<i>a:b</i>
4330 ;<span>a:b</span>
4331 ;<div>a:b</div>
4332 ;<div>a
4333 :b</div>
4334 ;{{echo|a:b}}
4335 ;{{echo|''a:b''}}
4336 ;;;''a:b''
4337 !! html+tidy
4338 <dl>
4339 <dt>a</dt>
4340 <dd>b</dd>
4341 <dt><b>a:b</b></dt>
4342 <dt><i>a:b</i></dt>
4343 <dt><span>a:b</span></dt>
4344 <dd>
4345 <div>a:b</div>
4346 </dd>
4347 <dd>
4348 <div>a
4349 <dl>
4350 <dd>b</dd>
4351 </dl>
4352 </div>
4353 </dd>
4354 <dt>a</dt>
4355 <dd>b</dd>
4356 <dt><i>a:b</i></dt>
4357 </dl>
4358 <dl>
4359 <dd>
4360 <dl>
4361 <dd>
4362 <dl>
4363 <dt><i>a:b</i></dt>
4364 </dl>
4365 </dd>
4366 </dl>
4367 </dd>
4368 </dl>
4369 !! html/parsoid
4370 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4371 <dt><b>a:b</b></dt>
4372 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4373 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4374 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4375 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4376 <dd>b</dd>
4377 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4378 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4379 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4380 !! end
4381
4382 !! test
4383 Definition Lists: colons and tables 1
4384 !! wikitext
4385 :{|
4386 | x
4387 |}
4388 :{|
4389 | y
4390 |}
4391 !! html
4392 <dl><dd><table>
4393 <tr>
4394 <td> x
4395 </td></tr></table></dd></dl>
4396 <dl><dd><table>
4397 <tr>
4398 <td> y
4399 </td></tr></table></dd></dl>
4400
4401 !! end
4402
4403 # Parsoid's output (as documented below) differs from php's in this case.
4404 # This is probably a bug. If we fixup parsoid to match php's output, the
4405 # above test should pass and the below test case can be removed. It is
4406 # unclear which output is more desirable.
4407
4408 !! test
4409 Definition Lists: colons and tables 2
4410 !! wikitext
4411 :{|
4412 | x
4413 |}
4414 :{|
4415 | y
4416 |}
4417 !! html/parsoid
4418 <dl><dd><table>
4419 <tr>
4420 <td> x
4421 </td></tr></table></dd>
4422 <dd><table>
4423 <tr>
4424 <td> y
4425 </td></tr></table></dd></dl>
4426 !! end
4427
4428 !! test
4429 Definition Lists: template interaction
4430 !! wikitext
4431 ::{{definition_list}}
4432
4433 :one
4434 ::{{definition_list}}
4435 :::two
4436 :::three
4437 ::four
4438 !! html/parsoid
4439 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4440 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4441
4442 <dl><dd data-parsoid='{}'>one
4443 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4444 </span><dd about="#mwt2">two
4445 <dl><dd>two</dd>
4446 <dd>three</dd></dl></dd>
4447 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4448 !! end
4449
4450
4451 ###
4452 ### External links
4453 ###
4454 !! test
4455 External links: non-bracketed
4456 !! wikitext
4457 Non-bracketed: http://example.com
4458 !! html
4459 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4460 </p>
4461 !! end
4462
4463 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4464 !! test
4465 External links: numbered
4466 !! wikitext
4467 Numbered: [http://example.com]
4468 Numbered: [http://example.net]
4469 Numbered: [http://example.com]
4470 !! html/php
4471 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4472 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4473 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4474 </p>
4475 !! html/parsoid
4476 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4477 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4478 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4479 !!end
4480
4481 !! test
4482 External links: specified text
4483 !! wikitext
4484 Specified text: [http://example.com link]
4485 !! html
4486 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4487 </p>
4488 !!end
4489
4490 !! test
4491 External links: trail
4492 !! wikitext
4493 Linktrails should not work for external links: [http://example.com link]s
4494 !! html
4495 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4496 </p>
4497 !! end
4498
4499 !! test
4500 External links: dollar sign in URL
4501 !! wikitext
4502 http://example.com/1$2345
4503 !! html
4504 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4505 </p>
4506 !! end
4507
4508 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4509 !! test
4510 External links: dollar sign in URL (autonumber)
4511 !! wikitext
4512 [http://example.com/1$2345]
4513 !! html/php
4514 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4515 </p>
4516 !! html/parsoid
4517 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4518 !!end
4519
4520 !! test
4521 External links: open square bracket forbidden in URL (bug 4377)
4522 !! options
4523 parsoid=wt2html,wt2wt,html2html
4524 !! wikitext
4525 http://example.com/1[2345
4526 !! html/php
4527 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4528 </p>
4529 !! html/parsoid
4530 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4531 !! end
4532
4533 !! test
4534 External links: open square bracket forbidden in URL (named) (bug 4377)
4535 !! options
4536 parsoid=wt2html,html2html
4537 !! wikitext
4538 [http://example.com/1[2345]
4539 !! html/php
4540 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4541 </p>
4542 !! html/parsoid
4543 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4544 !!end
4545
4546 # parsoid adds a space before the link name
4547 !! test
4548 External links: open square bracket forbidden in URL (named) (bug 4377)
4549 Parsoid variant.
4550 !! wikitext
4551 [http://example.com/1 [2345]
4552 !! html
4553 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4554 </p>
4555 !!end
4556
4557 !! test
4558 External links: nowiki in URL link text (bug 6230)
4559 !! wikitext
4560 [http://example.com/ <nowiki>''example site''</nowiki>]
4561 !! html
4562 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4563 </p>
4564 !! end
4565
4566 !! test
4567 External links: newline forbidden in text (bug 6230 regression check)
4568 !! wikitext
4569 [http://example.com/ first
4570 second]
4571 !! html
4572 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4573 second]
4574 </p>
4575 !!end
4576
4577 !! test
4578 External links: Pipe char between url and text
4579 !! wikitext
4580 [http://example.com | link]
4581 !! html
4582 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4583 </p>
4584 !!end
4585
4586 !! test
4587 External links: protocol-relative URL in brackets
4588 !! wikitext
4589 [//example.com/ Test]
4590 !! html
4591 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4592 </p>
4593 !! end
4594
4595 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4596 !! test
4597 External links: protocol-relative URL in brackets without text
4598 !! wikitext
4599 [//example.com]
4600 !! html/php
4601 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4602 </p>
4603 !! html/parsoid
4604 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4605 !! end
4606
4607 !! test
4608 External links: protocol-relative URL in free text is left alone
4609 !! wikitext
4610 //example.com/Foo
4611 !! html
4612 <p>//example.com/Foo
4613 </p>
4614 !!end
4615
4616 !! test
4617 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4618 !! wikitext
4619 foo//example.com/Foo
4620 !! html
4621 <p>foo//example.com/Foo
4622 </p>
4623 !! end
4624
4625 !! test
4626 External links: with no contents
4627 !! wikitext
4628 [http://en.wikipedia.org/wiki/Foo]
4629
4630 [[wikipedia:Foo|Bar]]
4631
4632 [[wikipedia:Foo|<span>Bar</span>]]
4633 !! html/php
4634 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4635 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4636 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4637 </p>
4638 !! html/parsoid
4639 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4640 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4641 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4642 !! end
4643
4644 !! test
4645 External links: Free with trailing punctuation
4646 !! wikitext
4647 http://example.com,
4648 http://example.com;
4649 http://example.com\
4650 http://example.com.
4651 http://example.com:
4652 http://example.com!
4653 http://example.com?
4654 http://example.com)
4655 http://example.com/url_with_(brackets)
4656 (http://example.com/url_without_brackets)
4657 http://example.com/url_with_entity&amp;
4658 http://example.com/url_with_entity&#x26;
4659 http://example.com/url_with_entity&#038;
4660 http://example.com/url_with_entity&nbsp;
4661 http://example.com/url_with_entity&#xA0;
4662 http://example.com/url_with_entity&#160;
4663 http://example.com/url_with_entity&lt;
4664 http://example.com/url_with_entity&#x3C;
4665 http://example.com/url_with_entity&#60;
4666 !! html/php
4667 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4668 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4669 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4670 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4671 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4672 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4673 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4674 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4675 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4676 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4677 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4679 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4685 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4686 </p>
4687 !! html/parsoid
4688 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4689 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4690 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4691 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4692 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4693 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4694 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4695 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4696 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4697 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4698 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4699 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4700 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4701 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4704 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4705 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4706 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4707 !! end
4708
4709 !! test
4710 External links: tricky Parsoid html2html case
4711 !! options
4712 parsoid=wt2html,wt2wt,html2html
4713 !! wikitext
4714 http://example.com/url_with_entity&amp;amp;
4715 !! html/php
4716 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4717 </p>
4718 !! html/parsoid
4719 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4720 !! end
4721
4722 !! test
4723 External links: Free with trailing quotes (T113666)
4724 !! wikitext
4725 '''News:''' Stuff here
4726
4727 news:'a'b''c''d e
4728 !! html/php
4729 <p><b>News:</b> Stuff here
4730 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4731 </p>
4732 !! html/parsoid
4733 <p><b>News:</b> Stuff here</p>
4734 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4735 !! end
4736
4737 !! test
4738 External links: Lone protocols are never linked (T105697)
4739 !! wikitext
4740 http://
4741 http://;
4742 (http://)
4743 bitcoin:
4744 bitcoin:;
4745 (bitcoin:)
4746 !! html
4747 <p>http://
4748 http://;
4749 (http://)
4750 bitcoin:
4751 bitcoin:;
4752 (bitcoin:)
4753 </p>
4754 !! end
4755
4756 !! test
4757 External links: No preceding word characters allowed (bug 65278)
4758 !! wikitext
4759 NOPEhttp://example.com
4760 N0http://example.com
4761 ok:http://example.com
4762 ok-http://example.com
4763 !! html
4764 <p>NOPEhttp://example.com
4765 N0http://example.com
4766 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4767 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4768 </p>
4769 !! end
4770
4771 !! test
4772 External image
4773 !! wikitext
4774 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4775 !! html
4776 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4777 </p>
4778 !! end
4779
4780 !! test
4781 External image from https
4782 !! wikitext
4783 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4784 !! html
4785 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4786 </p>
4787 !! end
4788
4789 !! test
4790 External image (when not allowed)
4791 !! options
4792 wgAllowExternalImages=0
4793 !! wikitext
4794 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4795 !! html
4796 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4797 </p>
4798 !! end
4799
4800 !! test
4801 Link to non-http image, no img tag
4802 !! wikitext
4803 Link to non-http image, no img tag: ftp://example.com/test.jpg
4804 !! html
4805 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4806 </p>
4807 !! end
4808
4809 !! test
4810 External links: terminating separator
4811 !! wikitext
4812 Terminating separator: http://example.com/thing,
4813 !! html
4814 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4815 </p>
4816 !! end
4817
4818 !! test
4819 External links: intervening separator
4820 !! wikitext
4821 Intervening separator: http://example.com/1,2,3
4822 !! html
4823 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4824 </p>
4825 !! end
4826
4827 !! test
4828 External links: old bug with URL in query
4829 !! wikitext
4830 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4831 !! html
4832 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4833 </p>
4834 !! end
4835
4836 !! test
4837 External links: old URL-in-URL bug, mixed protocols
4838 !! wikitext
4839 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4840 !! html
4841 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4842 </p>
4843 !!end
4844
4845 !! test
4846 External links: URL in text
4847 !! wikitext
4848 URL in text: [http://example.com http://example.com]
4849 !! html
4850 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4851 </p>
4852 !! end
4853
4854 !! test
4855 External links: Clickable images
4856 !! wikitext
4857 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4858 !! html/php
4859 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
4860 </p>
4861 !! html/parsoid
4862 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4863 !! end
4864
4865 !! test
4866 External links: raw ampersand
4867 !! wikitext
4868 Old &amp; use: http://x&y
4869 !! html
4870 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4871 </p>
4872 !! end
4873
4874 !! test
4875 External links: encoded ampersand
4876 !! wikitext
4877 Old &amp; use: http://x&amp;y
4878 !! html/php
4879 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4880 </p>
4881 !! html/parsoid
4882 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4883 !! end
4884
4885 !! test
4886 External links: encoded equals (bug 6102)
4887 !! wikitext
4888 http://example.com/?foo&#61;bar
4889 !! html/php
4890 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4891 </p>
4892 !! html/parsoid
4893 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4894 !! end
4895
4896 ##
4897 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4898 ## does it number them. As discussed in bug 53505, we can identify
4899 ## autonumbered links via CSS.
4900 ##
4901
4902 !! test
4903 External links: [raw ampersand]
4904 !! wikitext
4905 Old &amp; use: [http://x&y]
4906 !! html/php
4907 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4908 </p>
4909 !! html/parsoid
4910 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4911 !! end
4912
4913 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4914 # mode will return the [raw ampersand] wikitext
4915 !! test
4916 External links: [encoded ampersand]
4917 !! options
4918 parsoid=wt2html,wt2wt,html2html
4919 !! wikitext
4920 Old &amp; use: [http://x&amp;y]
4921 !! html/php
4922 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4923 </p>
4924 !! html/parsoid
4925 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4926 !! end
4927
4928 !! test
4929 External links: [raw equals]
4930 !! wikitext
4931 [http://example.com/?foo=bar]
4932 !! html/php
4933 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4934 </p>
4935 !! html/parsoid
4936 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4937 !! end
4938
4939 # note that parsoid html is identical to [raw equals] case; so html2wt
4940 # mode will return the [raw equals] wikitext
4941 !! test
4942 External links: [encoded equals] (bug 6102)
4943 !! options
4944 parsoid=wt2html,wt2wt,html2html
4945 !! wikitext
4946 [http://example.com/?foo&#61;bar]
4947 !! html/php
4948 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4949 </p>
4950 !! html/parsoid
4951 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4952 !! end
4953
4954 # xxx parsoid strips the IDN character, so the round-trip tests will
4955 # obviously fail and are disabled. --cscott
4956 !! test
4957 External links: [IDN ignored character reference in hostname; strip it right off]
4958 !! options
4959 parsoid=wt2html,wt2wt,html2html
4960 !! wikitext
4961 [http://e&zwnj;xample.com/]
4962 !! html/php
4963 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4964 </p>
4965 !! html/parsoid
4966 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4967 !! end
4968
4969 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4970 # Where an external link could easily circumvent the sanitization of the text of
4971 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4972 # test demands a higher standard. That's a bit strange.
4973 #
4974 # Example:
4975 #
4976 # http://e‌xample.com -> [http://example.com|http://example.com]
4977 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4978 #
4979 # The first example is sanitized, but the second is not. Any security benefits
4980 # from this production are trivial to circumvent. Either remove this test and
4981 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4982 # the test accordingly.
4983 #
4984 # All our love,
4985 # The Parsoid team.
4986 # xxx parsoid strips the IDN character, so the round-trip tests will
4987 # obviously fail and are disabled. --cscott
4988 !! test
4989 External links: IDN ignored character reference in hostname; strip it right off
4990 !! options
4991 parsoid=wt2html,html2html
4992 !! wikitext
4993 http://e&zwnj;xample.com/
4994 !! html/php
4995 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4996 </p>
4997 !! html/parsoid
4998 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4999 !! end
5000
5001 !! test
5002 External links: www.jpeg.org (bug 554)
5003 !! wikitext
5004 http://www.jpeg.org
5005 !! html
5006 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5007 </p>
5008 !! end
5009
5010 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5011 !! test
5012 External links: URL within URL (original bug 2)
5013 !! wikitext
5014 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5015 !! html/php
5016 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5017 </p>
5018 !! html/parsoid
5019 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5020 !! end
5021
5022 !! test
5023 BUG 361: URL inside bracketed URL
5024 !! wikitext
5025 [http://www.example.com/foo http://www.example.com/bar]
5026 !! html
5027 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5028 </p>
5029 !! end
5030
5031 !! test
5032 BUG 361: URL within URL, not bracketed
5033 !! wikitext
5034 http://www.example.com/foo?=http://www.example.com/bar
5035 !! html
5036 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5037 </p>
5038 !! end
5039
5040 !! test
5041 BUG 289: ">"-token in URL-tail
5042 !! wikitext
5043 http://www.example.com/<hello>
5044 !! html
5045 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5046 </p>
5047 !!end
5048
5049 !! test
5050 BUG 289: literal ">"-token in URL-tail
5051 !! wikitext
5052 http://www.example.com/<b>html</b>
5053 !! html/php
5054 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5055 </p>
5056 !! html/parsoid
5057 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5058 !! end
5059
5060 !! test
5061 BUG 289: ">"-token in bracketed URL
5062 !! wikitext
5063 [http://www.example.com/<hello> stuff]
5064 !! html
5065 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5066 </p>
5067 !!end
5068
5069 !! test
5070 BUG 289: literal ">"-token in bracketed URL
5071 !! wikitext
5072 [http://www.example.com/<b>html</b> stuff]
5073 !! html
5074 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5075 </p>
5076 !!end
5077
5078 !! test
5079 BUG 289: literal double quote at end of URL
5080 !! wikitext
5081 http://www.example.com/"hello"
5082 !! html
5083 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5084 </p>
5085 !!end
5086
5087 !! test
5088 BUG 289: literal double quote in bracketed URL
5089 !! wikitext
5090 [http://www.example.com/"hello" stuff]
5091 !! html
5092 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5093 </p>
5094 !!end
5095
5096 !! test
5097 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5098 !! wikitext
5099 [http://www.example.com test]
5100 !! html
5101 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5102 </p>
5103 !! end
5104
5105 !! test
5106 External links: link text with spaces
5107 !! wikitext
5108 [http://www.example.com a b c]
5109 [http://www.example.com ''a'' ''b'']
5110 !! html
5111 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5112 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5113 </p>
5114 !! end
5115
5116 !! test
5117 External links: wiki links within external link (Bug 3695)
5118 !! options
5119 parsoid=wt2html,html2html
5120 !! wikitext
5121 [http://example.com [[wikilink]] embedded in ext link]
5122 !! html/php
5123 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5124 </p>
5125 !! html/parsoid
5126 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5127 !! end
5128
5129 !! test
5130 BUG 787: Links with one slash after the url protocol are invalid
5131 !! wikitext
5132 http:/example.com
5133
5134 [http:/example.com title]
5135 !! html
5136 <p>http:/example.com
5137 </p><p>[http:/example.com title]
5138 </p>
5139 !! end
5140
5141 !! test
5142 Bracketed external links with template-generated invalid target
5143 !! wikitext
5144 [{{echo|http:/example.com}} title]
5145 !! html
5146 <p>[http:/example.com title]
5147 </p>
5148 !! end
5149
5150 !! test
5151 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5152 !! wikitext
5153 ''[http://example.com text'']
5154 [http://example.com '''text]'''
5155 ''Something [http://example.com in italic'']
5156 ''Something [http://example.com mixed''''', even bold]'''
5157 '''''Now [http://example.com both''''']
5158 !! html
5159 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5160 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5161 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5162 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5163 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5164 </p>
5165 !! end
5166
5167
5168 !! test
5169 Bug 4781: %26 in URL
5170 !! wikitext
5171 http://www.example.com/?title=AT%26T
5172 !! html/php
5173 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5174 </p>
5175 !! html/parsoid
5176 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5177 !! end
5178
5179 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5180 # % is actually legal in HTML5. Any change in output would need testing though.
5181 !! test
5182 Bug 4781, 5267: %25 in URL
5183 !! wikitext
5184 http://www.example.com/?title=100%25_Bran
5185 !! html/php
5186 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5187 </p>
5188 !! html/parsoid
5189 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5190 !! end
5191
5192 !! test
5193 Bug 4781, 5267: %28, %29 in URL
5194 !! wikitext
5195 http://www.example.com/?title=Ben-Hur_%281959_film%29
5196 !! html/php
5197 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5198 </p>
5199 !! html/parsoid
5200 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5201 !! end
5202
5203
5204 !! test
5205 Bug 4781: %26 in autonumber URL
5206 !! wikitext
5207 [http://www.example.com/?title=AT%26T]
5208 !! html/php
5209 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5210 </p>
5211 !! html/parsoid
5212 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5213 !! end
5214
5215 !! test
5216 Bug 4781, 5267: %26 in autonumber URL
5217 !! wikitext
5218 [http://www.example.com/?title=100%25_Bran]
5219 !! html/php
5220 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5221 </p>
5222 !! html/parsoid
5223 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5224 !! end
5225
5226 !! test
5227 Bug 4781, 5267: %28, %29 in autonumber URL
5228 !! wikitext
5229 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5230 !! html/php
5231 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5232 </p>
5233 !! html/parsoid
5234 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5235 !! end
5236
5237
5238 !! test
5239 Bug 4781: %26 in bracketed URL
5240 !! wikitext
5241 [http://www.example.com/?title=AT%26T link]
5242 !! html/php
5243 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5244 </p>
5245 !! html/parsoid
5246 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5247 !! end
5248
5249 !! test
5250 Bug 4781, 5267: %25 in bracketed URL
5251 !! wikitext
5252 [http://www.example.com/?title=100%25_Bran link]
5253 !! html
5254 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5255 </p>
5256 !! end
5257
5258 !! test
5259 Bug 4781, 5267: %28, %29 in bracketed URL
5260 !! wikitext
5261 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5262 !! html/php
5263 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5264 </p>
5265 !! html/parsoid
5266 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5267 !! end
5268
5269 !! test
5270 External link containing a period in the anchor. (bug 63947)
5271 !! wikitext
5272 [//foo.org/bar#baz. bang]
5273
5274 [//foo.org/bar. bang]
5275 !! html/php
5276 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5277 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5278 </p>
5279 !! html/parsoid
5280 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5281 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5282 !! end
5283
5284 !! test
5285 External link containing a single quote. (bug 63947)
5286 !! wikitext
5287 [//foo.org/bar'baz]
5288
5289 [//foo.org/bar'baz bang]
5290 !! html/php
5291 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5292 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5293 </p>
5294 !! html/parsoid
5295 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5296 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5297 !! end
5298
5299 !! test
5300 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5301 !! wikitext
5302 Some [http://example.com/ pretty ''italics'' and stuff]!
5303 !! html
5304 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5305 </p>
5306 !! end
5307
5308 !! test
5309 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5310 !! wikitext
5311 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5312 !! html
5313 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5314 </p>
5315 !! end
5316
5317 !! test
5318 External link containing double-single-quotes with no space separating the url from text in italics
5319 !! wikitext
5320 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5321 !! html/php
5322 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5323 </p>
5324 !! html/php+tidy
5325 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5326 !! html/parsoid
5327 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5328 !! end
5329
5330 !! test
5331 External link with comments in link text
5332 !! wikitext
5333 [http://www.google.com Google <!-- comment -->]
5334 !! html/php
5335 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5336 </p>
5337 !! html/parsoid
5338 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5339 !! end
5340
5341 !! test
5342 External link to bare IPv4 address
5343 !! wikitext
5344 [http://192.168.0.1 Link]
5345 !! html/php
5346 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5347 </p>
5348 !! html/parsoid
5349 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5350 !! end
5351
5352 !! test
5353 URL-encoding in URL functions (single parameter)
5354 !! wikitext
5355 {{localurl:Some page|amp=&}}
5356 !! html
5357 <p>/index.php?title=Some_page&amp;amp=&amp;
5358 </p>
5359 !! end
5360
5361 !! test
5362 URL-encoding in URL functions (multiple parameters)
5363 !! wikitext
5364 {{localurl:Some page|q=?&amp=&}}
5365 !! html
5366 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5367 </p>
5368 !! end
5369
5370 !! test
5371 Brackets in urls
5372 !! wikitext
5373 http://example.com/index.php?foozoid%5B%5D=bar
5374
5375 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5376 !! html/php
5377 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5378 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5379 </p>
5380 !! html/parsoid
5381 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5382
5383 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5384 !! end
5385
5386 !! test
5387 IPv6 urls, autolink format (T23261)
5388 !! wikitext
5389 http://[2404:130:0:1000::187:2]/index.php
5390
5391 Examples from RFC 2373, section 2.2:
5392 * http://[1080::8:800:200C:417A]/unicast
5393 * http://[FF01::101]/multicast
5394 * http://[::1]/loopback
5395 * http://[::]/unspecified
5396 * http://[::13.1.68.3]/ipv4compat
5397 * http://[::FFFF:129.144.52.38]/ipv4compat
5398
5399 Examples from RFC 2732, section 2:
5400 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5401 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5402 * http://[3ffe:2a00:100:7031::1]
5403 * http://[1080::8:800:200C:417A]/foo
5404 * http://[::192.9.5.5]/ipng
5405 * http://[::FFFF:129.144.52.38]:80/index.html
5406 * http://[2010:836B:4179::836B:4179]
5407
5408 !! html/php
5409 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5410 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5411 </p>
5412 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5413 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5414 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5415 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5416 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5417 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5418 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5419 </p>
5420 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5421 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5422 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5423 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5424 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5425 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5426 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5427
5428 !! html/parsoid
5429 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5430
5431 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5432 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5433 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5434 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5435 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5436 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5437 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5438
5439 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5440 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5441 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5442 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5443 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5444 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5445 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5446 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5447 !! end
5448
5449 !! test
5450 IPv6 urls, bracketed format (T23261)
5451 !! wikitext
5452 [http://[2404:130:0:1000::187:2]/index.php test]
5453
5454 Examples from RFC 2373, section 2.2:
5455 * [http://[1080::8:800:200C:417A] unicast]
5456 * [http://[FF01::101] multicast]
5457 * [http://[::1]/ loopback]
5458 * [http://[::] unspecified]
5459 * [http://[::13.1.68.3] ipv4compat]
5460 * [http://[::FFFF:129.144.52.38] ipv4compat]
5461
5462 Examples from RFC 2732, section 2:
5463 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5464 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5465 * [http://[3ffe:2a00:100:7031::1] 3]
5466 * [http://[1080::8:800:200C:417A]/foo 4]
5467 * [http://[::192.9.5.5]/ipng 5]
5468 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5469 * [http://[2010:836B:4179::836B:4179] 7]
5470
5471 !! html/php
5472 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5473 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5474 </p>
5475 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5476 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5477 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5478 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5479 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5480 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5481 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5482 </p>
5483 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5484 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5485 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5486 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5487 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5489 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5490
5491 !! html/parsoid
5492 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5493
5494 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5495 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5496 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5497 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5498 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5501
5502 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5503 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5504 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5505 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5506 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5510 !! end
5511
5512 !! test
5513 Non-extlinks in brackets
5514 !! wikitext
5515 [foo]
5516 [foo bar]
5517 [foo ''bar'']
5518 [fool's] errand
5519 [fool's errand]
5520 [{{echo|foo}}]
5521 [{{echo|foo}} bar]
5522 [{{echo|foo}} ''bar'']
5523 [{{echo|foo}}l's] errand
5524 [{{echo|foo}}l's errand]
5525 [url={{echo|foo}}]
5526 [url=http://example.com]
5527 [http:// bare protocols don't count]
5528 !! html/php
5529 <p>[foo]
5530 [foo bar]
5531 [foo <i>bar</i>]
5532 [fool's] errand
5533 [fool's errand]
5534 [foo]
5535 [foo bar]
5536 [foo <i>bar</i>]
5537 [fool's] errand
5538 [fool's errand]
5539 [url=foo]
5540 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5541 [http:// bare protocols don't count]
5542 </p>
5543 !! html/parsoid
5544 <p>[foo]
5545 [foo bar]
5546 [foo <i>bar</i>]
5547 [fool's] errand
5548 [fool's errand]
5549 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5550 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5551 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5552 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5553 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5554 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5555 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5556 [http:// bare protocols don't count]</p>
5557 !! end
5558
5559 !! test
5560 Percent encoding in external links
5561 !! wikitext
5562 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5563 !! html/php
5564 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5565 </p>
5566 !! html/parsoid
5567 <p><a rel="mw:ExtLink"
5568 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5569 !! end
5570
5571 !! test
5572 Use url link syntax for links where the content is equal the link target
5573 !! wikitext
5574 http://example.com
5575 !! html/php
5576 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5577 </p>
5578 !! html/parsoid
5579 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5580 !! end
5581
5582 !! test
5583 Parenthesis in external links, especially URL links
5584 !! wikitext
5585 http://example.com)
5586
5587 http://example.com/test)
5588
5589 http://example.com/(test)
5590
5591 http://example.com/((test)
5592
5593 (http://example.com/(test))
5594
5595 (http://example.com/(test)))))
5596
5597 http://example.com/a)b
5598
5599 [http://example.com) foo]
5600 !! html/php
5601 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5602 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5603 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5604 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5605 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5606 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5607 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5608 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5609 </p>
5610 !! html/parsoid
5611 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5612 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5613 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5614 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5615 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5616 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5617 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5618 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5619 !! end
5620
5621 !! test
5622 Parenthesis in external links, w/ transclusion or comment
5623 !! wikitext
5624 (http://example.com/{{echo|hi}})
5625
5626 (http://example.com<!-- hi -->)
5627 !! html/php
5628 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5629 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5630 </p>
5631 !! html/parsoid
5632 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5633
5634 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5635 !! end
5636
5637 !! test
5638 Serialize <a> tags with invalid link targets as plain text
5639 !! options
5640 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5641 !! html/parsoid
5642 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5643 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5644 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5645 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5646 !! wikitext
5647 text
5648 <nowiki>*</nowiki>text
5649 <nowiki>[[foo]]</nowiki>
5650 <nowiki>*a [[foo]]</nowiki>
5651 !! end
5652
5653 !! test
5654 mw:ExtLink -vs- mw:WikiLink (T94723)
5655 !! options
5656 parsoid=html2wt
5657 !! html/parsoid
5658 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5659 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5660 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5661 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5662 <p>
5663 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5664 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5665 </p>
5666 !! wikitext
5667 [[Foo|Bar]]
5668 [[Foo|Bar]]
5669 [[wikipedia:Foo|Bar]]
5670 [[wikipedia:Foo|Bar]]
5671
5672 [[wikipedia:European_Robin|European Robin]]
5673 [[wikipedia:European_Robin|European Robin]]
5674 !! end
5675
5676 !! test
5677 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5678 !! options
5679 parsoid=wt2wt
5680 !! wikitext
5681 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5682 !! html/parsoid
5683 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5684 !! end
5685
5686
5687 ###
5688 ### Quotes
5689 ###
5690
5691 !! test
5692 Quotes
5693 !! wikitext
5694 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5695
5696 Normal text. '''''Bold italic text.''''' Normal text.
5697 !! html
5698 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5699 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5700 </p>
5701 !! end
5702
5703
5704 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5705 # parser strips. The wikitext contains just the first half of the bold
5706 # quote pair.
5707 !! test
5708 Unclosed and unmatched quotes
5709 !! wikitext
5710 '''''Bold italic text '''with bold deactivated''' in between.'''''
5711
5712 '''''Bold italic text ''with italic deactivated'' in between.'''''
5713
5714 '''Bold text..
5715
5716 ..spanning two paragraphs (should not work).'''
5717
5718 '''Bold tag left open
5719
5720 ''Italic tag left open
5721
5722 Normal text.
5723
5724 <!-- Unmatching number of opening, closing tags: -->
5725 '''This year''''s election ''should'' beat '''last year''''s.
5726
5727 ''Tom'''s car is bigger than ''Susan'''s.
5728
5729 Plain ''italic'''s plain
5730 !! html/php
5731 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5732 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5733 </p><p><b>Bold text..</b>
5734 </p><p>..spanning two paragraphs (should not work).
5735 </p><p><b>Bold tag left open</b>
5736 </p><p><i>Italic tag left open</i>
5737 </p><p>Normal text.
5738 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5739 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5740 </p><p>Plain <i>italic'</i>s plain
5741 </p>
5742 !! html/parsoid
5743 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5744 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5745 </p><p><b>Bold text..</b>
5746 </p><p>..spanning two paragraphs (should not work).<b></b>
5747 </p><p><b>Bold tag left open</b>
5748 </p><p><i>Italic tag left open</i>
5749 </p><p>Normal text.
5750 </p>
5751 <!-- Unmatching number of opening, closing tags: -->
5752 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5753 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5754 </p><p>Plain <i>italic'</i>s plain
5755 </p>
5756 !! end
5757
5758 ###
5759 ### Tables
5760 ###
5761 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5762 ###
5763
5764 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5765 # is the bare minimum required by the spec, see:
5766 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5767 # Parsoid team replies: empty table tags are legal in HTML5
5768 !! test
5769 A table with no data.
5770 !! options
5771 parsoid=wt2html
5772 !! wikitext
5773 {||}
5774 !! html/php
5775
5776 !! html/parsoid
5777 <table></table>
5778
5779 !! end
5780
5781 !! test
5782 A table with stray table end tags on start tag line (wt2html)
5783 !! options
5784 parsoid=wt2html
5785 !! wikitext
5786 {|style="color: red;"|}
5787
5788 {|style="color: red;" |}
5789 |foo
5790 |}
5791
5792 {|style="color: red;"|} id="foo"
5793 |foo
5794 |}
5795
5796 {|style="color: red;" |} id="foo"
5797 |foo
5798 |}
5799 !! html
5800 <table style="color: red;"></table>
5801
5802 <table style="color: red;">
5803 <tbody><tr>
5804 <td>foo</td>
5805 </tr></tbody>
5806 </table>
5807
5808 <table style="color: red;" id="foo">
5809 <tbody><tr>
5810 <td>foo</td>
5811 </tr></tbody>
5812 </table>
5813
5814 <table style="color: red;" id="foo">
5815 <tbody><tr>
5816 <td>foo</td>
5817 </tr></tbody>
5818 </table>
5819
5820 !! end
5821
5822 !! test
5823 A table with no data (take 2)
5824 !! wikitext
5825 {|
5826 |}
5827 !! html/parsoid
5828 <table></table>
5829 !! end
5830
5831 # A table with nothing but a caption is invalid XHTML, we might want to render
5832 # this as <p>caption</p>
5833 # Parsoid team replies: table with only a caption is legal in HTML5
5834 !! test
5835 A table with nothing but a caption
5836 !! wikitext
5837 {|
5838 |+ caption
5839 |}
5840 !! html/php
5841 <table>
5842 <caption> caption
5843 </caption><tr><td></td></tr></table>
5844
5845 !! html/parsoid
5846 <table><caption> caption</caption></table>
5847 !! end
5848
5849 !! test
5850 A table with caption with default-spaced attributes and a table row
5851 !! wikitext
5852 {|
5853 |+ style="color: red;" | caption1
5854 |-
5855 | foo
5856 |}
5857 !! html
5858 <table>
5859 <caption style="color: red;"> caption1
5860 </caption>
5861 <tr>
5862 <td> foo
5863 </td></tr></table>
5864
5865 !! end
5866
5867 !! test
5868 A table with captions with non-default spaced attributes and a table row
5869 !! wikitext
5870 {|
5871 |+style="color: red;"|caption2
5872 |+ style="color: red;"| caption3
5873 |-
5874 | foo
5875 |}
5876 !! html
5877 <table>
5878 <caption style="color: red;">caption2
5879 </caption>
5880 <caption style="color: red;"> caption3
5881 </caption>
5882 <tr>
5883 <td> foo
5884 </td></tr></table>
5885
5886 !! end
5887
5888 !! test
5889 Table td-cell syntax variations
5890 !! wikitext
5891 {|
5892 | foo bar foo | baz
5893 | foo bar foo || baz
5894 | style='color:red;' | baz
5895 | style='color:red;' || baz
5896 |}
5897 !! html
5898 <table>
5899 <tr>
5900 <td> baz
5901 </td>
5902 <td> foo bar foo </td>
5903 <td> baz
5904 </td>
5905 <td style="color:red;"> baz
5906 </td>
5907 <td> style='color:red;' </td>
5908 <td> baz
5909 </td></tr></table>
5910
5911 !! end
5912
5913 !! test
5914 Simple table
5915 !! wikitext
5916 {|
5917 | 1 || 2
5918 |-
5919 | 3 || 4
5920 |}
5921 !! html
5922 <table>
5923 <tr>
5924 <td> 1 </td>
5925 <td> 2
5926 </td></tr>
5927 <tr>
5928 <td> 3 </td>
5929 <td> 4
5930 </td></tr></table>
5931
5932 !! end
5933
5934 !! test
5935 Simple table but with multiple dashes for row wikitext
5936 !! wikitext
5937 {|
5938 | foo
5939 |-----
5940 | bar
5941 |}
5942 !! html
5943 <table>
5944 <tr>
5945 <td> foo
5946 </td></tr>
5947 <tr>
5948 <td> bar
5949 </td></tr></table>
5950
5951 !! end
5952
5953 !! test
5954 Multiplication table
5955 !! wikitext
5956 {| border="1" cellpadding="2"
5957 |+Multiplication table
5958 |-
5959 ! &times; !! 1 !! 2 !! 3
5960 |-
5961 ! 1
5962 | 1 || 2 || 3
5963 |-
5964 ! 2
5965 | 2 || 4 || 6
5966 |-
5967 ! 3
5968 | 3 || 6 || 9
5969 |-
5970 ! 4
5971 | 4 || 8 || 12
5972 |-
5973 ! 5
5974 | 5 || 10 || 15
5975 |}
5976 !! html
5977 <table border="1" cellpadding="2">
5978 <caption>Multiplication table
5979 </caption>
5980 <tr>
5981 <th> &#215; </th>
5982 <th> 1 </th>
5983 <th> 2 </th>
5984 <th> 3
5985 </th></tr>
5986 <tr>
5987 <th> 1
5988 </th>
5989 <td> 1 </td>
5990 <td> 2 </td>
5991 <td> 3
5992 </td></tr>
5993 <tr>
5994 <th> 2
5995 </th>
5996 <td> 2 </td>
5997 <td> 4 </td>
5998 <td> 6
5999 </td></tr>
6000 <tr>
6001 <th> 3
6002 </th>
6003 <td> 3 </td>
6004 <td> 6 </td>
6005 <td> 9
6006 </td></tr>
6007 <tr>
6008 <th> 4
6009 </th>
6010 <td> 4 </td>
6011 <td> 8 </td>
6012 <td> 12
6013 </td></tr>
6014 <tr>
6015 <th> 5
6016 </th>
6017 <td> 5 </td>
6018 <td> 10 </td>
6019 <td> 15
6020 </td></tr></table>
6021
6022 !! end
6023
6024 !! test
6025 Accept "||" in table headings
6026 !! wikitext
6027 {|
6028 !h1 || h2
6029 |}
6030 !! html
6031 <table>
6032 <tr>
6033 <th>h1 </th>
6034 <th> h2
6035 </th></tr></table>
6036
6037 !! end
6038
6039 !! test
6040 Accept "!!" in table data
6041 !! wikitext
6042 {|
6043 | Foo!! ||
6044 |}
6045 !! html
6046 <table>
6047 <tr>
6048 <td> Foo!! </td>
6049 <td>
6050 </td></tr></table>
6051
6052 !! html/parsoid
6053 <table>
6054 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6055 </tbody></table>
6056 !! end
6057
6058 !! test
6059 Accept "||" in indented table headings
6060 !! wikitext
6061 :{|
6062 !h1 || h2
6063 |}
6064 !! html
6065 <dl><dd><table>
6066 <tr>
6067 <th>h1 </th>
6068 <th> h2
6069 </th></tr></table></dd></dl>
6070
6071 !! end
6072
6073 !! test
6074 Accept "!!" in templates
6075 !! wikitext
6076 {|
6077 !a {{echo|b!!c}}
6078 |}
6079 !! html/php
6080 <table>
6081 <tr>
6082 <th>a b</th>
6083 <th>c
6084 </th></tr></table>
6085
6086 !! html/parsoid
6087 <table>
6088 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6089 !! end
6090
6091 !! test
6092 Accept "!!" in table headings after newline
6093 !! wikitext
6094 {|
6095 !a
6096 b!!c
6097 |}
6098 !! html/php
6099 <table>
6100 <tr>
6101 <th>a
6102 <p>b!!c
6103 </p>
6104 </th></tr></table>
6105
6106 !! html/parsoid
6107 <table>
6108 <tbody><tr><th>a
6109 <p>b!!c</p></th></tr>
6110 </tbody></table>
6111 !! end
6112
6113 !! test
6114 Accept "!!" in table data of mixed wikitext / html syntax
6115 !! wikitext
6116 {|
6117 !a
6118 <tr><td>b!!c</td></tr>
6119 |}
6120 !! html+tidy
6121 <table>
6122 <tr>
6123 <th>a</th>
6124 </tr>
6125 <tr>
6126 <td>b!!c</td>
6127 </tr>
6128 </table>
6129 !! html/parsoid
6130 <table>
6131 <tbody><tr><th>a</th></tr>
6132 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6133 </tbody></table>
6134 !! end
6135
6136 !! test
6137 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6138 !! wikitext
6139 {|
6140 !| h1
6141 || a
6142 |}
6143 !! html
6144 <table>
6145 <tr>
6146 <th> h1
6147 </th>
6148 <td> a
6149 </td></tr></table>
6150
6151 !! end
6152
6153 !!test
6154 Accept "| !" at start of line in tables (ignore !-attribute)
6155 !! wikitext
6156 {|
6157 |-
6158 | !style="color:red" | bar
6159 |}
6160 !! html
6161 <table>
6162
6163 <tr>
6164 <td> bar
6165 </td></tr></table>
6166
6167 !!end
6168
6169 !!test
6170 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6171 !! wikitext
6172 {|
6173 |-
6174 |style='color:red;'|+1
6175 |style='color:blue;'|-1
6176 |-
6177 | 1 || 2 || 3
6178 | 1 ||+2 ||-3
6179 |-
6180 | +1
6181 | -1
6182 |}
6183 !! html
6184 <table>
6185
6186 <tr>
6187 <td style="color:red;">+1
6188 </td>
6189 <td style="color:blue;">-1
6190 </td></tr>
6191 <tr>
6192 <td> 1 </td>
6193 <td> 2 </td>
6194 <td> 3
6195 </td>
6196 <td> 1 </td>
6197 <td>+2 </td>
6198 <td>-3
6199 </td></tr>
6200 <tr>
6201 <td> +1
6202 </td>
6203 <td> -1
6204 </td></tr></table>
6205
6206 !!end
6207
6208 !! test
6209 Table rowspan
6210 !! wikitext
6211 {| border=1
6212 | Cell 1, row 1
6213 |rowspan=2| Cell 2, row 1 (and 2)
6214 | Cell 3, row 1
6215 |-
6216 | Cell 1, row 2
6217 | Cell 3, row 2
6218 |}
6219 !! html
6220 <table border="1">
6221 <tr>
6222 <td> Cell 1, row 1
6223 </td>
6224 <td rowspan="2"> Cell 2, row 1 (and 2)
6225 </td>
6226 <td> Cell 3, row 1
6227 </td></tr>
6228 <tr>
6229 <td> Cell 1, row 2
6230 </td>
6231 <td> Cell 3, row 2
6232 </td></tr></table>
6233
6234 !! end
6235
6236 !! test
6237 Nested table
6238 !! wikitext
6239 {| border=1
6240 | &alpha;
6241 |
6242 {| bgcolor=#ABCDEF border=2
6243 |nested
6244 |-
6245 |table
6246 |}
6247 |the original table again
6248 |}
6249 !! html
6250 <table border="1">
6251 <tr>
6252 <td> &#945;
6253 </td>
6254 <td>
6255 <table bgcolor="#ABCDEF" border="2">
6256 <tr>
6257 <td>nested
6258 </td></tr>
6259 <tr>
6260 <td>table
6261 </td></tr></table>
6262 </td>
6263 <td>the original table again
6264 </td></tr></table>
6265
6266 !! end
6267
6268 !! test
6269 Invalid attributes in table cell (bug 1830)
6270 !! wikitext
6271 {|
6272 |Cell:|broken
6273 |}
6274 !! html
6275 <table>
6276 <tr>
6277 <td>broken
6278 </td></tr></table>
6279
6280 !! end
6281
6282 !! test
6283 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6284 !! wikitext
6285 {|
6286 | title="foo" |bar
6287 | title="foo<nowiki>|</nowiki>" |bar
6288 | title="foo<nowiki>|</nowiki>" bar
6289 |}
6290 !! html/php
6291 <table>
6292 <tr>
6293 <td title="foo">bar
6294 </td>
6295 <td title="foo&#124;">bar
6296 </td>
6297 <td> title="foo|" bar
6298 </td></tr></table>
6299
6300 !! html/parsoid
6301 <table>
6302 <tbody><tr><td title="foo">bar</td>
6303 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6304 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6305 </tbody></table>
6306 !! end
6307
6308 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6309 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6310 # *2wt modes will fail.
6311 !! test
6312 Table security: embedded pipes
6313 !! options
6314 parsoid=wt2html,html2html
6315 !! wikitext
6316 {|
6317 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6318 !! html/php
6319 <table>
6320 <tr>
6321 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6322 <td>]" onmouseover="alert(document.cookie)"&gt;test
6323 </td>
6324 </tr>
6325 </table>
6326
6327 !! html/parsoid
6328 <table><tbody>
6329 <tr>
6330 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6331 !! end
6332
6333 !! test
6334 ! and || in element attributes should not be parsed as <th>/<td>
6335 !! wikitext
6336 {|
6337 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6338 |}
6339 !! html/php
6340 <table>
6341 <tr>
6342 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6343 </td></tr></table>
6344
6345 !! html/parsoid
6346 <table>
6347 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6348 </tbody></table>
6349 !! end
6350
6351 # FIXME: The output seems broken. Filed as T110268.
6352 !! test
6353 ! and || in td attributes should not be parsed as <th>/<td>
6354 !! options
6355 parsoid=wt2html
6356 !! wikitext
6357 {|
6358 | style="color: red !important;" data-contrived="put this here ||" | foo
6359 |}
6360 !! html/php
6361 <table>
6362 <tr>
6363 <td> style="color: red !important;" data-contrived="put this here </td>
6364 <td> foo
6365 </td></tr></table>
6366
6367 !! html/parsoid
6368 <table>
6369 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6370 </tbody></table>
6371 !! end
6372
6373 !! test
6374 Indented table markup mixed with indented pre content (proposed in bug 6200)
6375 !! wikitext
6376 <table>
6377 <tr>
6378 <td>
6379 Text that should be rendered preformatted
6380 </td>
6381 </tr>
6382 </table>
6383 !! html
6384 <table>
6385 <tr>
6386 <td>
6387 <pre>Text that should be rendered preformatted
6388 </pre>
6389 </td>
6390 </tr>
6391 </table>
6392
6393 !! end
6394
6395 !! test
6396 1. Template-generated table cell attributes and cell content
6397 !! wikitext
6398 {|
6399 |{{table_attribs}}
6400 | {{table_attribs}}
6401 || {{table_attribs_5}}
6402 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6403 |align=center {{table_attribs}}
6404 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6405 |}
6406 !! html
6407 <table>
6408 <tr>
6409 <td style="color:red;">Foo
6410 </td>
6411 <td style="color:red;">Foo
6412 </td>
6413 <td> style="color:red;"</td>
6414 <td>Bar
6415 </td>
6416 <td style="color:red;">Foo
6417 </td>
6418 <td align="center" style="color:red;">Foo
6419 </td>
6420 <td align="center" style="color:red;">Foo
6421 </td></tr></table>
6422
6423 !! end
6424
6425 !! test
6426 2. Template-generated table cell attributes and cell content
6427 !! wikitext
6428 {|
6429 |{{table_attribs_2}}
6430 |}
6431 !! html/php
6432 <table>
6433 <tr>
6434 <td style="color:red;">Foo
6435 </td>
6436 <td>Bar</td>
6437 <td>Baz
6438 </td></tr></table>
6439
6440 !! html/parsoid
6441 <table>
6442 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6443 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6444 </tbody></table>
6445 !! end
6446
6447 !! test
6448 3. Template-generated table cell attributes and cell content
6449 !! wikitext
6450 {|
6451 !align=center {{table_header_cells}}
6452 |-
6453 |align=center {{table_cells}}
6454 |}
6455 !! html/php
6456 <table>
6457 <tr>
6458 <th align="center" style="color:red;">Foo</th>
6459 <th style="color:red;"><i>Bar</i></th>
6460 <th style="color:brown;"><i>Foo</i> and Baz
6461 </th></tr>
6462 <tr>
6463 <td align="center" style="color:red;">Foo</td>
6464 <td style="color:red;"><i>Bar</i></td>
6465 <td style="color:brown;"><i>Foo</i> and Baz
6466 </td></tr></table>
6467
6468 !! html/parsoid
6469 <table>
6470 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6471 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6472 </tbody></table>
6473 !! end
6474
6475 !! test
6476 4. Template-generated table cell attributes and cell content inside a templated table
6477 !! wikitext
6478 {{tbl-start}}
6479 !align=center {{table_header_cells}}
6480 |-
6481 |align=center {{table_cells}}
6482 {{tbl-end}}
6483 !! html/php
6484 <table>
6485 <tr>
6486 <th align="center" style="color:red;">Foo</th>
6487 <th style="color:red;"><i>Bar</i></th>
6488 <th style="color:brown;"><i>Foo</i> and Baz
6489 </th></tr>
6490 <tr>
6491 <td align="center" style="color:red;">Foo</td>
6492 <td style="color:red;"><i>Bar</i></td>
6493 <td style="color:brown;"><i>Foo</i> and Baz
6494 </td></tr></table>
6495
6496 !! html/parsoid
6497 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6498 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6499 <tr>
6500 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6501 </tbody></table>
6502 !! end
6503
6504 ## Edge case fix to prevent future regressions
6505 !! test
6506 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6507 !! wikitext
6508 {|
6509 |{{table_attribs_7}}
6510 |}
6511 <references />
6512 !! html/parsoid
6513 <table>
6514 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6515 </tbody></table>
6516 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6517 !! end
6518
6519 !! test
6520 Table with row followed by newlines and table heading
6521 !! wikitext
6522 {|
6523 |-
6524
6525 ! foo
6526 |}
6527 !! html
6528 <table>
6529
6530
6531 <tr>
6532 <th> foo
6533 </th></tr></table>
6534
6535 !! end
6536
6537 !! test
6538 Table with empty line following the start tag
6539 !! wikitext
6540 {|
6541
6542 |-
6543 | foo
6544 |}
6545 !! html
6546 <table>
6547
6548
6549 <tr>
6550 <td> foo
6551 </td></tr></table>
6552
6553 !! end
6554
6555 !! test
6556 Table attributes with empty value
6557 !! wikitext
6558 {|
6559 | style=| hello
6560 |}
6561 !! html/php
6562 <table>
6563 <tr>
6564 <td style=""> hello
6565 </td></tr></table>
6566
6567 !! html/parsoid
6568 <table>
6569 <tbody>
6570 <tr>
6571 <td style=""> hello
6572 </td></tr></tbody></table>
6573
6574 !! end
6575
6576 !! test
6577 Wikitext table with a lot of comments
6578 !! wikitext
6579 {|
6580 <!-- c0 -->
6581 | foo
6582 <!-- c1 -->
6583 |-<!-- c2 -->
6584 <!-- c3 -->
6585 |<!-- c4 -->
6586 <!-- c5 -->
6587 |}
6588 !! html
6589 <table>
6590 <tr>
6591 <td> foo
6592 </td></tr>
6593 <tr>
6594 <td>
6595 </td></tr></table>
6596
6597 !! end
6598
6599 !! test
6600 Wikitext table comments represented in parsoid dom
6601 !! wikitext
6602 {|<!--c1--><!--c2-->
6603 |-<!--c3-->
6604 | x
6605 |}
6606 !! html/php+tidy
6607 <table>
6608 <tr>
6609 <td>x</td>
6610 </tr>
6611 </table>
6612 !! html/parsoid
6613 <table><!--c1--><!--c2-->
6614 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6615 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6616 </tbody></table>
6617 !! end
6618
6619 !! test
6620 Wikitext table with double-line table cell
6621 !! wikitext
6622 {|
6623 |a
6624 b
6625 |}
6626 !! html
6627 <table>
6628 <tr>
6629 <td>a
6630 <p>b
6631 </p>
6632 </td></tr></table>
6633
6634 !! end
6635
6636 !! test
6637 Table cell with a single comment
6638 !! wikitext
6639 {|
6640 | <!-- c1 -->
6641 | a
6642 |}
6643 !! html
6644 <table>
6645 <tr>
6646 <td>
6647 </td>
6648 <td> a
6649 </td></tr></table>
6650
6651 !! end
6652
6653 !! test
6654 Table-cell after a comment-only-empty-line
6655 !! wikitext
6656 {|
6657 |a
6658 <!--c1-->
6659 <!--c2-->| b
6660 |}
6661 !! html
6662 <table>
6663 <tr>
6664 <td>a
6665 </td>
6666 <td> b
6667 </td></tr></table>
6668
6669 !! html/parsoid
6670 <table>
6671 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6672 <!--c1-->
6673 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6674 </tbody></table>
6675
6676 !! end
6677
6678 !! test
6679 Build table with {{!}}
6680 !! wikitext
6681 {{{!}} class="wikitable"
6682 ! header
6683 ! second header
6684 {{!}}- style="color:red;"
6685 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6686 {{!}}}
6687 !! html
6688 <table class="wikitable">
6689 <tr>
6690 <th> header
6691 </th>
6692 <th> second header
6693 </th></tr>
6694 <tr style="color:red;">
6695 <td> data </td>
6696 <td style="color:red;"> second data
6697 </td></tr></table>
6698
6699 !! end
6700
6701 !! test
6702 Build table with pipe as data
6703 !! wikitext
6704 {| class="wikitable"
6705 ! header
6706 ! second header
6707 |- style="color:red;"
6708 | data || style="color:red;" | second data
6709 |-
6710 | style="color:red;" | data with | || style="color:red;" | second data with |
6711 |-
6712 || data with | ||| second data with |
6713 |}
6714 !! html
6715 <table class="wikitable">
6716 <tr>
6717 <th> header
6718 </th>
6719 <th> second header
6720 </th></tr>
6721 <tr style="color:red;">
6722 <td> data </td>
6723 <td style="color:red;"> second data
6724 </td></tr>
6725 <tr>
6726 <td style="color:red;"> data with | </td>
6727 <td style="color:red;"> second data with |
6728 </td></tr>
6729 <tr>
6730 <td> data with | </td>
6731 <td> second data with |
6732 </td></tr></table>
6733
6734 !! end
6735
6736 !! test
6737 Build table with wikilink
6738 !! wikitext
6739 {| class="wikitable"
6740 ! header || second header
6741 |- style="color:red;"
6742 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6743 |-
6744 | data || second data [[Main Page|link|text with pipe]]
6745 |}
6746 !! html
6747 <table class="wikitable">
6748 <tr>
6749 <th> header </th>
6750 <th> second header
6751 </th></tr>
6752 <tr style="color:red;">
6753 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6754 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6755 </td></tr>
6756 <tr>
6757 <td> data </td>
6758 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6759 </td></tr></table>
6760
6761 !! end
6762
6763 # The expected HTML structure in this test is debatable. The PHP parser does
6764 # not parse this kind of table at all. The main focus for Parsoid is on
6765 # round-tripping, so this output is ok for now. TODO: revisit!
6766 !! test
6767 Wikitext table with html-syntax row
6768 !! wikitext
6769 {|
6770 |-
6771 <td>foo</td>
6772 |}
6773 !! html/parsoid
6774 <table>
6775 <tbody>
6776 <tr>
6777 <td>foo</td></tr></tbody></table>
6778 !! end
6779
6780 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6781 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6782 ## PHP parser, which tidy then compounds by fostering the content
6783 ## entirely out of the table. Parsoid recognizes the table context
6784 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6785 ## depends on PHP's treatment of broken table markup!
6786 !! test
6787 Implicit <td> after a |-
6788 !! options
6789 parsoid=wt2html,html2html
6790 !! wikitext
6791 {|
6792 |-
6793 a
6794 |}
6795 !! html/php
6796 <table>
6797
6798 a
6799 </table>
6800
6801 !! html/php+tidy
6802 <p>a</p>
6803 !! html/parsoid
6804 <table>
6805 <tr><td>a</td></tr>
6806 </table>
6807 !! end
6808
6809 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6810 !! test
6811 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6812 !! options
6813 parsoid=wt2html,html2html
6814 !! wikitext
6815 {|
6816 |-
6817 |
6818 a
6819 |-
6820 b
6821 |}
6822 !! html/php
6823 <table>
6824
6825 <tr>
6826 <td>
6827 <pre>a
6828 </pre>
6829 </td></tr>
6830 b
6831 </table>
6832
6833 !! html/php+tidy
6834 <p>b</p>
6835 <table>
6836 <tr>
6837 <td>
6838 <pre>
6839 a
6840 </pre></td>
6841 </tr>
6842 </table>
6843 !! html/parsoid
6844 <table>
6845 <tbody>
6846 <tr><td><pre>a</pre></td></tr>
6847 <tr><td> b</td></tr>
6848 </tbody>
6849 </table>
6850 !! end
6851
6852 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6853 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6854 !! test
6855 Lists should be recognized in an implicit <td> context
6856 !! options
6857 parsoid=wt2html,html2html
6858 !! wikitext
6859 {|
6860 |-
6861 *a
6862 |}
6863 !! html/php
6864 <table>
6865
6866 <ul><li>a</li></ul>
6867 </table>
6868
6869 !! html/php+tidy
6870 <ul>
6871 <li>a</li>
6872 </ul>
6873 !! html/parsoid
6874 <table>
6875 <tr>
6876 <td><ul>
6877 <li>a</li>
6878 </ul></td>
6879 </tr>
6880 </table>
6881 !! end
6882
6883 !! test
6884 Table cells not properly parsed in an implicit-td context
6885 !! wikitext
6886 {|
6887 |-
6888 {{table_attribs_4}} || a || b
6889 |}
6890 !! html/php+tidy
6891 <table>
6892 <tr>
6893 <td style="background-color:#DC241f;" width="10px"></td>
6894 <td>a</td>
6895 <td>b</td>
6896 </tr>
6897 </table>
6898 !! html/parsoid
6899 <table>
6900 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6901 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
6902 </tbody></table>
6903 !! end
6904
6905 !! test
6906 Parsoid: Round-trip tables directly followed by content (bug 51219)
6907 !! options
6908 parsoid=wt2html,wt2wt
6909 !! wikitext
6910 {|
6911 |foo
6912 |} bar
6913
6914 {|
6915 |baz
6916 |}<b>quux</b>
6917 !! html+tidy
6918 <table>
6919 <tr>
6920 <td>foo</td>
6921 </tr>
6922 </table>
6923 <p>bar</p>
6924 <table>
6925 <tr>
6926 <td>baz</td>
6927 </tr>
6928 </table>
6929 <p><b>quux</b></p>
6930 !! end
6931
6932 !! test
6933 Parsoid: Default to a newline after tables in new content (bug 51219)
6934 !! options
6935 parsoid=html2wt
6936 !! html/parsoid
6937 <table><tbody>
6938 <tr><td>foo</td></tr></tbody></table> bar
6939 <table><tbody>
6940 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6941 !! wikitext
6942 {|
6943 |foo
6944 |}
6945 <nowiki> </nowiki>bar
6946 {|
6947 |baz
6948 |}
6949 '''quux'''
6950 !! end
6951
6952 !! test
6953 Parsoid: newline inducing block nodes don't suppress <nowiki>
6954 !! options
6955 parsoid=html2wt
6956 !! html/parsoid
6957 a<h1>foo</h1>
6958 !! wikitext
6959 <nowiki> </nowiki>a
6960
6961 = foo =
6962 !! end
6963
6964 !! test
6965 Parsoid: Row-syntax table headings followed by comment & table cells
6966 !! options
6967 parsoid=wt2html,wt2wt
6968 !! wikitext
6969 {|
6970 ! foo || bar
6971 <!-- foo --> || baz || quux
6972 |}
6973 !! html/php
6974 <table>
6975 <tr>
6976 <th> foo </th>
6977 <th> bar
6978 </th>
6979 <td> baz </td>
6980 <td> quux
6981 </td></tr></table>
6982
6983 !! html/parsoid
6984 <table>
6985 <tbody><tr><th> foo </th><th> bar
6986 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6987 </tbody></table>
6988 !! end
6989
6990 !!test
6991 Parsoid: Recover better from broken table attributes
6992 !!options
6993 parsoid=wt2html
6994 !!wikitext
6995 {| class="foo
6996 | class="bar" |
6997 foo
6998 |}
6999 !!html/php+tidy
7000 <table class="foo">
7001 <tr>
7002 <td class="bar">
7003 <p>foo</p>
7004 </td>
7005 </tr>
7006 </table>
7007 !!html/parsoid
7008 <table class="foo">
7009 <tr>
7010 <td class="bar">
7011 <p>foo</p></td></tr>
7012 </tbody></table>
7013 !!end
7014
7015 !! test
7016 Tables: Digest broken attributes on table and tr tag
7017 !! options
7018 parsoid=wt2html
7019 !! wikitext
7020 {| || |} ++
7021 |- || || ++ --
7022 |- > [
7023 |}
7024 !! html
7025 <table>
7026 <tbody>
7027 <tr></tr>
7028 <tr></tr>
7029 </tbody></table>
7030 !! end
7031
7032 !! test
7033 Strip unsupported table tags
7034 !! options
7035 parsoid=html2wt
7036 !! html/parsoid
7037 <table>
7038 <thead>
7039 <tr>
7040 <th>Month</th>
7041 <th>Savings</th>
7042 </tr>
7043 </thead>
7044 <tbody>
7045 <tr>
7046 <td>January</td>
7047 <td>$100</td>
7048 </tr>
7049 <tr>
7050 <td>February</td>
7051 <td>$80</td>
7052 </tr>
7053 </tbody>
7054 <tfoot>
7055 <tr>
7056 <td>Sum</td>
7057 <td>$180</td>
7058 </tr>
7059 </tfoot>
7060 </table>
7061 !! wikitext
7062 {|
7063
7064 !Month
7065 !Savings
7066
7067 |January
7068 |$100
7069
7070 |-
7071 |February
7072 |$80
7073
7074 |Sum
7075 |$180
7076
7077 |}
7078 !! end
7079
7080 !!test
7081 Testing serialization after deletion of table cells
7082 !!options
7083 parsoid={
7084 "modes": ["wt2wt", "selser"],
7085 "changes": [
7086 ["#x", "remove"]
7087 ]
7088 }
7089 !!wikitext
7090 {|
7091 !h1 !!h2 !!h3
7092 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7093 |}
7094 !! wikitext/edited
7095 {|
7096 !h1 !!h2 !!h3
7097 |c2 |||c3
7098 |}
7099 !!end
7100
7101 ###
7102 ### Internal links
7103 ###
7104 !! test
7105 Plain link, capitalized
7106 !! wikitext
7107 [[Main Page]]
7108 !! html
7109 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7110 </p>
7111 !! end
7112
7113 !! test
7114 Plain link, uncapitalized
7115 !! wikitext
7116 [[main Page]]
7117 !! html
7118 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7119 </p>
7120 !! end
7121
7122 !! test
7123 Piped link
7124 !! wikitext
7125 [[Main Page|The Main Page]]
7126 !! html
7127 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7128 </p>
7129 !! end
7130
7131 !! test
7132 Piped link with comment in link text
7133 !! wikitext
7134 [[Main Page|The Main<!--front--> Page]]
7135 !! html
7136 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7137 </p>
7138 !! end
7139
7140 !! test
7141 Piped link with multiple pipe characters in link text
7142 !! wikitext
7143 [[Main Page||The|Main|Page|]]
7144 !! html/php
7145 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7146 </p>
7147 !! html/parsoid
7148 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7149 !! end
7150
7151 !! test
7152 Piped link with no link text
7153 !! wikitext
7154 [[Thomas Bek (bishop of St David's)|]]
7155 !! html/php
7156 <p>[[Thomas Bek (bishop of St David's)|]]
7157 </p>
7158 !! html/parsoid
7159 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7160 !! end
7161
7162 !! test
7163 Broken link
7164 !! wikitext
7165 [[Zigzagzogzagzig]]
7166 !! html
7167 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7168 </p>
7169 !! end
7170
7171 !! test
7172 Broken link with fragment
7173 !! wikitext
7174 [[Zigzagzogzagzig#zug]]
7175 !! html
7176 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7177 </p>
7178 !! end
7179
7180 !! test
7181 Special page link with fragment
7182 !! wikitext
7183 [[Special:Version#anchor]]
7184 !! html
7185 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7186 </p>
7187 !! end
7188
7189 !! test
7190 Nonexistent special page link with fragment
7191 !! wikitext
7192 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7193 !! html
7194 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7195 </p>
7196 !! end
7197
7198 !! test
7199 Link with prefix
7200 !! wikitext
7201 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7202 !! html
7203 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7204 </p>
7205 !! end
7206
7207 !! test
7208 Link with suffix
7209 !! wikitext
7210 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7211 !! html
7212 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7213 </p>
7214 !! end
7215
7216 !! article
7217 prefixed article
7218 !! text
7219 Some text
7220 !! endarticle
7221
7222 !! test
7223 Bug 43661: Piped links with identical prefixes
7224 !! wikitext
7225 [[prefixed article|prefixed articles with spaces]]
7226
7227 [[prefixed article|prefixed articlesaoeu]]
7228
7229 [[Main Page|Main Page test]]
7230 !! html
7231 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7232 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7233 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7234 </p>
7235 !! end
7236
7237
7238 !! test
7239 Link with HTML entity in suffix / tail
7240 !! wikitext
7241 [[Main Page]]&quot;, [[Main Page]]&#97;
7242 !! html/php
7243 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7244 </p>
7245 !! html/parsoid
7246 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7247 !! end
7248
7249 !! test
7250 Link with 3 brackets
7251 !! wikitext
7252 [[[Main Page]]]
7253 Foo [[[Main Page]]]
7254 !! html
7255 <p>[[[Main Page]]]
7256 Foo [[[Main Page]]]
7257 </p>
7258 !! end
7259
7260 !! test
7261 Link with 4 brackets
7262 !! wikitext
7263 [[[[Main Page]]]]
7264 !! html
7265 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7266 </p>
7267 !! end
7268
7269 !! test
7270 Piped link with 3 brackets
7271 !! wikitext
7272 [[[main page|the main page]]]
7273 !! html
7274 <p>[[[main page|the main page]]]
7275 </p>
7276 !! end
7277
7278 !! test
7279 Piped link with extlink-like text
7280 !! wikitext
7281 [[Main Page|[bar]]]
7282 [[Main Page|This is a [bar]]]
7283 !! html/php
7284 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7285 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7286 </p>
7287 !! html/parsoid
7288 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7289 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7290 !! end
7291
7292 !! test
7293 Link with multiple pipes
7294 !! wikitext
7295 [[Main Page|The|Main|Page]]
7296 !! html
7297 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7298 </p>
7299 !! end
7300
7301 # Note that parsoid does not munge anchor text; all non-space
7302 # characters are valid in HTML5 ids.
7303 !! test
7304 Anchor containing a #. (bug 63430)
7305 !! wikitext
7306 [[Main Page#And#Link]]
7307 !! html/php
7308 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7309 </p>
7310 !! html/parsoid
7311 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7312 !! end
7313
7314 !! test
7315 Link to namespaces
7316 !! wikitext
7317 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7318 !! html
7319 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7320 </p>
7321 !! end
7322
7323 !! test
7324 Link with space in namespace
7325 !! wikitext
7326 [[User talk:Foo bar]]
7327 !! html
7328 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7329 </p>
7330 !! end
7331
7332 !! article
7333 MemoryAlpha:AlphaTest
7334 !! text
7335 This is an article in the MemoryAlpha namespace
7336 (which shadows the memoryalpha interwiki link).
7337 !! endarticle
7338
7339 !! test
7340 Namespace takes precedence over interwiki link (bug 51680)
7341 !! wikitext
7342 [[MemoryAlpha:AlphaTest]]
7343 !! html
7344 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7345 </p>
7346 !! end
7347
7348 # The previous test doesn't work correctly in html2*, due to not recognizing the
7349 # link as an internal one. This one checks for the correct behavior.
7350 !! test
7351 Link to namespace preferred over interwiki with correct rel attribute
7352 !! options
7353 parsoid=html2wt,html2html
7354 !! html/parsoid
7355 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7356 !! wikitext
7357 [[MemoryAlpha:AlphaTest]]
7358 !! end
7359
7360 !! test
7361 Piped link to namespace
7362 !! wikitext
7363 [[Meta:Disclaimers|The disclaimers]]
7364 !! html
7365 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7366 </p>
7367 !! end
7368
7369 !! test
7370 Link containing }
7371 !! wikitext
7372 [[Usually caused by a typo (oops}]]
7373 !! html
7374 <p>[[Usually caused by a typo (oops}]]
7375 </p>
7376 !! end
7377
7378 !! article
7379 7% Solution
7380 !! text
7381 Just a test of an article title containing a percent.
7382 !! endarticle
7383
7384 !! test
7385 Link containing % (not as a hex sequence)
7386 !! wikitext
7387 [[7% Solution]]
7388 !! html/php
7389 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7390 </p>
7391 !! html/parsoid
7392 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7393 !! end
7394
7395 # note that the parsoid HTML is identical to the previous test output,
7396 # so the previous test ensures that the html2wt mode will generate the
7397 # "not as a hex sequence" wikitext.
7398 !! test
7399 Link containing % as a single hex sequence interpreted to char
7400 !! options
7401 parsoid=wt2wt,wt2html,html2html
7402 !! wikitext
7403 [[7%25 Solution]]
7404 !! html/php
7405 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7406 </p>
7407 !! html/parsoid
7408 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7409 !!end
7410
7411 !! test
7412 Link containing % as a double hex sequence interpreted to hex sequence
7413 !! wikitext
7414 [[7%2525 Solution]]
7415 !! html
7416 <p>[[7%2525 Solution]]
7417 </p>
7418 !!end
7419
7420 # note that parsoid does not munge anchor text; all non-space
7421 # characters are valid in HTML5 anchors.
7422 !! test
7423 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7424 Example for such a section: == < ==
7425 !! wikitext
7426 [[%23%3c]][[%23%3e]]
7427 !! html/php
7428 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7429 </p>
7430 !! html/parsoid
7431 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
7432 !! end
7433
7434 !! test
7435 Link containing "<#" and ">#" as a hex sequences
7436 !! wikitext
7437 [[%3c%23]][[%3e%23]]
7438 !! html
7439 <p>[[%3c%23]][[%3e%23]]
7440 </p>
7441 !! end
7442
7443 !! test
7444 Link containing an equals sign
7445 !! wikitext
7446 [[Special:BookSources/isbn=4-00-026157-6]]
7447 !! html/php
7448 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
7449 </p>
7450 !! html/parsoid
7451 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7452 !! end
7453
7454 !! article
7455 Foo~bar
7456 !! text
7457 Just a test of an article title containing a tilde.
7458 !! endarticle
7459
7460 # note that links containing signatures, like [[Foo~~~~]], are
7461 # massaged by the pre-save transform (PST) and so the tildes are never
7462 # seen by the parser.
7463 !! test
7464 Link containing a tilde
7465 !! wikitext
7466 [[Foo~bar]]
7467 !! html/php
7468 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7469 </p>
7470 !! html/parsoid
7471 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7472 !! end
7473
7474 !! test
7475 Link containing double-single-quotes '' (bug 4598)
7476 !! wikitext
7477 [[Lista d''e paise d''o munno]]
7478 !! html/php
7479 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
7480 </p>
7481 !! html/parsoid
7482 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7483 !! end
7484
7485 !! test
7486 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7487 !! wikitext
7488 Some [[Link|pretty ''italics'' and stuff]]!
7489 !! html/php
7490 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
7491 </p>
7492 !! html/parsoid
7493 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7494 !! end
7495
7496 !! test
7497 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7498 !! wikitext
7499 ''Some [[Link|pretty ''italics'' and stuff]]!''
7500 !! html
7501 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
7502 </p>
7503 !! end
7504
7505 !! test
7506 Link with double quotes in title part (literal) and alternate part (interpreted)
7507 !! wikitext
7508 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7509
7510 [[''Pentecoste'']]
7511
7512 [[''Pentecoste''|Pentecoste]]
7513
7514 [[''Pentecoste''|''Pentecoste'']]
7515 !! html/php
7516 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
7517 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
7518 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
7519 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
7520 </p>
7521 !! html/parsoid
7522 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
7523 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7524 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7525 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7526 !! end
7527
7528 !! test
7529 Broken image links with HTML captions (bug 39700)
7530 !! wikitext
7531 [[File:Nonexistent|<script></script>]]
7532 [[File:Nonexistent|100x100px|<script></script>]]
7533 [[File:Nonexistent|&lt;]]
7534 [[File:Nonexistent|a<i>b</i>c]]
7535 !! html/php
7536 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7537 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7538 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7539 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7540 </p>
7541 !! html/parsoid
7542 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7543 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
7544 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;lt;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;&lt;&amp;quot;,&amp;quot;dsr&amp;quot;:[107,111,null,null]}\">&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7545 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[134,142,3,4]}\">b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7546 !! end
7547
7548 !! test
7549 Plain link to URL
7550 !! wikitext
7551 [[http://www.example.com]]
7552 !! html/php
7553 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7554 </p>
7555 !! html/parsoid
7556 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7557 !! end
7558
7559 !! test
7560 Plain link to URL with link text
7561 !! wikitext
7562 [[http://www.example.com Link text]]
7563 !! html
7564 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7565 </p>
7566 !! end
7567
7568 !! test
7569 Plain link to protocol-relative URL
7570 !! wikitext
7571 [[//www.example.com]]
7572 !! html/php
7573 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7574 </p>
7575 !! html/parsoid
7576 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7577 !! end
7578
7579 !! test
7580 Plain link to protocol-relative URL with link text
7581 !! wikitext
7582 [[//www.example.com Link text]]
7583 !! html
7584 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7585 </p>
7586 !! end
7587
7588 !! test
7589 Plain link to page with question mark in title
7590 !! wikitext
7591 [[A?b]]
7592
7593 [[A?b|Baz]]
7594 !! html
7595 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7596 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7597 </p>
7598 !! end
7599
7600
7601 # I'm fairly sure the expected result here is wrong.
7602 # We want these to be URL links, not pseudo-pages with URLs for titles....
7603 # However the current output is also pretty screwy.
7604 #
7605 # ----
7606 # I'm changing it to match the current output--it arguably makes more
7607 # sense in the light of the test above. Old expected result was:
7608 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7609 #</p>
7610 # But I think this test is bordering on "garbage in, garbage out" anyway.
7611 # -- wtm
7612 !! test
7613 Piped link to URL
7614 !! wikitext
7615 Piped link to URL: [[http://www.example.com|an example URL]]
7616 !! html/php
7617 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7618 </p>
7619 !! html/parsoid
7620 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7621 !! end
7622
7623 !! test
7624 BUG 2: [[page|http://url/]] should link to page, not http://url/
7625 !! wikitext
7626 [[Main Page|http://url/]]
7627 !! html/php
7628 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7629 </p>
7630 !! html/parsoid
7631 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7632 !! end
7633
7634 # Parsoid does not mark self-links, by design.
7635 !! test
7636 BUG 337: Escaped self-links should be bold
7637 !! options
7638 title=[[Bug462]]
7639 !! wikitext
7640 [[Bu&#103;462]] [[Bug462]]
7641 !! html/php
7642 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7643 </p>
7644 !! html/php+tidy
7645 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7646 !! html/parsoid
7647 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7648 !! end
7649
7650 !! test
7651 Self-link to section should not be bold
7652 !! options
7653 title=[[Main Page]]
7654 !! wikitext
7655 [[Main Page#section]]
7656 !! html
7657 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7658 </p>
7659 !! end
7660
7661 !! article
7662 00
7663 !! text
7664 This is 00.
7665 !! endarticle
7666
7667 !!test
7668 Self-link to numeric title
7669 !!options
7670 title=[[0]]
7671 !! wikitext
7672 [[0]]
7673 !! html
7674 <p><strong class="selflink">0</strong>
7675 </p>
7676 !!end
7677
7678 !!test
7679 Link to numeric-equivalent title
7680 !!options
7681 title=[[0]]
7682 !! wikitext
7683 [[00]]
7684 !! html
7685 <p><a href="/wiki/00" title="00">00</a>
7686 </p>
7687 !!end
7688
7689 !! test
7690 <nowiki> inside a link
7691 !! wikitext
7692 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7693 !! html
7694 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7695 </p>
7696 !! end
7697
7698 !! test
7699 Non-breaking spaces in title
7700 !! wikitext
7701 [[&nbsp; Main &nbsp; Page &nbsp;]]
7702 !! html
7703 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7704 </p>
7705 !!end
7706
7707 !! test
7708 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7709 !! options
7710 language=ca
7711 !! wikitext
7712 '''[[Main Page]]'''
7713 !! html
7714 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7715 </p>
7716 !! end
7717
7718 !! test
7719 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7720 !! options
7721 language=ca
7722 !! wikitext
7723 ''[[Main Page]]''
7724 !! html
7725 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7726 </p>
7727 !! end
7728
7729 !! test
7730 Internal link with en linktrail: no apostrophes (bug 27473)
7731 !! options
7732 language=en
7733 !! wikitext
7734 [[Something]]'nice
7735 !! html
7736 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7737 </p>
7738 !! end
7739
7740 !! test
7741 Internal link with ca linktrail with apostrophes (bug 27473)
7742 !! options
7743 language=ca
7744 !! wikitext
7745 [[Something]]'nice
7746 !! html
7747 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7748 </p>
7749 !! end
7750
7751 !! test
7752 Internal link with kaa linktrail with apostrophes (bug 27473)
7753 !! options
7754 language=kaa
7755 !! wikitext
7756 [[Something]]'nice
7757 !! html
7758 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
7759 </p>
7760 !! end
7761
7762 !! test
7763 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7764 !! wikitext
7765 [[User:Foo/Test/63636:Bar|Test]]
7766 !! html/php
7767 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
7768 </p>
7769 !! html/parsoid
7770 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7771 !! end
7772
7773 !! test
7774 Purely hash wikilink
7775 !! options
7776 title=[[User:test/123]]
7777 !! wikitext
7778 [[#a|b]]
7779 !! html/php
7780 <p><a href="#a">b</a>
7781 </p>
7782 !! html/parsoid
7783 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
7784 !! end
7785
7786 !! test
7787 1. Interaction of linktrail and template encapsulation
7788 !! options
7789 parsoid
7790 !! wikitext
7791 {{echo|[[Foo]]}}l
7792 !! html
7793 <p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
7794 !! end
7795
7796 !! test
7797 2. Interaction of linktrail and template encapsulation
7798 !! options
7799 parsoid
7800 !! wikitext
7801 {{echo|Some [[Fool]]}}s
7802 !! html
7803 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
7804 !! end
7805
7806 !! test
7807 3. Interaction of linktrail and template encapsulation
7808 !! options
7809 parsoid
7810 !! wikitext
7811 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7812 !! html
7813 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
7814 !! end
7815
7816 !! article
7817 Söfnuður
7818 !! text
7819 Test.
7820 !! endarticle
7821
7822 !! test
7823 Internal link with is link prefix
7824 !! options
7825 language=is
7826 !! wikitext
7827 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7828 !! html
7829 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7830 </p>
7831 !! end
7832
7833 !! article
7834 Mótmælendatrú
7835 !! text
7836 Test.
7837 !! endarticle
7838
7839 !! test
7840 Internal link with is link trail and link prefix
7841 !! options
7842 language=is
7843 !! wikitext
7844 [[mótmælendatrú|xxx]]ar
7845 [[mótmælendatrú]]ar
7846 mótmælenda[[söfnuður]]
7847 mótmælenda[[söfnuður|söfnuðir]]
7848 mótmælenda[[söfnuður|söfnuðir]]xxx
7849 !! html
7850 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7851 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7852 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7853 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7854 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7855 </p>
7856 !! end
7857
7858 !! test
7859 Parsoid link trail escaping
7860 !! options
7861 parsoid=html2wt,html2html
7862 !! html/parsoid
7863 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7864 !! wikitext
7865 [[apple]]<nowiki/>s
7866 !! end
7867
7868 !! test
7869 Parsoid link prefix escaping
7870 !! options
7871 language=is
7872 parsoid=html2wt,html2html
7873 !! html/parsoid
7874 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7875 !! wikitext
7876 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7877 !! end
7878
7879 !! test
7880 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7881 !! wikitext
7882 [[Foo| bar]]
7883
7884 [[Foo| ''bar'']]
7885
7886 [http://wp.org foo]
7887
7888 [http://wp.org ''foo'']
7889 !! html
7890 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7891 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7892 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7893 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7894 </p>
7895 !! end
7896
7897 !! test
7898 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7899 !! options
7900 parsoid
7901 !! wikitext
7902 [[Foo|{{echo|a}} b {{echo|c}}]]
7903 !! html
7904 <p><a rel="mw:WikiLink" href="Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
7905 !! end
7906
7907 !! test
7908 Link with angle bracket after anchor
7909 !! wikitext
7910 [[Foo#<bar>]]
7911 !! html/php
7912 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7913 </p>
7914 !! html/parsoid
7915 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
7916 !! end
7917
7918 ###
7919 ### Interwiki links (see maintenance/interwiki.sql)
7920 ###
7921
7922 !! test
7923 Inline interwiki link
7924 !! options
7925 parsoid=wt2html,wt2wt,html2html
7926 !! wikitext
7927 [[MeatBall:SoftSecurity]]
7928 !! html/php
7929 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7930 </p>
7931 !! html/parsoid
7932 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7933 !! end
7934
7935 !! test
7936 Inline interwiki link with empty title (bug 2372)
7937 !! options
7938 parsoid=wt2html,wt2wt,html2html
7939 !! wikitext
7940 [[MeatBall:]]
7941 !! html/php
7942 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7943 </p>
7944 !! html/parsoid
7945 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7946 !! end
7947
7948 !! test
7949 Interwiki link encoding conversion (bug 1636)
7950 !! wikitext
7951 *[[Wikipedia:ro:Olteni&#0355;a]]
7952 *[[Wikipedia:ro:Olteni&#355;a]]
7953 !! html
7954 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
7955 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
7956
7957 !! html+tidy
7958 <ul>
7959 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
7960 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
7961 </ul>
7962 !! end
7963
7964 !! test
7965 Interwiki link with fragment (bug 2130)
7966 !! wikitext
7967 [[MeatBall:SoftSecurity#foo]]
7968 !! html
7969 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7970 </p>
7971 !! end
7972
7973 # Ideally the wikipedia: prefix here should be proto-relative too
7974 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7975 # define the 'en' prefix, and originally the test used 'wikipedia',
7976 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7977 # article.
7978 !! test
7979 Different interwiki prefixes mapping to the same URL
7980 !! wikitext
7981 [[:en:Foo]]
7982
7983 [[:en:Foo|Foo]]
7984
7985 [[wikipedia:Foo]]
7986
7987 [[:wikipedia:Foo|Foo]]
7988
7989 [[wikipedia:en:Foo]]
7990
7991 [[:wikipedia:en:Foo]]
7992
7993 [[ wikiPEdia :Foo]]
7994 !! html/parsoid
7995 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
7996
7997 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
7998
7999 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
8000
8001 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
8002
8003 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8004
8005 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8006
8007 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
8008 !! end
8009
8010 !! test
8011 Interwiki links that cannot be represented in wiki syntax
8012 !! wikitext
8013 [[meatball:ok]]
8014 [[meatball:ok#foo|ok with fragment]]
8015 [[meatball:ok_as_well?|ok ending with ? mark]]
8016 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8017 [http://de.wikipedia.org/wiki/#foo is just fragment]
8018
8019 !! html/php
8020 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8021 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8022 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
8023 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8024 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8025 </p>
8026 !! html/parsoid
8027 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8028 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8029 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8030 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8031 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8032 !! end
8033
8034 !! test
8035 Interwiki links: trail
8036 !! wikitext
8037 [[wikipedia:Foo|Ba]]r
8038 !! html/php
8039 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8040 </p>
8041 !! html/parsoid
8042 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8043 !! end
8044
8045 !! test
8046 Local interwiki link
8047 !! options
8048 parsoid=wt2html,wt2wt,html2html
8049 !! wikitext
8050 [[local:Template:Foo]]
8051 !! html/php
8052 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8053 </p>
8054 !! html/parsoid
8055 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8056 !! end
8057
8058 # Parsoid does not mark self-links, by design.
8059 !! test
8060 Local interwiki link: self-link to current page
8061 !! options
8062 title=[[Main Page]]
8063 parsoid=wt2html,wt2wt,html2html
8064 !! wikitext
8065 [[local:Main Page]]
8066 !! html/php
8067 <p><strong class="selflink">local:Main Page</strong>
8068 </p>
8069 !! html/parsoid
8070 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8071 !! end
8072
8073 !! test
8074 Local interwiki link: prefix only (bug 64167)
8075 !! options
8076 parsoid=wt2html,wt2wt,html2html
8077 !! wikitext
8078 [[local:]]
8079 !! html/php
8080 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8081 </p>
8082 !! html/parsoid
8083 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8084 !! end
8085
8086 !! test
8087 Local interwiki link: with additional interwiki prefix (bug 61357)
8088 !! options
8089 parsoid=wt2html,wt2wt,html2html
8090 !! wikitext
8091 [[local:meatball:Hello]]
8092 !! html/php
8093 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8094 </p>
8095 !! html/parsoid
8096 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8097 !! end
8098
8099 !! test
8100 Multiple local interwiki link prefixes
8101 !! wikitext
8102 [[local:local:local:local:mi:local:Foo]]
8103 !! options
8104 parsoid=wt2html,wt2wt,html2html
8105 !! html/php
8106 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8107 </p>
8108 !! html/parsoid
8109 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8110 !! end
8111
8112 ###
8113 ### Interlanguage links
8114 ### Language links (so that searching for '### language' matches..)
8115 ###
8116
8117 !! test
8118 Interlanguage link
8119 !! options
8120 parsoid=wt2html,wt2wt,html2html
8121 !! wikitext
8122 Blah blah blah
8123 [[zh:Chinese]]
8124 !! html/php
8125 <p>Blah blah blah
8126 </p>
8127 !! html/parsoid
8128 <p>Blah blah blah</p>
8129 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8130 !! end
8131
8132 !! test
8133 Interlanguage link with spacing
8134 !! options
8135 parsoid=wt2html,wt2wt,html2html
8136 !! wikitext
8137 Blah blah blah
8138 [[ zh : Chinese ]]
8139 !! html/php
8140 <p>Blah blah blah
8141 </p>
8142 !! html/parsoid
8143 <p>Blah blah blah</p>
8144 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8145 !! end
8146
8147 !! test
8148 Double interlanguage link
8149 !! options
8150 parsoid=wt2html,wt2wt,html2html
8151 !! wikitext
8152 Blah blah blah
8153 [[es:Spanish]]
8154 [[zh:Chinese]]
8155 !! html/php
8156 <p>Blah blah blah
8157 </p>
8158 !! html/parsoid
8159 <p>Blah blah blah</p>
8160 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8161 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8162 !! end
8163
8164 !! test
8165 Interlanguage link variations
8166 !! options
8167 parsoid=wt2html,wt2wt,html2html
8168 !! wikitext
8169 Blah blah blah
8170 [[ es :Spanish]]
8171 [[ ZH :Chinese]]
8172 [[es:Foo_bar]]
8173 !! html/php
8174 <p>Blah blah blah
8175 </p>
8176 !! html/parsoid
8177 <p>Blah blah blah</p>
8178 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8179 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8180 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8181 !! end
8182
8183 !! test
8184 Space and question mark encoding in interlanguage links (T95473)
8185 !! options
8186 parsoid=wt2html,wt2wt,html2html
8187 !! wikitext
8188 Blah blah blah
8189 [[es:Foo bar?]]
8190 !! html/php
8191 <p>Blah blah blah
8192 </p>
8193 !! html/parsoid
8194 <p>Blah blah blah</p>
8195 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8196 !! end
8197
8198 !! test
8199 Interlanguage link, with prefix links
8200 !! options
8201 language=ln
8202 !! wikitext
8203 Blah blah blah
8204 [[zh:Chinese]]
8205 !! html/php
8206 <p>Blah blah blah
8207 </p>
8208 !! html/parsoid
8209 <p>Blah blah blah</p>
8210 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8211 !! end
8212
8213 !! test
8214 Double interlanguage link, with prefix links (bug 8897)
8215 !! options
8216 language=ln
8217 !! wikitext
8218 Blah blah blah
8219 [[es:Spanish]]
8220 [[zh:Chinese]]
8221 !! html/php
8222 <p>Blah blah blah
8223 </p>
8224 !! html/parsoid
8225 <p>Blah blah blah</p>
8226 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8227 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8228 !! end
8229
8230 !! test
8231 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8232 !! wikitext
8233 Blah blah blah
8234 [[mul:Article]]
8235 !! html/php
8236 <p>Blah blah blah
8237 </p>
8238 !! html/parsoid
8239 <p>Blah blah blah</p>
8240 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8241 !! end
8242
8243 !! test
8244 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8245 !! options
8246 language=ln
8247 !! wikitext
8248 [[WW&nbsp;II]]
8249 !! html
8250 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
8251 </p>
8252 !! end
8253
8254 !! test
8255 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8256 !! options
8257 parsoid=html2wt
8258 !! html/parsoid
8259 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8260 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8261 !! wikitext
8262 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8263
8264 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8265 !! end
8266
8267 !! test
8268 Parsoid: handle constructor well
8269 !! wikitext
8270 [[constructor]]
8271
8272 [[constructor:foo]]
8273 !! html/php
8274 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8275 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
8276 </p>
8277 !! html/parsoid
8278 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
8279
8280 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
8281 !! end
8282
8283 !! article
8284 ko:
8285 !! text
8286 Test.
8287 !! endarticle
8288
8289 # Note that `ko` isn't a known interlanguage prefix
8290 !! test
8291 Parsoid: recognize interlanguage links without a target page
8292 !! options
8293 ill
8294 !! wikitext
8295 [[es:]]
8296
8297 [[ko:]]
8298 !! html/php
8299 es:
8300 !! html/parsoid
8301 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8302
8303 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8304 !! end
8305
8306 # Note that `ko` isn't a known interwiki prefix
8307 !! test
8308 Parsoid: recognize interwiki links without a target page
8309 !! options
8310 parsoid=wt2html,wt2wt,html2html
8311 !! wikitext
8312 [[:es:]]
8313
8314 [[:ko:]]
8315 !! html/php
8316 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8317 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8318 </p>
8319 !! html/parsoid
8320 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8321 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8322 !! end
8323
8324 !! test
8325 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8326 !! wikitext
8327 [[mi:Foo]]
8328 !! html/php
8329 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8330 </p>
8331 !! html/parsoid
8332 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8333 !! end
8334
8335 !! test
8336 Interlanguage link with preceding local interwiki link (bug 68085)
8337 !! options
8338 parsoid=wt2html,wt2wt,html2html
8339 !! wikitext
8340 Blah blah blah
8341 [[local:es:Spanish]]
8342 !! html/php
8343 <p>Blah blah blah
8344 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8345 </p>
8346 !! html/parsoid
8347 <p>Blah blah blah
8348 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8349 !! end
8350
8351 !! test
8352 Looks like an interlanguage link, but is actually a local interwiki
8353 !! options
8354 parsoid=wt2html,wt2wt,html2html
8355 !! wikitext
8356 Blah blah blah
8357 [[mi:Template:Foo]]
8358 !! html/php
8359 <p>Blah blah blah
8360 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8361 </p>
8362 !! html/parsoid
8363 <p>Blah blah blah
8364 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8365 !! end
8366
8367 ###
8368 ### Redirects, Parsoid-only
8369 ###
8370
8371 !! test
8372 1. Simple redirect to page
8373 !! wikitext
8374 #REDIRECT [[Main Page]]
8375 !! html/parsoid
8376 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8377 !! end
8378
8379 !! test
8380 2. Other redirect variants
8381 !! wikitext
8382 #REDIRECT [[Main_Page]]
8383 !! html/parsoid
8384 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8385 !! end
8386
8387 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8388 # This tests the Parsoid bail-out code.
8389 !! test
8390 3. Other redirect variants
8391 !! wikitext
8392 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8393 !! html/parsoid
8394 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8395 !! end
8396
8397 !! test
8398 4. Redirect to a templated destination
8399 !! wikitext
8400 #REDIRECT [[{{echo|Foo}}bar]]
8401 !! html/parsoid
8402 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[12,24,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8403 !! end
8404
8405 !! test
8406 Empty redirect
8407 !! options
8408 parsoid=wt2html,wt2wt
8409 !! wikitext
8410 #REDIRECT [[]]
8411 !! html/parsoid
8412 <ol>
8413 <li>REDIRECT [[]]</li></ol>
8414 !! end
8415
8416 !! test
8417 Optional colon in #REDIRECT
8418 !! options
8419 # the colon is archaic syntax. we support it for wt2html, but we
8420 # don't care that it roundtrips back to the modern syntax.
8421 parsoid=wt2html,html2html
8422 !! wikitext
8423 #REDIRECT:[[Main Page]]
8424 !! html/parsoid
8425 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8426 !! end
8427
8428 !! test
8429 Whitespace in #REDIRECT with optional colon
8430 !! options
8431 # the colon and gratuitous whitespace is archaic syntax. we support
8432 # it for wt2html, but we don't care that it roundtrips back to the
8433 # modern syntax (without extra whitespace)
8434 parsoid=wt2html,html2html
8435 !! wikitext
8436
8437 #REDIRECT
8438 :
8439 [[Main Page]]
8440 !! html/parsoid
8441 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8442 !! end
8443
8444 !! test
8445 Piped link in #REDIRECT
8446 !! options
8447 # content after piped link is ignored. we support this syntax,
8448 # but don't care that the piped link is lost when we roundtrip this.
8449 parsoid=wt2html
8450 !! wikitext
8451 #REDIRECT [[Main Page|bar]]
8452 !! html/parsoid
8453 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8454 !! end
8455
8456 !! test
8457 Redirect to category (T104502)
8458 !! options
8459 parsoid=wt2html,wt2wt
8460 !! wikitext
8461 #REDIRECT [[Category:Foo]]
8462 !! html/parsoid
8463 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8464 !! end
8465
8466 !! test
8467 Redirect to category with URL encoding (T104502)
8468 !! options
8469 parsoid=wt2html
8470 !! wikitext
8471 #REDIRECT [[Category%3AFoo]]
8472 !! html/parsoid
8473 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8474 !! end
8475
8476 !! test
8477 Redirect to category page
8478 !! wikitext
8479 #REDIRECT [[:Category:Foo]]
8480 !! html/parsoid
8481 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8482 !! end
8483
8484 !! test
8485 Redirect to image page (1)
8486 !! wikitext
8487 #REDIRECT [[File:Wiki.png]]
8488 !! html/parsoid
8489 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8490 !! end
8491
8492 !! test
8493 Redirect to image page (2)
8494 !! wikitext
8495 #REDIRECT [[Image:Wiki.png]]
8496 !! html/parsoid
8497 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8498 !! end
8499
8500 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8501 # Next test confirms this.
8502 !! test
8503 Redirect to language (1) (T104918)
8504 !! options
8505 parsoid=wt2html,wt2wt,html2html
8506 !! wikitext
8507 #REDIRECT [[en:File:Wiki.png]]
8508 !! html/parsoid
8509 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8510 !! end
8511
8512 !! test
8513 Redirect to language (2) (T104918)
8514 !! wikitext
8515 #REDIRECT [[:en:File:Wiki.png]]
8516 !! html/parsoid
8517 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8518 !! end
8519
8520 !! test
8521 Redirect to interwiki (T104918)
8522 !! wikitext
8523 #REDIRECT [[meatball:File:Wiki.png]]
8524 !! html/parsoid
8525 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8526 !! end
8527
8528 !! test
8529 Non-English #REDIRECT
8530 !! options
8531 language=is
8532 !! wikitext
8533 #TILVÍSUN [[Main Page]]
8534 !! html/parsoid
8535 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8536 !! end
8537
8538 !! test
8539 Redirect syntax under text isn't considered a redirect
8540 !! wikitext
8541 some text
8542 #redirect [[Main Page]]
8543 !! html/parsoid
8544 <p>some text</p>
8545 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
8546 !! end
8547
8548 # FIXME: Should hoist the redirect to the top of the page and ensure there
8549 # is only one.
8550 !! test
8551 New redirect
8552 !! options
8553 parsoid=html2wt
8554 !! html/parsoid
8555 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8556 !! wikitext
8557 Foo
8558 #REDIRECT [[Foo]]
8559 !! end
8560
8561 ##
8562 ## XHTML tidiness
8563 ###
8564
8565 !! test
8566 <br> to <br />
8567 !! wikitext
8568 1<br>2<br />3
8569 !! html
8570 <p>1<br />2<br />3
8571 </p>
8572 !! end
8573
8574 !! test
8575 Broken br tag sanitization
8576 !! wikitext
8577 </br>
8578 !! html/php
8579 <p>&lt;/br&gt;
8580 </p>
8581 !! end
8582
8583 # TODO: Fix html2html mode (bug 51055)!
8584 !! test
8585 Parsoid: Broken br tag recognition
8586 !! options
8587 parsoid=wt2html
8588 !! wikitext
8589 </br>
8590
8591 <br/ >
8592 !! html+tidy
8593 <p><br /></p>
8594 <p><br /></p>
8595 !! end
8596
8597 !! test
8598 Incorrecly removing closing slashes from correctly formed XHTML
8599 !! wikitext
8600 <br style="clear:both;" />
8601 !! html
8602 <p><br style="clear:both;" />
8603 </p>
8604 !! end
8605
8606 !! test
8607 Failing to transform badly formed HTML into correct XHTML
8608 !! wikitext
8609 <br style="clear: left;">
8610 <br style="clear: right;">
8611 <br style="clear: both;">
8612 !! html
8613 <p><br style="clear: left;" />
8614 <br style="clear: right;" />
8615 <br style="clear: both;" />
8616 </p>
8617 !!end
8618
8619 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8620 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8621 !! test
8622 Handling html with a div self-closing tag
8623 !! wikitext
8624 <div title />
8625 <div title/>
8626 <div title/ >
8627 <div title=bar />
8628 <div title=bar/>
8629 <div title=bar/ >
8630 !! html/php
8631 <p>&lt;div title /&gt;
8632 &lt;div title/&gt;
8633 </p>
8634 <div>
8635 <p>&lt;div title=bar /&gt;
8636 &lt;div title=bar/&gt;
8637 </p>
8638 <div title="bar/"></div>
8639 </div>
8640
8641 !! html/parsoid
8642 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8643 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8644 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8645 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8646 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8647 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8648 !! end
8649
8650 !! test
8651 Handling html with a br self-closing tag
8652 !! wikitext
8653 <br title />
8654 <br title/>
8655 <br title/ >
8656 <br title=bar />
8657 <br title=bar/>
8658 <br title=bar/ >
8659 !! html/php
8660 <p><br title="" />
8661 <br title="" />
8662 <br />
8663 <br title="bar" />
8664 <br title="bar" />
8665 <br title="bar/" />
8666 </p>
8667 !! html/parsoid
8668 <p><br title="" />
8669 <br title="" />
8670 <br title="" />
8671 <br title="bar" />
8672 <br title="bar" />
8673 <br title="bar/" />
8674 </p>
8675 !! end
8676
8677 !! test
8678 Horizontal ruler (should it add that extra space?)
8679 !! wikitext
8680 <hr>
8681 <hr >
8682 foo <hr
8683 > bar
8684 !! html+tidy
8685 <hr />
8686 <hr />
8687 <p>foo</p>
8688 <hr />
8689 <p>bar</p>
8690 !! end
8691
8692 !! test
8693 Horizontal ruler -- 4+ dashes render hr
8694 !! wikitext
8695 ----
8696 !! html
8697 <hr />
8698
8699 !! end
8700
8701 !! test
8702 Horizontal ruler -- eats additional dashes on the same line
8703 !! wikitext
8704 ---------
8705 !! html
8706 <hr />
8707
8708 !! end
8709
8710 !! test
8711 Horizontal ruler -- does not collapse dashes on consecutive lines
8712 !! wikitext
8713 ----
8714 ----
8715 !! html
8716 <hr />
8717 <hr />
8718
8719 !! end
8720
8721 !! test
8722 Horizontal ruler -- <4 dashes render as plain text
8723 !! wikitext
8724 ---
8725 !! html
8726 <p>---
8727 </p>
8728 !! end
8729
8730 !! test
8731 Horizontal ruler -- Supports content following dashes on same line
8732 !! wikitext
8733 ---- Foo
8734 !! html
8735 <hr /> Foo
8736
8737 !! html+tidy
8738 <hr />
8739 <p>Foo</p>
8740 !! end
8741
8742 ###
8743 ### Block-level elements
8744 ###
8745 !! test
8746 Common list
8747 !! wikitext
8748 *Common list
8749 * item 2
8750 *item 3
8751 !! html
8752 <ul><li>Common list</li>
8753 <li> item 2</li>
8754 <li>item 3</li></ul>
8755
8756 !! end
8757
8758 !! test
8759 Numbered list
8760 !! wikitext
8761 #Numbered list
8762 #item 2
8763 # item 3
8764 !! html
8765 <ol><li>Numbered list</li>
8766 <li>item 2</li>
8767 <li> item 3</li></ol>
8768
8769 !! end
8770
8771 !! test
8772 Mixed list
8773 !! wikitext
8774 *Mixed list
8775 *# with numbers
8776 ** and bullets
8777 *# and numbers
8778 *bullets again
8779 **bullet level 2
8780 ***bullet level 3
8781 ***#Number on level 4
8782 **bullet level 2
8783 **#Number on level 3
8784 **#Number on level 3
8785 *#number level 2
8786 *Level 1
8787 *** Level 3
8788 #** Level 3, but ordered
8789 !! html
8790 <ul><li>Mixed list
8791 <ol><li> with numbers</li></ol>
8792 <ul><li> and bullets</li></ul>
8793 <ol><li> and numbers</li></ol></li>
8794 <li>bullets again
8795 <ul><li>bullet level 2
8796 <ul><li>bullet level 3
8797 <ol><li>Number on level 4</li></ol></li></ul></li>
8798 <li>bullet level 2
8799 <ol><li>Number on level 3</li>
8800 <li>Number on level 3</li></ol></li></ul>
8801 <ol><li>number level 2</li></ol></li>
8802 <li>Level 1
8803 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8804 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8805
8806 !! end
8807
8808 !! test
8809 1. Nested mixed wikitext and html list
8810 !! wikitext
8811 * hi
8812 * <ul><li>ho</li></ul>
8813 * hi
8814 ** ho
8815 !! html/php
8816 <ul><li> hi</li>
8817 <li> <ul><li>ho</li></ul></li>
8818 <li> hi
8819 <ul><li> ho</li></ul></li></ul>
8820
8821 !! html/parsoid
8822 <ul><li> hi</li>
8823 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8824 <li> hi
8825 <ul><li> ho</li></ul></li></ul>
8826 !! end
8827
8828 !! test
8829 2. Nested mixed wikitext and html list (incompatible)
8830 !! wikitext
8831 ; hi
8832 : {{echo|<li>ho</li>}}
8833 !! html/php
8834 <dl><dt> hi</dt>
8835 <dd> <li>ho</li></dd></dl>
8836
8837 !! html/parsoid
8838 <dl><dt> hi</dt>
8839 <dd> <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
8840 !! end
8841
8842 !! test
8843 Nested lists 1
8844 !! wikitext
8845 *foo
8846 **bar
8847 !! html
8848 <ul><li>foo
8849 <ul><li>bar</li></ul></li></ul>
8850
8851 !! end
8852
8853 !! test
8854 Nested lists 2
8855 !! wikitext
8856 **foo
8857 *bar
8858 !! html
8859 <ul><li><ul><li>foo</li></ul></li>
8860 <li>bar</li></ul>
8861
8862 !! end
8863
8864 !! test
8865 Nested lists 3 (first element empty)
8866 !! wikitext
8867 *
8868 **bar
8869 !! html
8870 <ul><li>
8871 <ul><li>bar</li></ul></li></ul>
8872
8873 !! end
8874
8875 !! test
8876 Nested lists 4 (first element empty)
8877 !! wikitext
8878 **
8879 *bar
8880 !! html
8881 <ul><li><ul><li></li></ul></li>
8882 <li>bar</li></ul>
8883
8884 !! end
8885
8886 !! test
8887 Nested lists 5 (both elements empty)
8888 !! wikitext
8889 **
8890 *
8891 !! html
8892 <ul><li><ul><li></li></ul></li>
8893 <li></li></ul>
8894
8895 !! end
8896
8897 !! test
8898 Nested lists 6 (both elements empty)
8899 !! wikitext
8900 *
8901 **
8902 !! html
8903 <ul><li>
8904 <ul><li></li></ul></li></ul>
8905
8906 !! end
8907
8908 !! test
8909 Nested lists 7 (skip initial nesting levels)
8910 !! wikitext
8911 *** foo
8912 !! html
8913 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8914
8915 !! end
8916
8917 !! test
8918 Nested lists 8 (multiple nesting transitions)
8919 !! wikitext
8920 * foo
8921 *** bar
8922 ** baz
8923 * boo
8924 !! html
8925 <ul><li> foo
8926 <ul><li><ul><li> bar</li></ul></li>
8927 <li> baz</li></ul></li>
8928 <li> boo</li></ul>
8929
8930 !! end
8931
8932 !! test
8933 Nested lists 9 (extension interaction)
8934 !! options
8935 parsoid
8936 !! wikitext
8937 *<references />
8938 !! html/parsoid
8939 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8940 !! end
8941
8942 !! test
8943 1. Lists with start-of-line-transparent tokens before bullets: Comments
8944 !! wikitext
8945 *foo
8946 *<!--cmt-->bar
8947 <!--cmt-->*baz
8948 !! html
8949 <ul><li>foo</li>
8950 <li>bar</li>
8951 <li>baz</li></ul>
8952
8953 !! end
8954
8955 !! test
8956 2. Lists with start-of-line-transparent tokens before bullets: Template close
8957 !! wikitext
8958 *foo {{echo|bar
8959 }}*baz
8960 !! html
8961 <ul><li>foo bar</li>
8962 <li>baz</li></ul>
8963
8964 !! end
8965
8966 !! test
8967 List items are not parsed correctly following a <pre> block (bug 785)
8968 !! wikitext
8969 * <pre>foo</pre>
8970 * <pre>bar</pre>
8971 * zar
8972 !! html/php
8973 <ul><li> <pre>foo</pre></li>
8974 <li> <pre>bar</pre></li>
8975 <li> zar</li></ul>
8976
8977 !! html/parsoid
8978 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8979 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8980 <li> zar</li></ul>
8981 !! end
8982
8983 !! test
8984 List items from template
8985 !! wikitext
8986
8987 {{inner list}}
8988 * item 2
8989
8990 * item 0
8991 {{inner list}}
8992 * item 2
8993
8994 * item 0
8995 * notSOL{{inner list}}
8996 * item 2
8997 !! html
8998 <ul><li> item 1</li>
8999 <li> item 2</li></ul>
9000 <ul><li> item 0</li>
9001 <li> item 1</li>
9002 <li> item 2</li></ul>
9003 <ul><li> item 0</li>
9004 <li> notSOL</li>
9005 <li> item 1</li>
9006 <li> item 2</li></ul>
9007
9008 !! end
9009
9010 !! test
9011 List interrupted by empty line or heading
9012 !! wikitext
9013 * foo
9014
9015 ** bar
9016 == A heading ==
9017 * Another list item
9018 !! html
9019 <ul><li> foo</li></ul>
9020 <ul><li><ul><li> bar</li></ul></li></ul>
9021 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9022 <ul><li> Another list item</li></ul>
9023
9024 !!end
9025
9026 !!test
9027 Multiple list tags generated by templates
9028 !! wikitext
9029 {{echo|<li>}}a
9030 {{echo|<li>}}b
9031 {{echo|<li>}}c
9032 !! html
9033 <li>a
9034 <li>b
9035 <li>c</li>
9036 </li>
9037 </li>
9038
9039 !! html+tidy
9040 <ul>
9041 <li>a</li>
9042 <li>b</li>
9043 <li>c</li>
9044 </ul>
9045 !!end
9046
9047 !!test
9048 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9049 !! wikitext
9050 *a
9051 <!--This line will NOT split the list-->
9052 *b
9053 <!--This line will NOT split the list either-->
9054 *c
9055 <!--foo--> <!----> <!--This line NOT split the list either-->
9056 *d
9057 !! html
9058 <ul><li>a</li>
9059 <li>b</li>
9060 <li>c</li>
9061 <li>d</li></ul>
9062
9063 !!end
9064
9065 !!test
9066 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9067 !! wikitext
9068 *a
9069 <!--This line will NOT split the list-->
9070 *b
9071 <!--This line will NOT split the list either-->
9072 *c
9073 <!--foo--> <!----> <!--This line NOT split the list
9074 either-->
9075 *d
9076 !! html
9077 <ul><li>a</li>
9078 <li>b</li>
9079 <li>c</li>
9080 <li>d</li></ul>
9081
9082 !!end
9083
9084 !!test
9085 Test the li-hack
9086 (The PHP parser relies on Tidy for the hack)
9087 !!options
9088 parsoid=wt2html,wt2wt
9089 !! wikitext
9090 * foo
9091 * <li>li-hack
9092 * {{echo|<li>templated li-hack}}
9093 * <!--foo--> <li> unsupported li-hack with preceding comments
9094
9095 <ul>
9096 <li><li>not a li-hack
9097 </li>
9098 </ul>
9099 !! html+tidy
9100 <ul>
9101 <li>foo</li>
9102 <li>li-hack</li>
9103 <li>templated li-hack</li>
9104 <li>unsupported li-hack with preceding comments</li>
9105 </ul>
9106 <ul>
9107 <li>not a li-hack</li>
9108 </ul>
9109 !!end
9110
9111 !! test
9112 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9113 !! options
9114 parsoid
9115 !! wikitext
9116 # foo
9117 ## bar
9118 * foo
9119 ** bar
9120 : foo
9121 :: bar
9122 !! html
9123 <ol>
9124 <li> foo<ol>
9125 <li> bar</li>
9126 </ol></li>
9127 </ol><ul>
9128 <li> foo<ul>
9129 <li> bar</li>
9130 </ul></li>
9131 </ul><dl>
9132 <dd> foo<dl>
9133 <dd> bar</dd>
9134 </dl></dd>
9135 </dl>
9136 !! end
9137
9138 !! test
9139 Parsoid: Test of whitespace serialization with Templated bullets
9140 !! options
9141 parsoid
9142 !! wikitext
9143 * {{bullet}}
9144 !! html
9145 <ul>
9146 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9147 </ul>
9148 !! end
9149
9150 # ------------------------------------------------------------------------
9151 # The next set of tests are about Parsoid's ability to handle badly nested
9152 # tags (parse, minimize scope of fixup, and roundtrip back)
9153 # ------------------------------------------------------------------------
9154
9155 !! test
9156 Unbalanced closing block tags break a list
9157 (php parser relies on Tidy to fix up)
9158 !! wikitext
9159 <div>
9160 *a</div><div>
9161 *b</div>
9162 !! html+tidy
9163 <div>
9164 <ul>
9165 <li>a</li>
9166 </ul>
9167 </div>
9168 <div>
9169 <ul>
9170 <li>b</li>
9171 </ul>
9172 </div>
9173 !! end
9174
9175 # Parsoid fails this test, but it might be tricky to support properly.
9176 # See bug 68395.
9177 !! test
9178 Unbalanced closing non-block tags don't break a list
9179 (php parser relies on Tidy to fix up)
9180 !! wikitext
9181 <span>
9182 *a</span><span>
9183 *b</span>
9184 !! html/php+tidy
9185 <ul>
9186 <li><span>a</span></li>
9187 <li><span>b</span></li>
9188 </ul>
9189 !! html/parsoid
9190 <span>
9191 <ul>
9192 <li>a<span></span>
9193 </li>
9194 <li>b
9195 </li>
9196 </ul>
9197 </span>
9198 !! end
9199
9200 !! test
9201 Unclosed formatting tags that straddle lists are closed and reopened
9202 (php parser relies on Tidy to fix up)
9203 !! options
9204 parsoid=wt2html,wt2wt,html2html
9205 !! wikitext
9206 # <s> a
9207 # b </s>
9208 !! html/php+tidy
9209 <ol>
9210 <li><s>a</s></li>
9211 <li><s>b</s></li>
9212 </ol>
9213 !! html/parsoid
9214 <ol><li> <s> a</s></li>
9215 <li><s> b </s></li></ol>
9216 !! end
9217
9218 # See bug 68395.
9219 !!test
9220 1. List embedded in a formatting tag
9221 !! wikitext
9222 <small>
9223 * foo
9224 </small>
9225 !! html/php+tidy
9226 <ul>
9227 <li><small>foo</small></li>
9228 </ul>
9229 !! html/parsoid
9230 <small>
9231 <ul>
9232 <li> foo</li>
9233 </ul>
9234 </small>
9235 !!end
9236
9237 ## Ugly Parsoid output here
9238 ## Not sure what the right output is.
9239 !!test
9240 2. List embedded in a formatting tag
9241 !! wikitext
9242 <small>
9243 *a
9244 *b</small>
9245 !! html/php+tidy
9246 <ul>
9247 <li><small>a</small></li>
9248 <li><small>b</small></li>
9249 </ul>
9250 !! html/parsoid
9251 <small></small>
9252 <ul><small>
9253 <li>a</li>
9254 </small>
9255 <li><small>b</small></li>
9256 </ul>
9257 !!end
9258
9259 # Ugly Parsoid and PHP parser output here
9260 # Not sure if we want to make this a test!
9261 #
9262 ## !!test
9263 ## 3. Unclosed formatting tags in list elements
9264 ## !! wikitext
9265 ## *<small>a
9266 ## *<small>b
9267 ## !! html/php+tidy
9268 ## <ul>
9269 ## <li><small>a</small></li>
9270 ## <li><small><small>b</small></small></li>
9271 ## </ul>
9272 ## !! html/parsoid
9273 ## <ul>
9274 ## <li><small>a</small></li>
9275 ## <small>
9276 ## <li><small>b</small></li>
9277 ## </small></ul>
9278 ## !!end
9279
9280 # This is a bug in the PHP parser + tidy combination.
9281 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9282 # and then fostered out of the table by tidy.)
9283 # We believe the Parsoid output to be correct.
9284 !! test
9285 Table with missing opening <tr> tag
9286 !! options
9287 parsoid=wt2html,wt2wt
9288 !! wikitext
9289 <table>
9290 <td>foo</td>
9291 </tr>
9292 </table>
9293 !! html+tidy
9294 <table>
9295 <tr>
9296 <td>foo</td>
9297 </tr>
9298 </table>
9299 !! end
9300
9301 ###
9302 ### Magic Words
9303 ###
9304
9305 # Note that the current date is hard-coded as
9306 # 1970-01-01T00:02:03Z (a Thursday)
9307 # when running parser tests. The timezone is also fixed to GMT, so
9308 # local date will be identical to current date.
9309
9310 !! test
9311 Magic Word: {{CURRENTDAY}}
9312 !! wikitext
9313 {{CURRENTDAY}}
9314 !! html
9315 <p>1
9316 </p>
9317 !! end
9318
9319 !! test
9320 Magic Word: {{CURRENTDAY2}}
9321 !! wikitext
9322 {{CURRENTDAY2}}
9323 !! html
9324 <p>01
9325 </p>
9326 !! end
9327
9328 !! test
9329 Magic Word: {{CURRENTDAYNAME}}
9330 !! wikitext
9331 {{CURRENTDAYNAME}}
9332 !! html
9333 <p>Thursday
9334 </p>
9335 !! end
9336
9337 !! test
9338 Magic Word: {{CURRENTDOW}}
9339 !! wikitext
9340 {{CURRENTDOW}}
9341 !! html
9342 <p>4
9343 </p>
9344 !! end
9345
9346 !! test
9347 Magic Word: {{CURRENTMONTH}}
9348 !! wikitext
9349 {{CURRENTMONTH}}
9350 !! html
9351 <p>01
9352 </p>
9353 !! end
9354
9355 !! test
9356 Magic Word: {{CURRENTMONTH1}}
9357 !! wikitext
9358 {{CURRENTMONTH1}}
9359 !! html
9360 <p>1
9361 </p>
9362 !! end
9363
9364 !! test
9365 Magic Word: {{CURRENTMONTHABBREV}}
9366 !! wikitext
9367 {{CURRENTMONTHABBREV}}
9368 !! html
9369 <p>Jan
9370 </p>
9371 !! end
9372
9373 !! test
9374 Magic Word: {{CURRENTMONTHNAME}}
9375 !! wikitext
9376 {{CURRENTMONTHNAME}}
9377 !! html
9378 <p>January
9379 </p>
9380 !! end
9381
9382 !! test
9383 Magic Word: {{CURRENTMONTHNAMEGEN}}
9384 !! wikitext
9385 {{CURRENTMONTHNAMEGEN}}
9386 !! html
9387 <p>January
9388 </p>
9389 !! end
9390
9391 !! test
9392 Magic Word: {{CURRENTTIME}}
9393 !! wikitext
9394 {{CURRENTTIME}}
9395 !! html
9396 <p>00:02
9397 </p>
9398 !! end
9399
9400 !! test
9401 Magic Word: {{CURRENTHOUR}}
9402 !! wikitext
9403 {{CURRENTHOUR}}
9404 !! html
9405 <p>00
9406 </p>
9407 !! end
9408
9409 !! test
9410 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9411 !! wikitext
9412 {{CURRENTWEEK}}
9413 !! html
9414 <p>1
9415 </p>
9416 !! end
9417
9418 !! test
9419 Magic Word: {{CURRENTYEAR}}
9420 !! wikitext
9421 {{CURRENTYEAR}}
9422 !! html
9423 <p>1970
9424 </p>
9425 !! end
9426
9427 !! test
9428 Magic Word: {{CURRENTTIMESTAMP}}
9429 !! wikitext
9430 {{CURRENTTIMESTAMP}}
9431 !! html
9432 <p>19700101000203
9433 </p>
9434 !! end
9435
9436 !! test
9437 Magic Words LOCAL (UTC)
9438 !! wikitext
9439 * {{LOCALMONTH}}
9440 * {{LOCALMONTH1}}
9441 * {{LOCALMONTHNAME}}
9442 * {{LOCALMONTHNAMEGEN}}
9443 * {{LOCALMONTHABBREV}}
9444 * {{LOCALDAY}}
9445 * {{LOCALDAY2}}
9446 * {{LOCALDAYNAME}}
9447 * {{LOCALYEAR}}
9448 * {{LOCALTIME}}
9449 * {{LOCALHOUR}}
9450 * {{LOCALWEEK}}
9451 * {{LOCALDOW}}
9452 * {{LOCALTIMESTAMP}}
9453 !! html
9454 <ul><li> 01</li>
9455 <li> 1</li>
9456 <li> January</li>
9457 <li> January</li>
9458 <li> Jan</li>
9459 <li> 1</li>
9460 <li> 01</li>
9461 <li> Thursday</li>
9462 <li> 1970</li>
9463 <li> 00:02</li>
9464 <li> 00</li>
9465 <li> 1</li>
9466 <li> 4</li>
9467 <li> 19700101000203</li></ul>
9468
9469 !! end
9470
9471 !! test
9472 Magic Word: {{FULLPAGENAME}}
9473 !! options
9474 title=[[User:Ævar Arnfjörð Bjarmason]]
9475 !! wikitext
9476 {{FULLPAGENAME}}
9477 !! html
9478 <p>User:Ævar Arnfjörð Bjarmason
9479 </p>
9480 !! end
9481
9482 !! test
9483 Magic Word: {{FULLPAGENAMEE}}
9484 !! options
9485 title=[[User:Ævar Arnfjörð Bjarmason]]
9486 !! wikitext
9487 {{FULLPAGENAMEE}}
9488 !! html
9489 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9490 </p>
9491 !! end
9492
9493 !! test
9494 Magic Word: {{TALKSPACE}}
9495 !! options
9496 title=[[User:Ævar Arnfjörð Bjarmason]]
9497 !! wikitext
9498 {{TALKSPACE}}
9499 !! html
9500 <p>User talk
9501 </p>
9502 !! end
9503
9504 !! test
9505 Magic Word: {{TALKSPACE}}, same namespace
9506 !! options
9507 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9508 !! wikitext
9509 {{TALKSPACE}}
9510 !! html
9511 <p>User talk
9512 </p>
9513 !! end
9514
9515 !! test
9516 Magic Word: {{TALKSPACE}}, main namespace
9517 !! options
9518 title=[[Parser Test]]
9519 !! wikitext
9520 {{TALKSPACE}}
9521 !! html
9522 <p>Talk
9523 </p>
9524 !! end
9525
9526 !! test
9527 Magic Word: {{TALKSPACEE}}
9528 !! options
9529 title=[[User:Ævar Arnfjörð Bjarmason]]
9530 !! wikitext
9531 {{TALKSPACEE}}
9532 !! html
9533 <p>User_talk
9534 </p>
9535 !! end
9536
9537 !! test
9538 Magic Word: {{SUBJECTSPACE}}
9539 !! options
9540 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9541 !! wikitext
9542 {{SUBJECTSPACE}}
9543 !! html
9544 <p>User
9545 </p>
9546 !! end
9547
9548 !! test
9549 Magic Word: {{SUBJECTSPACE}}, same namespace
9550 !! options
9551 title=[[User:Ævar Arnfjörð Bjarmason]]
9552 !! wikitext
9553 {{SUBJECTSPACE}}
9554 !! html
9555 <p>User
9556 </p>
9557 !! end
9558
9559 !! test
9560 Magic Word: {{SUBJECTSPACE}}, main namespace
9561 !! options
9562 title=[[Parser Test]]
9563 !! wikitext
9564 {{SUBJECTSPACE}}
9565 !! html
9566
9567 !! end
9568
9569 !! test
9570 Magic Word: {{SUBJECTSPACEE}}
9571 !! options
9572 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9573 !! wikitext
9574 {{SUBJECTSPACEE}}
9575 !! html
9576 <p>User
9577 </p>
9578 !! end
9579
9580 !! test
9581 Magic Word: {{NAMESPACE}}
9582 !! options
9583 title=[[User:Ævar Arnfjörð Bjarmason]]
9584 !! wikitext
9585 {{NAMESPACE}}
9586 !! html
9587 <p>User
9588 </p>
9589 !! end
9590
9591 !! test
9592 Magic Word: {{NAMESPACEE}}
9593 !! options
9594 title=[[User:Ævar Arnfjörð Bjarmason]]
9595 !! wikitext
9596 {{NAMESPACEE}}
9597 !! html
9598 <p>User
9599 </p>
9600 !! end
9601
9602 !! test
9603 Magic Word: {{NAMESPACENUMBER}}
9604 !! options
9605 title=[[User:Ævar Arnfjörð Bjarmason]]
9606 !! wikitext
9607 {{NAMESPACENUMBER}}
9608 !! html
9609 <p>2
9610 </p>
9611 !! end
9612
9613 !! test
9614 Magic Word: {{SUBPAGENAME}}
9615 !! options
9616 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9617 !! wikitext
9618 {{SUBPAGENAME}}
9619 !! html
9620 <p>sub ö
9621 </p>
9622 !! end
9623
9624 !! test
9625 Magic Word: {{SUBPAGENAMEE}}
9626 !! options
9627 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9628 !! wikitext
9629 {{SUBPAGENAMEE}}
9630 !! html
9631 <p>sub_%C3%B6
9632 </p>
9633 !! end
9634
9635 !! test
9636 Magic Word: {{ROOTPAGENAME}}
9637 !! options
9638 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9639 !! wikitext
9640 {{ROOTPAGENAME}}
9641 !! html
9642 <p>Ævar Arnfjörð Bjarmason
9643 </p>
9644 !! end
9645
9646 !! test
9647 Magic Word: {{ROOTPAGENAMEE}}
9648 !! options
9649 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9650 !! wikitext
9651 {{ROOTPAGENAMEE}}
9652 !! html
9653 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9654 </p>
9655 !! end
9656
9657 !! test
9658 Magic Word: {{BASEPAGENAME}}
9659 !! options
9660 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9661 !! wikitext
9662 {{BASEPAGENAME}}
9663 !! html
9664 <p>Ævar Arnfjörð Bjarmason
9665 </p>
9666 !! end
9667
9668 !! test
9669 Magic Word: {{BASEPAGENAMEE}}
9670 !! options
9671 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9672 !! wikitext
9673 {{BASEPAGENAMEE}}
9674 !! html
9675 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9676 </p>
9677 !! end
9678
9679 !! test
9680 Magic Word: {{TALKPAGENAME}}
9681 !! options
9682 title=[[User:Ævar Arnfjörð Bjarmason]]
9683 !! wikitext
9684 {{TALKPAGENAME}}
9685 !! html
9686 <p>User talk:Ævar Arnfjörð Bjarmason
9687 </p>
9688 !! end
9689
9690 !! test
9691 Magic Word: {{TALKPAGENAMEE}}
9692 !! options
9693 title=[[User:Ævar Arnfjörð Bjarmason]]
9694 !! wikitext
9695 {{TALKPAGENAMEE}}
9696 !! html
9697 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9698 </p>
9699 !! end
9700
9701 !! test
9702 Magic Word: {{SUBJECTPAGENAME}}
9703 !! options
9704 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9705 !! wikitext
9706 {{SUBJECTPAGENAME}}
9707 !! html
9708 <p>User:Ævar Arnfjörð Bjarmason
9709 </p>
9710 !! end
9711
9712 !! test
9713 Magic Word: {{SUBJECTPAGENAMEE}}
9714 !! options
9715 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9716 !! wikitext
9717 {{SUBJECTPAGENAMEE}}
9718 !! html
9719 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9720 </p>
9721 !! end
9722
9723 !! test
9724 Magic Word: {{NUMBEROFFILES}}
9725 !! wikitext
9726 {{NUMBEROFFILES}}
9727 !! html
9728 <p>6
9729 </p>
9730 !! end
9731
9732 !! test
9733 Magic Word: {{PAGENAME}}
9734 !! options
9735 title=[[User:Ævar Arnfjörð Bjarmason]]
9736 !! wikitext
9737 {{PAGENAME}}
9738 !! html
9739 <p>Ævar Arnfjörð Bjarmason
9740 </p>
9741 !! end
9742
9743 !! test
9744 Magic Word: {{PAGENAME}} with metacharacters
9745 !! options
9746 title=[['foo & bar = baz']]
9747 !! wikitext
9748 ''{{PAGENAME}}''
9749 !! html/php
9750 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9751 </p>
9752 !! html+tidy
9753 <p><i>'foo &amp; bar = baz'</i></p>
9754 !! end
9755
9756 !! test
9757 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9758 !! options
9759 title=[[*RFC 1234 http://example.com/]]
9760 !! wikitext
9761 {{PAGENAME}}
9762 !! html/php
9763 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9764 </p>
9765 !! html+tidy
9766 <p>*RFC 1234 http://example.com/</p>
9767 !! end
9768
9769 !! test
9770 Magic Word: {{PAGENAMEE}}
9771 !! options
9772 title=[[User:Ævar Arnfjörð Bjarmason]]
9773 !! wikitext
9774 {{PAGENAMEE}}
9775 !! html
9776 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9777 </p>
9778 !! end
9779
9780 !! test
9781 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9782 !! options
9783 title=[[*RFC 1234 http://example.com/]]
9784 !! wikitext
9785 {{PAGENAMEE}}
9786 !! html/php
9787 <p>&#42;RFC_1234_http&#58;//example.com/
9788 </p>
9789 !! html+tidy
9790 <p>*RFC_1234_http://example.com/</p>
9791 !! end
9792
9793 !! test
9794 Magic Word: {{REVISIONID}}
9795 !! wikitext
9796 {{REVISIONID}}
9797 !! html
9798 <p>1337
9799 </p>
9800 !! end
9801
9802 !! test
9803 Magic Word: {{SCRIPTPATH}}
9804 !! wikitext
9805 {{SCRIPTPATH}}
9806 !! html
9807 <p>/
9808 </p>
9809 !! end
9810
9811 !! test
9812 Magic Word: {{STYLEPATH}}
9813 !! wikitext
9814 {{STYLEPATH}}
9815 !! html
9816 <p>/skins
9817 </p>
9818 !! end
9819
9820 !! test
9821 Magic Word: {{SERVER}}
9822 !! wikitext
9823 {{SERVER}}
9824 !! html
9825 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9826 </p>
9827 !! end
9828
9829 !! test
9830 Magic Word: {{SERVERNAME}}
9831 !! wikitext
9832 {{SERVERNAME}}
9833 !! html
9834 <p>example.org
9835 </p>
9836 !! end
9837
9838 !! test
9839 Magic Word: {{SITENAME}}
9840 !! wikitext
9841 {{SITENAME}}
9842 !! html
9843 <p>MediaWiki
9844 </p>
9845 !! end
9846
9847 !! test
9848 Case-sensitive magic words, when cased differently, should just be template transclusions
9849 !! wikitext
9850 {{CurrentMonth}}
9851 {{currentday}}
9852 {{cURreNTweEK}}
9853 {{currentHour}}
9854 !! html
9855 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
9856 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
9857 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
9858 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
9859 </p>
9860 !! end
9861
9862 !! test
9863 Case-insensitive magic words should still work with weird casing.
9864 !! wikitext
9865 {{sErVeRNaMe}}
9866 {{LCFirst:AOEU}}
9867 {{ucFIRST:aoeu}}
9868 {{SERver}}
9869 !! html
9870 <p>example.org
9871 aOEU
9872 Aoeu
9873 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9874 </p>
9875 !! end
9876
9877 # From plwiki:PLOS_ONE
9878 !! test
9879 Parsoid: Page property magic word with magic word contents
9880 !! wikitext
9881 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9882 !! html/parsoid
9883 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
9884 !! end
9885
9886 !! test
9887 Parsoid: Template-generated DISPLAYTITLE
9888 !! wikitext
9889 {{{{echo|DISPLAYTITLE}}:Foo}}
9890 !! html/parsoid
9891 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9892 !! end
9893
9894 !! test
9895 Namespace 1 {{ns:1}}
9896 !! wikitext
9897 {{ns:1}}
9898 !! html
9899 <p>Talk
9900 </p>
9901 !! end
9902
9903 !! test
9904 Namespace 1 {{ns:01}}
9905 !! wikitext
9906 {{ns:01}}
9907 !! html
9908 <p>Talk
9909 </p>
9910 !! end
9911
9912 !! test
9913 Namespace 0 {{ns:0}} (bug 4783)
9914 !! wikitext
9915 {{ns:0}}
9916 !! html
9917
9918 !! end
9919
9920 !! test
9921 Namespace 0 {{ns:00}} (bug 4783)
9922 !! wikitext
9923 {{ns:00}}
9924 !! html
9925
9926 !! end
9927
9928 !! test
9929 Namespace -1 {{ns:-1}}
9930 !! wikitext
9931 {{ns:-1}}
9932 !! html
9933 <p>Special
9934 </p>
9935 !! end
9936
9937 !! test
9938 Namespace User {{ns:User}}
9939 !! wikitext
9940 {{ns:User}}
9941 !! html
9942 <p>User
9943 </p>
9944 !! end
9945
9946 !! test
9947 Namespace User talk {{ns:User_talk}}
9948 !! wikitext
9949 {{ns:User_talk}}
9950 !! html
9951 <p>User talk
9952 </p>
9953 !! end
9954
9955 !! test
9956 Namespace User talk {{ns:uSeR tAlK}}
9957 !! wikitext
9958 {{ns:uSeR tAlK}}
9959 !! html
9960 <p>User talk
9961 </p>
9962 !! end
9963
9964 !! test
9965 Namespace File {{ns:File}}
9966 !! wikitext
9967 {{ns:File}}
9968 !! html
9969 <p>File
9970 </p>
9971 !! end
9972
9973 !! test
9974 Namespace File {{ns:Image}}
9975 !! wikitext
9976 {{ns:Image}}
9977 !! html
9978 <p>File
9979 </p>
9980 !! end
9981
9982 !! test
9983 Namespace (lang=de) Benutzer {{ns:User}}
9984 !! options
9985 language=de
9986 !! wikitext
9987 {{ns:User}}
9988 !! html
9989 <p>Benutzer
9990 </p>
9991 !! end
9992
9993 !! test
9994 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9995 !! options
9996 language=de
9997 !! wikitext
9998 {{ns:3}}
9999 !! html
10000 <p>Benutzer Diskussion
10001 </p>
10002 !! end
10003
10004
10005 !! test
10006 Urlencode
10007 !! wikitext
10008 {{urlencode:hi world?!}}
10009 {{urlencode:hi world?!|WIKI}}
10010 {{urlencode:hi world?!|PATH}}
10011 {{urlencode:hi world?!|QUERY}}
10012 !! html
10013 <p>hi+world%3F%21
10014 hi_world%3F!
10015 hi%20world%3F%21
10016 hi+world%3F%21
10017 </p>
10018 !! end
10019
10020 !! test
10021 Magic Word: prioritize type info over data-parsoid
10022 !! options
10023 parsoid=html2wt
10024 !! html/parsoid
10025 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10026 !! wikitext
10027 __FORCETOC__
10028 !! end
10029
10030 !! test
10031 Magic Word: serialize on separate line (parsoid)
10032 !! options
10033 parsoid=wt2wt,html2wt
10034 !! wikitext
10035 foo
10036 __NOTOC__
10037 bar
10038 !! html/parsoid
10039 foo<meta property="mw:PageProp/notoc"/>bar
10040 !! end
10041
10042 !! test
10043 Magic Word: rt non-english wikis
10044 !! options
10045 parsoid=wt2wt
10046 language=de
10047 !! wikitext
10048 __NOEDITSECTION__
10049 !! html/parsoid
10050 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10051 !! end
10052
10053 !!test
10054 __proto__ is treated as normal wikitext (T105997)
10055 !!wikitext
10056 __proto__
10057 !!html
10058 <p>__proto__
10059 </p>
10060 !!end
10061
10062 ###
10063 ### Magic links
10064 ###
10065 !! test
10066 Magic links: internal link to RFC (bug 479)
10067 !! wikitext
10068 [[RFC 123]]
10069 !! html/php
10070 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
10071 </p>
10072 !! html/parsoid
10073 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10074 !! end
10075
10076 !! test
10077 Magic links: RFC (bug 479)
10078 !! wikitext
10079 RFC 822
10080 !! html/php
10081 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10082 </p>
10083 !! html/parsoid
10084 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10085 !! end
10086
10087 !! test
10088 Magic links: RFC (bug 65278)
10089 !! wikitext
10090 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10091 !! html/php
10092 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
10093 </p>
10094 !! html/parsoid
10095 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10096 !! end
10097
10098 !! test
10099 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10100 !! wikitext
10101 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10102 RFC
10103 822
10104 !! html/php
10105 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10106 RFC
10107 822
10108 </p>
10109 !! html/parsoid
10110 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10111 RFC
10112 822</p>
10113 !! end
10114
10115 !! test
10116 Magic links: ISBN (bug 1937)
10117 !! wikitext
10118 ISBN 0-306-40615-2
10119 !! html/php
10120 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10121 </p>
10122 !! html/parsoid
10123 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10124 !! end
10125
10126 !! test
10127 Magic links: ISBN (bug 65278)
10128 !! wikitext
10129 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10130 !! html/php
10131 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10132 </p>
10133 !! html/parsoid
10134 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10135 !! end
10136
10137 !! test
10138 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10139 !! wikitext
10140 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10141 ISBN
10142 9780316098113
10143 ISBN 978
10144 0316098113
10145 !! html/php
10146 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10147 ISBN
10148 9780316098113
10149 ISBN 978
10150 0316098113
10151 </p>
10152 !! html/parsoid
10153 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10154 ISBN
10155 9780316098113
10156 ISBN 978
10157 0316098113</p>
10158 !! end
10159
10160 !! test
10161 Magic links: PMID incorrectly converts space to underscore
10162 !! wikitext
10163 PMID 1234
10164 !! html/php
10165 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10166 </p>
10167 !! html/parsoid
10168 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10169 !! end
10170
10171 !! test
10172 Magic links: PMID (bug 65278)
10173 !! wikitext
10174 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10175 !! html/php
10176 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
10177 </p>
10178 !! html/parsoid
10179 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10180 !! end
10181
10182 !! test
10183 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10184 !! wikitext
10185 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10186 PMID
10187 1234
10188 !! html/php
10189 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10190 PMID
10191 1234
10192 </p>
10193 !! html/parsoid
10194 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10195 PMID
10196 1234</p>
10197 !! end
10198
10199 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10200 # since these are ExtLinkText, not MagicLinkText
10201 !! test
10202 Magic links: use appropriate serialization for "almost" magic links.
10203 !! wikitext
10204 X[[Special:BookSources/0978739256|foo]]
10205
10206 X[//tools.ietf.org/html/rfc1234 foo]
10207 !! html/php
10208 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10209 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10210 </p>
10211 !! html/parsoid
10212 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10213 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10214 !! end
10215
10216 ###
10217 ### Templates
10218 ####
10219
10220 !! test
10221 Nonexistent template
10222 !! wikitext
10223 {{thistemplatedoesnotexist}}
10224 !! html
10225 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
10226 </p>
10227 !! end
10228
10229 !! test
10230 Template with invalid target containing tags
10231 !! wikitext
10232 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10233 !! html
10234 <p>{{a<b>b</b>|foo|a=b|a = b}}
10235 </p>
10236 !! end
10237
10238 !! test
10239 Template with invalid target containing unclosed tag
10240 !! wikitext
10241 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10242 !! html
10243 <p>{{a<b>|foo|a=b|a = b}}</b>
10244 </p>
10245 !! end
10246
10247 !! test
10248 Template with invalid target containing wikilink
10249 !! wikitext
10250 {{[[Main Page]]}}
10251 !! html/php
10252 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10253 </p>
10254 !! html/parsoid
10255 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
10256 !! end
10257
10258 !! test
10259 Template with just whitespace in it, bug #68421
10260 !! wikitext
10261 {{echo|{{ }}}}
10262 !! html/parsoid
10263 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
10264 !! end
10265
10266 !! article
10267 Template:test
10268 !! text
10269 This is a test template
10270 !! endarticle
10271
10272 !! test
10273 Simple template
10274 !! wikitext
10275 {{test}}
10276 !! html
10277 <p>This is a test template
10278 </p>
10279 !! end
10280
10281 !! test
10282 Template with explicit namespace
10283 !! wikitext
10284 {{Template:test}}
10285 !! html
10286 <p>This is a test template
10287 </p>
10288 !! end
10289
10290
10291 !! article
10292 Template:paramtest
10293 !! text
10294 This is a test template with parameter {{{param}}}
10295 !! endarticle
10296
10297 !! test
10298 Template parameter
10299 !! wikitext
10300 {{paramtest|param=foo}}
10301 !! html
10302 <p>This is a test template with parameter foo
10303 </p>
10304 !! end
10305
10306 !! article
10307 Template:paramtestnum
10308 !! text
10309 [[{{{1}}}|{{{2}}}]]
10310 !! endarticle
10311
10312 !! test
10313 Template unnamed parameter
10314 !! wikitext
10315 {{paramtestnum|Main Page|the main page}}
10316 !! html
10317 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10318 </p>
10319 !! end
10320
10321 !! article
10322 Template:templatesimple
10323 !! text
10324 (test)
10325 !! endarticle
10326
10327 !! article
10328 Template:templateredirect
10329 !! text
10330 #redirect [[Template:templatesimple]]
10331 !! endarticle
10332
10333 !! article
10334 Template:templateasargtestnum
10335 !! text
10336 {{{{{1}}}}}
10337 !! endarticle
10338
10339 !! article
10340 Template:templateasargtest
10341 !! text
10342 {{template{{{templ}}}}}
10343 !! endarticle
10344
10345 !! article
10346 Template:templateasargtest2
10347 !! text
10348 {{{{{templ}}}}}
10349 !! endarticle
10350
10351 !! test
10352 Template with template name as unnamed argument
10353 !! wikitext
10354 {{templateasargtestnum|templatesimple}}
10355 !! html
10356 <p>(test)
10357 </p>
10358 !! end
10359
10360 !! test
10361 Template with template name as argument
10362 !! wikitext
10363 {{templateasargtest|templ=simple}}
10364 !! html
10365 <p>(test)
10366 </p>
10367 !! end
10368
10369 !! test
10370 Template with template name as argument (2)
10371 !! wikitext
10372 {{templateasargtest2|templ=templatesimple}}
10373 !! html
10374 <p>(test)
10375 </p>
10376 !! end
10377
10378 !! article
10379 Template:templateasargtestdefault
10380 !! text
10381 {{{{{templ|templatesimple}}}}}
10382 !! endarticle
10383
10384 !! article
10385 Template:templa
10386 !! text
10387 '''templ'''
10388 !! endarticle
10389
10390 !! test
10391 Template with default value
10392 !! wikitext
10393 {{templateasargtestdefault}}
10394 !! html
10395 <p>(test)
10396 </p>
10397 !! end
10398
10399 !! test
10400 Template with default value (value set)
10401 !! wikitext
10402 {{templateasargtestdefault|templ=templa}}
10403 !! html
10404 <p><b>templ</b>
10405 </p>
10406 !! end
10407
10408 !! test
10409 Template redirect
10410 !! wikitext
10411 {{templateredirect}}
10412 !! html/php
10413 <p>(test)
10414 </p>
10415 !! html/parsoid
10416 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10417 !! end
10418
10419 !! test
10420 Template with argument in separate line
10421 !! wikitext
10422 {{ templateasargtest |
10423 templ = simple }}
10424 !! html
10425 <p>(test)
10426 </p>
10427 !! end
10428
10429 !! test
10430 Template with complex template as argument
10431 !! wikitext
10432 {{paramtest|
10433 param ={{ templateasargtest |
10434 templ = simple }}}}
10435 !! html
10436 <p>This is a test template with parameter (test)
10437 </p>
10438 !! end
10439
10440 !! test
10441 Template with thumb image (with link in description)
10442 !! wikitext
10443 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10444 !! html/php
10445 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
10446
10447 !! html+tidy
10448 <p>This is a test template with parameter</p>
10449 <div class="thumb tright">
10450 <div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a>
10451 <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div>
10452 </div>
10453 </div>
10454 !! html/parsoid
10455 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
10456 !! end
10457
10458 !! article
10459 Template:complextemplate
10460 !! text
10461 {{{1}}} {{paramtest|
10462 param ={{{param}}}}}
10463 !! endarticle
10464
10465 !! test
10466 Template with complex arguments
10467 !! wikitext
10468 {{complextemplate|
10469 param ={{ templateasargtest |
10470 templ = simple }}|[[Template:complextemplate|link]]}}
10471 !! html
10472 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10473 </p>
10474 !! end
10475
10476 !! test
10477 BUG 553: link with two variables in a piped link
10478 !! wikitext
10479 {|
10480 |[[{{{1}}}|{{{2}}}]]
10481 |}
10482 !! html/php
10483 <table>
10484 <tr>
10485 <td>[[{{{1}}}|{{{2}}}]]
10486 </td></tr></table>
10487
10488 !! html/parsoid
10489 <table>
10490 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-parsoid='{"src":"{{{1}}}"}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-parsoid='{"src":"{{{2}}}"}'>{{{2}}}</span>]]</td></tr>
10491 !! end
10492
10493 # See: T2553
10494 !! test
10495 Abort table cell attribute parsing on wikilink
10496 !! wikitext
10497 {|
10498 | testing [[one|two]] | three || four
10499 | testing one two | three || four
10500 |}
10501 !! html/php
10502 <table>
10503 <tr>
10504 <td> testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | three </td>
10505 <td> four
10506 </td>
10507 <td> three </td>
10508 <td> four
10509 </td></tr></table>
10510
10511 !! html/parsoid
10512 <table>
10513 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
10514 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
10515 </tbody></table>
10516 !! end
10517
10518 !! test
10519 Don't abort table cell attribute parsing if wikilink is found in template arg
10520 !! wikitext
10521 {|
10522 | Test {{#tag:ref|One two "[[three]]" four}}
10523 |}
10524 !! html/parsoid
10525 <table>
10526 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
10527 </tbody></table>
10528 !! end
10529
10530 !! test
10531 Magic variable as template parameter
10532 !! wikitext
10533 {{paramtest|param={{SITENAME}}}}
10534 !! html
10535 <p>This is a test template with parameter MediaWiki
10536 </p>
10537 !! end
10538
10539 !! article
10540 Template:linktest
10541 !! text
10542 [[{{{param}}}|link]]
10543 !! endarticle
10544
10545 !! test
10546 Template parameter as link source
10547 !! wikitext
10548 {{linktest|param=Main Page}}
10549 !! html
10550 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10551 </p>
10552 !! end
10553
10554 !!article
10555 Template:paramtest2
10556 !! text
10557 including another template, {{paramtest|param={{{arg}}}}}
10558 !! endarticle
10559
10560 !! test
10561 Template passing argument to another template
10562 !! wikitext
10563 {{paramtest2|arg='hmm'}}
10564 !! html
10565 <p>including another template, This is a test template with parameter 'hmm'
10566 </p>
10567 !! end
10568
10569 !! article
10570 Template:Linktest2
10571 !! text
10572 Main Page
10573 !! endarticle
10574
10575 !! test
10576 Template as link source
10577 !! wikitext
10578 [[{{linktest2}}]]
10579
10580 [[{{linktest2}}|Main Page]]
10581
10582 [[{{linktest2}}]]Page
10583 !! html
10584 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10585 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10586 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10587 </p>
10588 !! end
10589
10590
10591 !! article
10592 Template:loop1
10593 !! text
10594 {{loop2}}
10595 !! endarticle
10596
10597 !! article
10598 Template:loop2
10599 !! text
10600 {{loop1}}
10601 !! endarticle
10602
10603 !! test
10604 Template infinite loop
10605 !! wikitext
10606 {{loop1}}
10607 !! html
10608 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10609 </p>
10610 !! end
10611
10612 !! test
10613 Template from main namespace
10614 !! wikitext
10615 {{:Main Page}}
10616 !! html
10617 <p>blah blah
10618 </p>
10619 !! end
10620
10621 !! article
10622 Template:table
10623 !! text
10624 {|
10625 | 1 || 2
10626 |-
10627 | 3 || 4
10628 |}
10629 !! endarticle
10630
10631 !! test
10632 BUG 529: Template with table, not included at beginning of line
10633 !! wikitext
10634 foo {{table}}
10635 !! html
10636 <p>foo
10637 </p>
10638 <table>
10639 <tr>
10640 <td> 1 </td>
10641 <td> 2
10642 </td></tr>
10643 <tr>
10644 <td> 3 </td>
10645 <td> 4
10646 </td></tr></table>
10647
10648 !! end
10649
10650 !! test
10651 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10652 !! wikitext
10653 foo
10654 {{table}}
10655 !! html
10656 <p>foo
10657 </p>
10658 <table>
10659 <tr>
10660 <td> 1 </td>
10661 <td> 2
10662 </td></tr>
10663 <tr>
10664 <td> 3 </td>
10665 <td> 4
10666 </td></tr></table>
10667
10668 !! end
10669
10670 !! test
10671 BUG 41: Template parameters shown as broken links
10672 !! wikitext
10673 {{{parameter}}}
10674 !! html
10675 <p>{{{parameter}}}
10676 </p>
10677 !! end
10678
10679 !! test
10680 Template with targets containing wikilinks
10681 !! wikitext
10682 {{[[foo]]}}
10683
10684 {{[[{{echo|foo}}]]}}
10685
10686 {{{{echo|[[foo}}]]}}
10687 !! html
10688 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10689 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10690 </p><p>{{[[foo}}]]
10691 </p>
10692 !! end
10693
10694 !! article
10695 Template:''
10696 !! text
10697 bar
10698 !! endarticle
10699
10700 !! test
10701 Templates: Double quotes as template target
10702 !! wikitext
10703 foo {{''}} baz
10704 !! html/php
10705 <p>foo bar baz
10706 </p>
10707 !! html/parsoid
10708 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10709 </p>
10710 !! end
10711
10712 ## This test is about making sure Parsoid's data-mw is well formed in the
10713 ## face of multiple templates with intersecting and overlapping ranges. The
10714 ## wikitext itself is wretched.
10715 !! test
10716 Templates with intersecting and overlapping ranges
10717 !! wikitext
10718 {|{{echo|
10719 <p>ha</p>}}
10720 {|{{echo|
10721 <p>ho</p>}}
10722 {{echo|{{!}}hi}}
10723 |}
10724 !! html/php+tidy
10725 <p>ha</p>
10726 <p>ho</p>
10727 <table>
10728 <tr>
10729 <td></td>
10730 </tr>
10731 <tr>
10732 <td>hi</td>
10733 </tr>
10734 </table>
10735 <table>
10736 <tr>
10737 <td></td>
10738 </tr>
10739 </table>
10740 !! html/parsoid
10741 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10742
10743 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10744
10745 <tbody><tr><td>hi</td></tr>
10746 </tbody></table>
10747 !! end
10748
10749 !! article
10750 Template:MSGNW test
10751 !! text
10752 ''None'' of '''this''' should be
10753 * interpreted
10754 but rather passed unmodified
10755 {{test}}
10756 <gallery>
10757 File:Foobar.jpg
10758 </gallery>
10759 <!-- comment -->
10760 !! endarticle
10761
10762 # hmm, fix this or just deprecate msgnw and document its behavior?
10763 !! test
10764 msgnw keyword
10765 !! wikitext
10766 {{msgnw:MSGNW test}}
10767 !! html/php
10768 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10769 &#42; interpreted
10770 &#32;but rather passed unmodified
10771 &#123;&#123;test&#125;&#125;
10772 &#60;gallery&#62;
10773 File:Foobar.jpg
10774 &#60;/gallery&#62;
10775 &#60;!-- comment --&#62;
10776 </p>
10777 !! end
10778
10779 !! test
10780 int keyword
10781 !! wikitext
10782 {{int:youhavenewmessages|lots of money|not!}}
10783 !! html
10784 <p>You have lots of money (not!).
10785 </p>
10786 !! end
10787
10788 !! test
10789 int keyword - non-existing message
10790 !! wikitext
10791 {{int:var}}
10792 !! html
10793 <p>&lt;var&gt;
10794 </p>
10795 !! end
10796
10797 !! article
10798 Template:Includes
10799 !! text
10800 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10801 !! endarticle
10802
10803 !! test
10804 <includeonly> and <noinclude> being included
10805 !! wikitext
10806 {{Includes}}
10807 !! html
10808 <p>Foobar
10809 </p>
10810 !! end
10811
10812 !! article
10813 Template:Includes2
10814 !! text
10815 <onlyinclude>Foo</onlyinclude>bar
10816 !! endarticle
10817
10818 !! test
10819 <onlyinclude> being included
10820 !! wikitext
10821 {{Includes2}}
10822 !! html
10823 <p>Foo
10824 </p>
10825 !! end
10826
10827
10828 !! article
10829 Template:Includes3
10830 !! text
10831 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10832 !! endarticle
10833
10834 !! test
10835 <onlyinclude> and <includeonly> being included
10836 !! wikitext
10837 {{Includes3}}
10838 !! html
10839 <p>Foo
10840 </p>
10841 !! end
10842
10843 !! test
10844 <includeonly> and <noinclude> on a page
10845 !! wikitext
10846 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10847 !! html
10848 <p>Foozar
10849 </p>
10850 !! end
10851
10852 !! test
10853 Un-closed <noinclude>
10854 !! wikitext
10855 <noinclude>
10856 !! html
10857 !! end
10858
10859 !! test
10860 <onlyinclude> on a page
10861 !! wikitext
10862 <onlyinclude>Foo</onlyinclude>bar
10863 !! html
10864 <p>Foobar
10865 </p>
10866 !! end
10867
10868 !! test
10869 Un-closed <onlyinclude>
10870 !! wikitext
10871 <onlyinclude>
10872 !! html
10873 !! end
10874
10875 !!test
10876 Self-closed noinclude, includeonly, onlyinclude tags
10877 !! wikitext
10878 <noinclude />
10879 <includeonly />
10880 <onlyinclude />
10881 !! html
10882 <p><br />
10883 </p>
10884 !!end
10885
10886 !!test
10887 Unbalanced includeonly and noinclude tags
10888 !! wikitext
10889 {|
10890 |a</noinclude>
10891 |b</noinclude></noinclude>
10892 |c</noinclude></includeonly>
10893 |d</includeonly></includeonly>
10894 |}
10895 !! html
10896 <table>
10897 <tr>
10898 <td>a
10899 </td>
10900 <td>b
10901 </td>
10902 <td>c&lt;/includeonly&gt;
10903 </td>
10904 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10905 </td></tr></table>
10906
10907 !!end
10908
10909 !! article
10910 Template:Includeonly section
10911 !! text
10912 <includeonly>
10913 ==Includeonly section==
10914 </includeonly>
10915 ==Section T-1==
10916 !!endarticle
10917
10918 !! test
10919 Bug 6563: Edit link generation for section shown by <includeonly>
10920 !! wikitext
10921 {{includeonly section}}
10922 !! html
10923 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10924 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10925
10926 !! end
10927
10928 # Uses same input as the contents of [[Template:Includeonly section]]
10929 !! test
10930 Bug 6563: Section extraction for section shown by <includeonly>
10931 !! options
10932 section=T-2
10933 !! wikitext
10934 <includeonly>
10935 ==Includeonly section==
10936 </includeonly>
10937 ==Section T-2==
10938 !! html
10939 ==Section T-2==
10940 !! end
10941
10942 !! test
10943 Bug 6563: Edit link generation for section suppressed by <includeonly>
10944 !! wikitext
10945 <includeonly>
10946 ==Includeonly section==
10947 </includeonly>
10948 ==Section 1==
10949 !! html
10950 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10951
10952 !! end
10953
10954 !! test
10955 Bug 6563: Section extraction for section suppressed by <includeonly>
10956 !! options
10957 section=1
10958 !! wikitext
10959 <includeonly>
10960 ==Includeonly section==
10961 </includeonly>
10962 ==Section 1==
10963 !! html
10964 ==Section 1==
10965 !! end
10966
10967 !! test
10968 Un-closed <includeonly>
10969 !! wikitext
10970 <includeonly>
10971 !! html
10972 !! end
10973
10974 ## We used to, but no longer wt2wt this test since the default serializer
10975 ## will normalize the include directives to serialize on their own line.
10976 ## Selser will take care of preserving formatting in scenarios where they
10977 ## intermingled with other wikitext.
10978 !! test
10979 Includes and comments at SOL
10980 !! options
10981 parsoid=wt2html,html2html
10982 !! wikitext
10983 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10984
10985 <noinclude>
10986 some
10987 </noinclude>* stuff
10988 * here
10989
10990 <includeonly>can have stuff</includeonly>=== here ===
10991
10992 !! html/php
10993 <h2><span class="mw-headline" id="hu">hu</span></h2>
10994 <p>some
10995 </p>
10996 <ul><li> stuff</li>
10997 <li> here</li></ul>
10998 <h3><span class="mw-headline" id="here">here</span></h3>
10999
11000 !! html/parsoid
11001 <!-- 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>
11002
11003 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11004 <p>some</p>
11005 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11006 <li> here</li></ul>
11007
11008 <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>
11009
11010 !! end
11011
11012 # TODO: test with DOM fragment reuse!
11013 !! test
11014 Parsoid: DOM fragment reuse
11015 !! options
11016 parsoid=wt2wt,wt2html
11017 !! wikitext
11018 a{{echo|b<table></table>c}}d
11019
11020 a{{echo|b
11021 <table></table>
11022 c}}d
11023
11024 {{echo|a
11025
11026 <table></table>
11027
11028 b}}
11029 !! html
11030 <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>
11031
11032 <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">
11033 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11034 </span><p about="#mwt2">cd</p>
11035
11036 <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">
11037
11038 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11039
11040 </span><p about="#mwt3">b</p>
11041 !! end
11042
11043 !! test
11044 Parsoid: Merge double tds (T52603)
11045 !! options
11046 parsoid
11047 !! wikitext
11048 {|
11049 |{{echo|{{!}} foo}}
11050 |}
11051 !! html
11052 <table><tbody>
11053 <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>
11054 </tbody></table>
11055 !! end
11056
11057 !! test
11058 Parsoid: Merge double tds in nested transclusion content (T52603)
11059 !! options
11060 parsoid
11061 !! wikitext
11062 {{echo|<div>}}
11063 {|
11064 |{{echo|{{!}} foo}}
11065 |}
11066 {{echo|</div>}}
11067 !! html
11068 <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}}]}'>
11069 <table><tbody>
11070 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11071 </tbody></table>
11072 </div>
11073 !! end
11074
11075 ###
11076 ### <includeonly> and <noinclude> in attributes
11077 ###
11078 !!test
11079 0. includeonly around the entire attribute
11080 !! wikitext
11081 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11082 !! html
11083 <p><span id="v2">bar</span>
11084 </p>
11085 !!end
11086
11087 !!test
11088 1. includeonly in html attr key
11089 !! wikitext
11090 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11091 !! html
11092 <p><span id="foo">bar</span>
11093 </p>
11094 !!end
11095
11096 !!test
11097 2. includeonly in html attr value
11098 !! wikitext
11099 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11100 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11101 !! html
11102 <p><span id="v1">bar</span>
11103 <span id="v1">bar</span>
11104 </p>
11105 !!end
11106
11107 !!test
11108 3. includeonly in part of an attr value
11109 !! wikitext
11110 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11111 !! html
11112 <p><span style="color:red;">bar</span>
11113 </p>
11114 !!end
11115
11116 !!test
11117 4. includeonly in table attributes
11118 !! wikitext
11119 {|
11120 |- <noinclude>
11121 |-
11122 |a
11123 </noinclude>
11124 |- <includeonly>
11125 |-
11126 |b
11127 </includeonly>
11128 |}
11129 !! html
11130 <table>
11131
11132
11133 <tr>
11134 <td>a
11135 </td></tr>
11136 </table>
11137
11138 !!end
11139
11140 ###
11141 ### Token Stream Patcher tests
11142 ###
11143 ### These tests won't always pass wt2wt and other modes because
11144 ### on serialization, the table will be output on a new line.
11145 ### For now, we are blacklisting them, and using this to test selser.
11146 ###
11147
11148 !!test
11149 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11150 !!options
11151 parsoid=wt2html,wt2wt
11152 !!wikitext
11153 {{echo|}}{| width = '100%'
11154 |foo
11155 |}
11156 !!html/parsoid
11157 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11158 <tbody><tr><td>foo</td></tr>
11159 </tbody></table>
11160 !!end
11161
11162 ## We used to, but no longer wt2wt this test since the default serializer
11163 ## will normalize the include directives to serialize on their own line.
11164 ## Selser will take care of preserving formatting in scenarios where they
11165 ## intermingled with other wikitext.
11166 !!test
11167 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11168 !!options
11169 parsoid=wt2html
11170 !!wikitext
11171 <includeonly>a</includeonly>{| {{{b}}}
11172 |c
11173 |}
11174 !!html/parsoid
11175 <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}}}":""}}'>
11176 <tbody><tr><td>c</td></tr>
11177 </tbody></table>
11178
11179 !!end
11180
11181 ###
11182 ### Testing parsing of templates where a template arg
11183 ### has the same name as the template itself.
11184 ###
11185
11186 !! article
11187 Template:quote
11188 !! text
11189 {{{quote|{{{1}}}}}}
11190 !! endarticle
11191
11192 !!test
11193 Templates: Template Name/Arg clash: 1. Use of positional param
11194 !! wikitext
11195 {{quote|foo}}
11196 !! html
11197 <p>foo
11198 </p>
11199 !!end
11200
11201 !!test
11202 Templates: Template Name/Arg clash: 2. Use of named param
11203 !! wikitext
11204 {{quote|quote=foo}}
11205 !! html
11206 <p>foo
11207 </p>
11208 !!end
11209
11210 !!test
11211 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11212 !! wikitext
11213 {{quote|quote}}
11214 !! html
11215 <p>quote
11216 </p>
11217 !!end
11218
11219 ###
11220 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11221 ###
11222
11223 !!test
11224 Templates: 1. Simple use
11225 !! wikitext
11226 {{echo|Foo}}
11227 !! html
11228 <p>Foo
11229 </p>
11230 !!end
11231
11232 !!test
11233 Templates: 2. Inside a block tag
11234 !! wikitext
11235 <div>{{echo|Foo}}</div>
11236 <blockquote>{{echo|Foo}}</blockquote>
11237 !! html
11238 <div>Foo</div>
11239 <blockquote>Foo</blockquote>
11240
11241 !! html+tidy
11242 <div>Foo</div>
11243 <blockquote>
11244 <p>Foo</p>
11245 </blockquote>
11246 !!end
11247
11248 !!test
11249 Templates: P-wrapping: 1a. Templates on consecutive lines
11250 !! wikitext
11251 {{echo|Foo}}
11252 {{echo|bar}}
11253 !! html
11254 <p>Foo
11255 bar
11256 </p>
11257 !!end
11258
11259 !!test
11260 Templates: P-wrapping: 1b. Templates on consecutive lines
11261 !! wikitext
11262 Foo
11263
11264 {{echo|bar}}
11265 {{echo|baz}}
11266 !! html
11267 <p>Foo
11268 </p><p>bar
11269 baz
11270 </p>
11271 !!end
11272
11273 !!test
11274 Templates: P-wrapping: 1c. Templates on consecutive lines
11275 !! wikitext
11276 {{echo|Foo}}
11277 {{echo|bar}} <div>baz</div>
11278 !! html
11279 <p>Foo
11280 </p>
11281 bar <div>baz</div>
11282
11283 !! html+tidy
11284 <p>Foo</p>
11285 <p>bar</p>
11286 <div>baz</div>
11287 !! end
11288
11289 !!test
11290 Templates: P-wrapping: 1d. Template preceded by comment-only line
11291 !!options
11292 parsoid
11293 !! wikitext
11294 <!-- foo -->
11295 {{echo|Bar}}
11296 !! html
11297 <!-- foo -->
11298
11299 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11300 !!end
11301
11302 !!test
11303 Templates: Inline Text: 1. Multiple template uses
11304 !! wikitext
11305 {{echo|Foo}}bar{{echo|baz}}
11306 !! html
11307 <p>Foobarbaz
11308 </p>
11309 !!end
11310
11311 !!test
11312 Templates: Inline Text: 2. Back-to-back template uses
11313 !! wikitext
11314 {{echo|Foo}}{{echo|bar}}
11315 !! html
11316 <p>Foobar
11317 </p>
11318 !!end
11319
11320 !!test
11321 Templates: Block Tags: 1. Multiple template uses
11322 !! wikitext
11323 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11324 !! html
11325 <div>Foo</div><div>bar</div><div>baz</div>
11326
11327 !!end
11328
11329 !!test
11330 Templates: Block Tags: 2. Back-to-back template uses
11331 !! wikitext
11332 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11333 !! html
11334 <div>Foo</div><div>bar</div>
11335
11336 !!end
11337
11338 # This is an edge case relating to paragraph wrapping.
11339 !!test
11340 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11341 !! wikitext
11342 {{echo|a
11343 b</p>}}
11344 !! html/parsoid
11345 <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
11346 b</p>
11347 !!end
11348
11349 !!test
11350 Templates: Links: 1. Simple example
11351 !! wikitext
11352 {{echo|[[Foo|bar]]}}
11353 !! html
11354 <p><a href="/wiki/Foo" title="Foo">bar</a>
11355 </p>
11356 !!end
11357
11358 !!test
11359 Templates: Links: 2. Generation of link href
11360 !! wikitext
11361 [[{{echo|Foo}}|bar]]
11362 !! html
11363 <p><a href="/wiki/Foo" title="Foo">bar</a>
11364 </p>
11365 !!end
11366
11367 !!test
11368 Templates: Links: 3. Generation of part of a link href
11369 !! wikitext
11370 [[Fo{{echo|o}}|bar]]
11371
11372 [[Foo{{echo|bar}}]]
11373
11374 [[Foo{{echo|bar}}baz]]
11375
11376 [[Foo{{echo|bar}}|bar]]
11377
11378 [[:Foo{{echo|bar}}]]
11379
11380 [[:Foo{{echo|bar}}|bar]]
11381 !! html
11382 <p><a href="/wiki/Foo" title="Foo">bar</a>
11383 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11384 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11385 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11386 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11387 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11388 </p>
11389 !!end
11390
11391 !!test
11392 Templates: Links: 4. Multiple templates generating link href
11393 !! wikitext
11394 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11395 !! html
11396 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11397 </p>
11398 !!end
11399
11400 !!test
11401 Templates: Links: 5. Generation of link text
11402 !! wikitext
11403 [[Foo|{{echo|bar}}]]
11404 !! html
11405 <p><a href="/wiki/Foo" title="Foo">bar</a>
11406 </p>
11407 !!end
11408
11409 !!test
11410 Templates: Links: 5. Nested templates (only outermost template should be marked)
11411 !! wikitext
11412 {{echo|[[{{echo|Foo}}|bar]]}}
11413 !! html
11414 <p><a href="/wiki/Foo" title="Foo">bar</a>
11415 </p>
11416 !!end
11417
11418 !!test
11419 Templates: HTML Tag: 1. Generation of HTML attr. key
11420 !! wikitext
11421 <div {{echo|style}}="color:red;">foo</div>
11422 !! html
11423 <div style="color:red;">foo</div>
11424
11425 !!end
11426
11427 !!test
11428 Templates: HTML Tag: 2. Generation of HTML attr. value
11429 !! wikitext
11430 <div style={{echo|'color:red;'}}>foo</div>
11431 !! html
11432 <div style="color:red;">foo</div>
11433
11434 !!end
11435
11436 !!test
11437 Templates: HTML Tag: 3. Generation of HTML attr key and value
11438 !! wikitext
11439 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11440 !! html
11441 <div style="color:red;">foo</div>
11442
11443 !!end
11444
11445 !!test
11446 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11447 !! wikitext
11448 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11449 !! html
11450 <div title="This is a long title with just one piece templated">foo</div>
11451
11452 !!end
11453
11454 !!test
11455 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11456 !! wikitext
11457 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11458 !! html
11459 <div title="This is a long title with just one piece templated">foo</div>
11460
11461 !!end
11462
11463 !!test
11464 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11465 !! wikitext
11466 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11467 !! html
11468 <div title="This is a long title with just one piece templated">foo</div>
11469
11470 !!end
11471
11472 # SSS FIXME: While it is great we added support for all this,
11473 # do we want to make this part of the spec? Maybe we want to
11474 # deprecate this kind of usage in the future?
11475 !!test
11476 Templates: HTML Tag: 7. Generation of partial attribute key string
11477 !! wikitext
11478 <div st{{echo|yle}}="color:red;">foo</div>
11479 !! html
11480 <div style="color:red;">foo</div>
11481
11482 !!end
11483
11484 !! test
11485 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11486 !! wikitext
11487 <div {{echo|1=id="v1"}}>bar</div>
11488 !! html
11489 <div id="v1">bar</div>
11490
11491 !!end
11492
11493 !! test
11494 Templates: HTML Tag: 9. Multiple template-generated attributes
11495 !! wikitext
11496 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11497 !! html
11498 <div id="v1" title="foo">bar</div>
11499
11500 !!end
11501
11502 !! test
11503 Templates: Support for templates generating attributes and content
11504 !! wikitext
11505 {| {{mixed_attr_content_template}}
11506 |-
11507 |bar
11508 |}
11509 !! html/php
11510 <table style="color:red;" title="T48811">
11511
11512 <tr>
11513 <td>foo
11514 </td></tr>
11515 <tr>
11516 <td>bar
11517 </td></tr></table>
11518
11519 !! html/parsoid
11520 <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|}"]}'>
11521 <tbody><tr>
11522 <td>foo</td></tr>
11523 <tr>
11524 <td>bar</td></tr>
11525 </tbody></table>
11526 !!end
11527
11528 !! test
11529 1. Entities and nowikis inside templated attributes should be handled correctly
11530 !! wikitext
11531 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11532 !! html/php
11533 <div style="background:#f9f9f9;">foo</div>
11534
11535 !! html/parsoid
11536 <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>
11537 !! end
11538
11539 !! test
11540 2. Entities and nowikis inside templated attributes should be handled correctly
11541 !! wikitext
11542 {|
11543 |{{table_attribs_3}}
11544 |}
11545 !! html/php
11546 <table>
11547 <tr>
11548 <td style="background:#f9f9f9;">Foo
11549 </td></tr></table>
11550
11551 !! html/parsoid
11552 <table>
11553 <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>
11554 </tbody></table>
11555 !! end
11556
11557 !! test
11558 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11559 !! wikitext
11560 {{tbl-start}}
11561 |{{table_attribs_3}}
11562 {{tbl-end}}
11563 !! html/php
11564 <table>
11565 <tr>
11566 <td style="background:#f9f9f9;">Foo
11567 </td></tr></table>
11568
11569 !! html/parsoid
11570 <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}}]}'>
11571 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11572 </tbody></table>
11573 !! end
11574
11575 # T107622
11576 !! test
11577 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11578 !! wikitext
11579 {|
11580 | {{table_attribs_6}} hi
11581 |}
11582 !! html/php
11583 <table>
11584 <tr>
11585 <td style="background: red;"> hi
11586 </td></tr></table>
11587
11588 !! html/parsoid
11589 <table>
11590 <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>
11591 </tbody></table>
11592 !! end
11593
11594 !!test
11595 Templates: HTML Tables: 1. Generating start of a HTML table
11596 !! wikitext
11597 {{echo|<table><tr><td>foo</td>}}</tr></table>
11598 !! html
11599 <table><tr><td>foo</td></tr></table>
11600
11601 !!end
11602
11603 !!test
11604 Templates: HTML Tables: 2a. Generating middle of a HTML table
11605 !! wikitext
11606 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11607 !! html
11608 <table><tr><td>foo</td></tr></table>
11609
11610 !!end
11611
11612 !!test
11613 Templates: HTML Tables: 2b. Generating middle of a HTML table
11614 !! wikitext
11615 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11616 !! html
11617 <table><tr><td>foo</td></tr></table>
11618
11619 !!end
11620
11621 !!test
11622 Templates: HTML Tables: 3. Generating end of a HTML table
11623 !! wikitext
11624 <table><tr>{{echo|<td>foo</td></tr></table>}}
11625 !! html
11626 <table><tr><td>foo</td></tr></table>
11627
11628 !!end
11629
11630 !!test
11631 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11632 !! wikitext
11633 {{echo|<table>}}<tr><td>foo</td></tr></table>
11634 !! html
11635 <table><tr><td>foo</td></tr></table>
11636
11637 !!end
11638
11639 !!test
11640 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11641 !! wikitext
11642 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11643 !! html
11644 <table><tr><td>foo</td></tr></table>
11645
11646 !!end
11647
11648 !!test
11649 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11650 !! wikitext
11651 <table><tr>{{echo|<td>}}foo</td></tr></table>
11652 !! html
11653 <table><tr><td>foo</td></tr></table>
11654
11655 !!end
11656
11657 !!test
11658 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11659 !! wikitext
11660 <table><tr><td>foo{{echo|</td>}}</tr></table>
11661 !! html
11662 <table><tr><td>foo</td></tr></table>
11663
11664 !!end
11665
11666 !!test
11667 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11668 !! wikitext
11669 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11670 !! html
11671 <table><tr><td>foo</td></tr></table>
11672
11673 !!end
11674
11675 !!test
11676 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11677 !! wikitext
11678 <table><tr><td>foo</td></tr>{{echo|</table>}}
11679 !! html
11680 <table><tr><td>foo</td></tr></table>
11681
11682 !!end
11683
11684 !!test
11685 Templates: HTML Tables: 5. Proper fostering of categories from inside
11686 !!options
11687 parsoid=wt2html,wt2wt
11688 !! wikitext
11689 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11690 <!--Two categories (Bug 50330)-->
11691 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11692 !! html
11693 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11694 <!--Two categories (Bug 50330)-->
11695 <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>
11696 !!end
11697
11698 !!test
11699 Templates: Wiki Tables: 1a. Fostering of entire template content
11700 !! wikitext
11701 {|
11702 {{echo|a}}
11703 |}
11704 !! html
11705 <table>
11706 a
11707 <tr><td></td></tr></table>
11708
11709 !! html+tidy
11710 <p>a</p>
11711 <table>
11712 <tr>
11713 <td></td>
11714 </tr>
11715 </table>
11716 !! end
11717
11718 !!test
11719 Templates: Wiki Tables: 1b. Fostering of entire template content
11720 !! wikitext
11721 {|
11722 {{echo|<div>}}
11723 foo
11724 {{echo|</div>}}
11725 |}
11726 !! html
11727 <table>
11728 <div>
11729 <p>foo
11730 </p>
11731 </div>
11732 <tr><td></td></tr></table>
11733
11734 !! html+tidy
11735 <div>
11736 <p>foo</p>
11737 </div>
11738 <table>
11739 <tr>
11740 <td></td>
11741 </tr>
11742 </table>
11743 !! end
11744
11745 !!test
11746 Templates: Wiki Tables: 2. Fostering of partial template content
11747 !! wikitext
11748 {|
11749 {{echo|a
11750 <div>b</div>}}
11751 |}
11752 !! html
11753 <table>
11754 a
11755 <div>b</div>
11756 <tr><td></td></tr></table>
11757
11758 !! html+tidy
11759 <p>a</p>
11760 <div>b</div>
11761 <table>
11762 <tr>
11763 <td></td>
11764 </tr>
11765 </table>
11766 !! end
11767
11768 !!test
11769 Templates: Wiki Tables: 3. td-content via multiple templates
11770 !! wikitext
11771 {|
11772 {{echo|{{pipe}}a}}{{echo|b}}
11773 |}
11774 !! html
11775 <table>
11776 <tr>
11777 <td>ab
11778 </td></tr></table>
11779
11780 !!end
11781
11782 !!test
11783 Templates: Wiki Tables: 4. Templated tags, no content
11784 !! wikitext
11785 {{tbl-start}}
11786 {{tbl-end}}
11787 !! html
11788 <table>
11789 <tr><td></td></tr></table>
11790
11791 !!end
11792
11793 !!test
11794 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11795 !! wikitext
11796 {{tbl-start}}
11797 |foo
11798 {{tbl-end}}
11799 !! html
11800 <table>
11801 <tr>
11802 <td>foo
11803 </td></tr></table>
11804
11805 !!end
11806
11807 !!test
11808 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11809 !! wikitext
11810 {{tbl-start}}
11811 {{!}}foo
11812 {{tbl-end}}
11813 !! html
11814 <table>
11815 <tr>
11816 <td>foo
11817 </td></tr></table>
11818
11819 !!end
11820
11821 ## This test case is very specific to Parsoid's internals
11822 ## and is hence only tested for Parsoid's code. Parsoid uses
11823 ## a <meta> marker tag for <ref> tags and they are expanded
11824 ## much later. We are verifying that this <meta> tag usage
11825 ## doesn't prevent foster parenting.
11826 !!test
11827 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11828 !!wikitext
11829 {{PartialTable}}<ref>foo</ref>
11830 |}
11831
11832 <references />
11833 !!html/parsoid
11834 <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">
11835 <tbody>
11836 </tbody></table>
11837
11838 <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>
11839 !!end
11840
11841 !! test
11842 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11843 !! wikitext
11844 {{echo|
11845 {{{!}}
11846 {{!}}-}}
11847 <onlyinclude>
11848 |foo
11849 </onlyinclude>
11850 {{!}}}
11851 !! html/parsoid
11852 <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{{!}}}"]}'>
11853 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11854 <tbody><tr>
11855
11856 <td>foo
11857 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11858 </tbody></table>
11859 !! end
11860
11861 !!test
11862 Templates: Lists: Multi-line list-items via templates
11863 !! wikitext
11864 *{{echo|a {{nonexistent|
11865 unused}}}}
11866 *{{echo|b {{nonexistent|
11867 unused}}}}
11868 !! html
11869 <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>
11870 <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>
11871
11872 !!end
11873
11874 !!test
11875 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11876 !! wikitext
11877 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11878 !! html
11879 <p><i>ab</i>c<i>d</i>e
11880 </p>
11881 !!end
11882
11883 !!test
11884 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11885 (PHP parser generates misnested html)
11886 !! wikitext
11887 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11888 !! html/parsoid
11889 <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>
11890 !!end
11891
11892 !!test
11893 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11894 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11895 !! options
11896 parsoid=wt2html,wt2wt
11897 !! wikitext
11898 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11899 !! html
11900 <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>
11901 <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>
11902 <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>
11903 !!end
11904
11905 !!test
11906 Templates: Ugly nesting: 4. Divs opened/closed across templates
11907 !! wikitext
11908 a<div>b{{echo|c</div>d}}e
11909 !! html
11910 a<div>bc</div>de
11911
11912 !! html+tidy
11913 <p>a</p>
11914 <div>bc</div>
11915 <p>de</p>
11916 !! end
11917
11918 !!test
11919 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11920 (Parsoid-centric)
11921 !! options
11922 parsoid
11923 !! wikitext
11924 {|
11925 |{{echo|foo</table>}}
11926 |bar
11927 |}
11928 !! html
11929 <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|}"]}'>
11930
11931 <tbody>
11932 <tr>
11933 <td>foo</td></tr></tbody></table><span about="#mwt1">
11934 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11935 |}</span>
11936 !!end
11937
11938 !!test
11939 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11940 (Parsoid-centric)
11941 !! options
11942 parsoid
11943 !! wikitext
11944 <table>
11945 <tr>
11946 <td>
11947 <table>
11948 <tr>
11949 <td>1. {{echo|foo </table>}}</td>
11950 <td> bar </td>
11951 <td>2. {{echo|baz </table>}}</td>
11952 </tr>
11953 <tr>
11954 <td>abc</td>
11955 </tr>
11956 </table>
11957 </td>
11958 </tr>
11959 <tr>
11960 <td>xyz</td>
11961 </tr>
11962 </table>
11963 !! html
11964 <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>"]}'>
11965 <tbody><tr>
11966 <td>
11967 <table>
11968 <tbody><tr>
11969 <td>1. foo </td></tr></tbody></table></td>
11970 <td> bar </td>
11971 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11972 </span><span about="#mwt2">
11973 </span><span about="#mwt2">
11974 </span><span about="#mwt2">abc</span><span about="#mwt2">
11975 </span><span about="#mwt2">
11976 </span><span about="#mwt2">
11977 </span><span about="#mwt2">
11978 </span><span about="#mwt2">
11979 </span><span about="#mwt2">
11980 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11981 </span><span about="#mwt2">
11982 </span>
11983 !!end
11984
11985 !! test
11986 Templates: Ugly templates: 3. newline-only template parameter
11987 !! wikitext
11988 foo {{echo|
11989 }}
11990 !! html
11991 <p>foo
11992 </p>
11993 !! end
11994
11995 # This looks like a bug: a single newline triggers p/br for some reason.
11996 !! test
11997 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11998 !! wikitext
11999 {{echo|
12000 }}
12001 !! html
12002 <p><br />
12003 </p>
12004 !! end
12005
12006 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12007 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12008 !! test
12009 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12010 !! wikitext
12011 {{echo|<table>}}
12012 {{echo|<div>foo}}
12013 {{echo|</table>}}
12014 !! html/parsoid
12015 <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
12016 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12017 </table>
12018 !! end
12019
12020 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12021 # that are "identical" and generate nesting cycles in the algorithm
12022 !! test
12023 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12024 !! wikitext
12025 {{echo|<table><tr><td><table>}}
12026 {{echo|<div>}}
12027 {{echo|</div>}}
12028 !! html/parsoid
12029 <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"}'>
12030 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12031 </table></td></tr></tbody></table>
12032 !! end
12033
12034 !! test
12035 Templates: Parameters substituted at the top-level
12036 !! wikitext
12037 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12038 !! html/php
12039 <p><i>who</i> me? <b>never!</b>
12040 </p>
12041 !! html/parsoid
12042 <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>
12043 !! end
12044
12045 !!test
12046 Parser Functions: 1. Simple example
12047 !! wikitext
12048 {{uc:foo}}
12049 !! html
12050 <p>FOO
12051 </p>
12052 !!end
12053
12054 !!test
12055 Parser Functions: 2. Nested use (only outermost should be marked up)
12056 !! wikitext
12057 {{uc:{{lc:FOO}}}}
12058 !! html
12059 <p>FOO
12060 </p>
12061 !!end
12062
12063 ###
12064 ### Pre-save transform tests
12065 ###
12066 !! test
12067 pre-save transform: subst:
12068 !! options
12069 pst
12070 !! wikitext
12071 {{subst:test}}
12072 !! html/php
12073 This is a test template
12074 !! end
12075
12076 !! test
12077 pre-save transform: normal template
12078 !! options
12079 pst
12080 !! wikitext
12081 {{test}}
12082 !! html/php
12083 {{test}}
12084 !! end
12085
12086 !! test
12087 pre-save transform: nonexistent template
12088 !! options
12089 pst
12090 !! wikitext
12091 {{thistemplatedoesnotexist}}
12092 !! html/php
12093 {{thistemplatedoesnotexist}}
12094 !! end
12095
12096 !! test
12097 pre-save transform: subst magic variables
12098 !! options
12099 pst
12100 !! wikitext
12101 {{subst:SITENAME}}
12102 !! html/php
12103 MediaWiki
12104 !! end
12105
12106 # This is bug 89, which I fixed. -- wtm
12107 !! test
12108 pre-save transform: subst: templates with parameters
12109 !! options
12110 pst
12111 !! wikitext
12112 {{subst:paramtest|param="something else"}}
12113 !! html/php
12114 This is a test template with parameter "something else"
12115 !! end
12116
12117 !! article
12118 Template:nowikitest
12119 !! text
12120 <nowiki>'''not wiki'''</nowiki>
12121 !! endarticle
12122
12123 !! test
12124 pre-save transform: nowiki in subst (bug 1188)
12125 !! options
12126 pst
12127 !! wikitext
12128 {{subst:nowikitest}}
12129 !! html/php
12130 <nowiki>'''not wiki'''</nowiki>
12131 !! end
12132
12133 !! article
12134 Template:commenttest
12135 !! text
12136 This template has <!-- a comment --> in it.
12137 !! endarticle
12138
12139 !! test
12140 pre-save transform: comment in subst (bug 1936)
12141 !! options
12142 pst
12143 !! wikitext
12144 {{subst:commenttest}}
12145 !! html/php
12146 This template has <!-- a comment --> in it.
12147 !! end
12148
12149 !! test
12150 pre-save transform: unclosed tag
12151 !! options
12152 pst noxml
12153 !! wikitext
12154 <nowiki>'''not wiki'''
12155 !! html/php
12156 <nowiki>'''not wiki'''
12157 !! end
12158
12159 !! test
12160 pre-save transform: mixed tag case
12161 !! options
12162 pst noxml
12163 !! wikitext
12164 <NOwiki>'''not wiki'''</noWIKI>
12165 !! html/php
12166 <NOwiki>'''not wiki'''</noWIKI>
12167 !! end
12168
12169 !! test
12170 pre-save transform: unclosed comment in <nowiki>
12171 !! options
12172 pst noxml
12173 !! wikitext
12174 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12175 !! html/php
12176 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12177 !!end
12178
12179 # Leading @ in this template definition works around a limitation
12180 # in parsoid's parserTests which otherwise strips the <span> from the
12181 # result (confusing it for a template wrapper)
12182 !! article
12183 Template:dangerous
12184 !!text
12185 @<span onmouseover="alert('crap')">Oh no</span>
12186 !!endarticle
12187
12188 !!test
12189 (confirming safety of fix for subst bug 1936)
12190 !! wikitext
12191 {{Template:dangerous}}
12192 !! html
12193 <p>@<span>Oh no</span>
12194 </p>
12195 !! end
12196
12197 !! test
12198 pre-save transform: comment containing gallery (bug 5024)
12199 !! options
12200 pst
12201 !! wikitext
12202 <!-- <gallery>data</gallery> -->
12203 !! html/php
12204 <!-- <gallery>data</gallery> -->
12205 !!end
12206
12207 !! test
12208 pre-save transform: comment containing extension
12209 !! options
12210 pst
12211 !! wikitext
12212 <!-- <tag>data</tag> -->
12213 !! html/php
12214 <!-- <tag>data</tag> -->
12215 !!end
12216
12217 !! test
12218 pre-save transform: comment containing nowiki
12219 !! options
12220 pst
12221 !! wikitext
12222 <!-- <nowiki>data</nowiki> -->
12223 !! html/php
12224 <!-- <nowiki>data</nowiki> -->
12225 !!end
12226
12227 !! test
12228 pre-save transform: <noinclude> in subst (bug 3298)
12229 !! options
12230 pst
12231 !! wikitext
12232 {{subst:Includes}}
12233 !! html/php
12234 Foobar
12235 !! end
12236
12237 !! test
12238 pre-save transform: <onlyinclude> in subst (bug 3298)
12239 !! options
12240 pst
12241 !! wikitext
12242 {{subst:Includes2}}
12243 !! html/php
12244 Foo
12245 !! end
12246
12247 !! article
12248 Template:SubstTest
12249 !!text
12250 {{<includeonly>subst:</includeonly>Includes}}
12251 !! endarticle
12252
12253 !! article
12254 Template:SafeSubstTest
12255 !! text
12256 {{<includeonly>safesubst:</includeonly>Includes}}
12257 !! endarticle
12258
12259 !! test
12260 bug 22297: safesubst: works during PST
12261 !! options
12262 pst
12263 !! wikitext
12264 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12265 !! html/php
12266 FoobarFoobar
12267 !! end
12268
12269 !! test
12270 bug 22297: safesubst: works during normal parse
12271 !! wikitext
12272 {{SafeSubstTest}}
12273 !! html
12274 <p>Foobar
12275 </p>
12276 !! end
12277
12278 !! test
12279 subst: does not work during normal parse
12280 !! wikitext
12281 {{SubstTest}}
12282 !! html
12283 <p>{{subst:Includes}}
12284 </p>
12285 !! end
12286
12287 !! test
12288 pre-save transform: context links ("pipe trick")
12289 !! options
12290 pst
12291 !! wikitext
12292 [[Article (context)|]]
12293 [[Bar:Article|]]
12294 [[:Bar:Article|]]
12295 [[Bar:Article (context)|]]
12296 [[:Bar:Article (context)|]]
12297 [[|Article]]
12298 [[|Article (context)]]
12299 [[Bar:X (Y) Z|]]
12300 [[:Bar:X (Y) Z|]]
12301 !! html/php
12302 [[Article (context)|Article]]
12303 [[Bar:Article|Article]]
12304 [[:Bar:Article|Article]]
12305 [[Bar:Article (context)|Article]]
12306 [[:Bar:Article (context)|Article]]
12307 [[Article]]
12308 [[Article (context)]]
12309 [[Bar:X (Y) Z|X (Y) Z]]
12310 [[:Bar:X (Y) Z|X (Y) Z]]
12311 !! end
12312
12313 !! test
12314 pre-save transform: context links ("pipe trick") with interwiki prefix
12315 !! options
12316 pst
12317 !! wikitext
12318 [[interwiki:Article|]]
12319 [[:interwiki:Article|]]
12320 [[interwiki:Bar:Article|]]
12321 [[:interwiki:Bar:Article|]]
12322 !! html/php
12323 [[interwiki:Article|Article]]
12324 [[:interwiki:Article|Article]]
12325 [[interwiki:Bar:Article|Bar:Article]]
12326 [[:interwiki:Bar:Article|Bar:Article]]
12327 !! end
12328
12329 !! test
12330 pre-save transform: context links ("pipe trick") with parens in title
12331 !! options
12332 pst title=[[Somearticle (context)]]
12333 !! wikitext
12334 [[|Article]]
12335 !! html/php
12336 [[Article (context)|Article]]
12337 !! end
12338
12339 !! test
12340 pre-save transform: context links ("pipe trick") with comma in title
12341 !! options
12342 pst title=[[Someplace, Somewhere]]
12343 !! wikitext
12344 [[|Otherplace]]
12345 [[Otherplace, Elsewhere|]]
12346 [[Otherplace, Elsewhere, Anywhere|]]
12347 !! html/php
12348 [[Otherplace, Somewhere|Otherplace]]
12349 [[Otherplace, Elsewhere|Otherplace]]
12350 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12351 !! end
12352
12353 !! test
12354 pre-save transform: context links ("pipe trick") with parens and comma
12355 !! options
12356 pst title=[[Someplace (IGNORED), Somewhere]]
12357 !! wikitext
12358 [[|Otherplace]]
12359 [[Otherplace (place), Elsewhere|]]
12360 !! html/php
12361 [[Otherplace, Somewhere|Otherplace]]
12362 [[Otherplace (place), Elsewhere|Otherplace]]
12363 !! end
12364
12365 !! test
12366 pre-save transform: context links ("pipe trick") with comma and parens
12367 !! options
12368 pst title=[[Who, me? (context)]]
12369 !! wikitext
12370 [[|Yes, you.]]
12371 [[Me, Myself, and I (1937 song)|]]
12372 !! html/php
12373 [[Yes, you. (context)|Yes, you.]]
12374 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12375 !! end
12376
12377 !! test
12378 pre-save transform: context links ("pipe trick") with namespace
12379 !! options
12380 pst title=[[Ns:Somearticle]]
12381 !! wikitext
12382 [[|Article]]
12383 !! html/php
12384 [[Ns:Article|Article]]
12385 !! end
12386
12387 !! test
12388 pre-save transform: context links ("pipe trick") with namespace and parens
12389 !! options
12390 pst title=[[Ns:Somearticle (context)]]
12391 !! wikitext
12392 [[|Article]]
12393 !! html/php
12394 [[Ns:Article (context)|Article]]
12395 !! end
12396
12397 !! test
12398 pre-save transform: context links ("pipe trick") with namespace and comma
12399 !! options
12400 pst title=[[Ns:Somearticle, Context, Whatever]]
12401 !! wikitext
12402 [[|Article]]
12403 !! html/php
12404 [[Ns:Article, Context, Whatever|Article]]
12405 !! end
12406
12407 !! test
12408 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12409 !! options
12410 pst title=[[Ns:Somearticle, Context (context)]]
12411 !! wikitext
12412 [[|Article]]
12413 !! html/php
12414 [[Ns:Article (context)|Article]]
12415 !! end
12416
12417 !! test
12418 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12419 !! options
12420 pst title=[[Ns:Somearticle (IGNORED), Context]]
12421 !! wikitext
12422 [[|Article]]
12423 !! html/php
12424 [[Ns:Article, Context|Article]]
12425 !! end
12426
12427 !! test
12428 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12429 !! options
12430 pst
12431 !! wikitext
12432 [[Article(context)|]]
12433 [[Bar:Article(context)|]]
12434 [[:Bar:Article(context)|]]
12435 [[|Article(context)]]
12436 [[Bar:X(Y)Z|]]
12437 [[:Bar:X(Y)Z|]]
12438 !! html/php
12439 [[Article(context)|Article]]
12440 [[Bar:Article(context)|Article]]
12441 [[:Bar:Article(context)|Article]]
12442 [[Article(context)]]
12443 [[Bar:X(Y)Z|X(Y)Z]]
12444 [[:Bar:X(Y)Z|X(Y)Z]]
12445 !! end
12446
12447 !! test
12448 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12449 !! options
12450 pst
12451 !! wikitext
12452 [[Article (context)|]]
12453 [[Bar:Article (context)|]]
12454 [[:Bar:Article (context)|]]
12455 [[|Article (context)]]
12456 [[Bar:X (Y) Z|]]
12457 [[:Bar:X (Y) Z|]]
12458 !! html/php
12459 [[Article (context)|Article]]
12460 [[Bar:Article (context)|Article]]
12461 [[:Bar:Article (context)|Article]]
12462 [[Article (context)]]
12463 [[Bar:X (Y) Z|X (Y) Z]]
12464 [[:Bar:X (Y) Z|X (Y) Z]]
12465 !! end
12466
12467 !! test
12468 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12469 !! options
12470 pst
12471 !! wikitext
12472 [[Article(context)|]]
12473 [[Bar:Article(context)|]]
12474 [[:Bar:Article(context)|]]
12475 [[|Article(context)]]
12476 [[Bar:X(Y)Z|]]
12477 [[:Bar:X(Y)Z|]]
12478 !! html/php
12479 [[Article(context)|Article]]
12480 [[Bar:Article(context)|Article]]
12481 [[:Bar:Article(context)|Article]]
12482 [[Article(context)]]
12483 [[Bar:X(Y)Z|X(Y)Z]]
12484 [[:Bar:X(Y)Z|X(Y)Z]]
12485 !! end
12486
12487 !! test
12488 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12489 !! options
12490 pst
12491 !! wikitext
12492 [[Article (context), context|]]
12493 [[Article (context),context|]]
12494 [[Bar:Article (context), context|]]
12495 [[Bar:Article (context),context|]]
12496 [[:Bar:Article (context), context|]]
12497 [[:Bar:Article (context),context|]]
12498 !! html/php
12499 [[Article (context), context|Article]]
12500 [[Article (context),context|Article]]
12501 [[Bar:Article (context), context|Article]]
12502 [[Bar:Article (context),context|Article]]
12503 [[:Bar:Article (context), context|Article]]
12504 [[:Bar:Article (context),context|Article]]
12505 !! end
12506
12507 !! test
12508 pre-save transform: trim trailing empty lines
12509 !! options
12510 pst
12511 !! wikitext
12512 Empty lines are trimmed
12513
12514
12515
12516
12517 !! html/php
12518 Empty lines are trimmed
12519 !! end
12520
12521 !! test
12522 pre-save transform: Signature expansion
12523 !! options
12524 pst
12525 !! wikitext
12526 * ~~~
12527 * <noinclude>~~~</noinclude>
12528 * <includeonly>~~~</includeonly>
12529 * <onlyinclude>~~~</onlyinclude>
12530 !! html/php
12531 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12532 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12533 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12534 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12535 !! end
12536
12537
12538 !! test
12539 pre-save transform: Signature expansion in nowiki tags (bug 93)
12540 !! options
12541 pst disabled
12542 !! wikitext
12543 Shall not expand:
12544
12545 <nowiki>~~~~</nowiki>
12546
12547 <includeonly><nowiki>~~~~</nowiki></includeonly>
12548
12549 <noinclude><nowiki>~~~~</nowiki></noinclude>
12550
12551 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12552
12553 {{subst:Foo}} shall be converted to FOO
12554
12555 As well as inside noinclude/onlyinclude
12556 <noinclude>{{subst:Foo}}</noinclude>
12557 <onlyinclude>{{subst:Foo}}</onlyinclude>
12558
12559 But not inside includeonly
12560 <includeonly>{{subst:Foo}}</includeonly>
12561 !! html/php
12562 Shall not expand:
12563
12564 <nowiki>~~~~</nowiki>
12565
12566 <includeonly><nowiki>~~~~</nowiki></includeonly>
12567
12568 <noinclude><nowiki>~~~~</nowiki></noinclude>
12569
12570 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12571
12572 FOO shall be converted to FOO
12573
12574 As well as inside noinclude/onlyinclude
12575 <noinclude>FOO</noinclude>
12576 <onlyinclude>FOO</onlyinclude>
12577
12578 But not inside includeonly
12579 <includeonly>{{subst:Foo}}</includeonly>
12580 !! end
12581
12582 !! test
12583 Parsoid: Recognize nowiki with trailing space in tags
12584 !! options
12585 parsoid=wt2html
12586 !! wikitext
12587 <nowiki ><div>[[foo]]</nowiki >
12588
12589 a<nowiki / >b
12590
12591 c<nowiki />d
12592
12593 e<nowiki/ >f
12594 !! html
12595 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12596 <p>ab</p>
12597 <p>cd</p>
12598 <p>ef</p>
12599 !! end
12600
12601 !! test
12602 Parsoid: Recognize nowiki with odd capitalization
12603 !! options
12604 parsoid=wt2html
12605 !! wikitext
12606 <noWikI ><div>[[foo]]</Nowiki >
12607 !! html
12608 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12609 !! end
12610
12611
12612 !! test
12613 Parsoid: Escape nowiki with trailing space in tags
12614 !! options
12615 parsoid=html2wt
12616 !! html/parsoid
12617 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12618 <p>a&lt;nowiki /&gt;b</p>
12619 <p>c&lt;nowiki/ &gt;d</p>
12620 !! wikitext
12621 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12622
12623 a&lt;nowiki /&gt;b
12624
12625 c&lt;nowiki/ &gt;d
12626 !! end
12627
12628 !! test
12629 Parsoid: Escape weird noWikI capitalizations
12630 !! options
12631 parsoid=html2wt
12632 !! html/parsoid
12633 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12634 !! wikitext
12635 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12636 !! end
12637
12638 ###
12639 ### Message transform tests
12640 ###
12641 !! test
12642 message transform: magic variables
12643 !! options
12644 msg
12645 !! wikitext
12646 {{SITENAME}}
12647 !! html
12648 MediaWiki
12649 !! end
12650
12651 !! test
12652 message transform: should not transform wiki markup
12653 !! options
12654 msg
12655 !! wikitext
12656 ''test''
12657 !! html
12658 ''test''
12659 !! end
12660
12661 !! test
12662 message transform: <noinclude> in transcluded template (bug 4926)
12663 !! options
12664 msg
12665 !! wikitext
12666 {{Includes}}
12667 !! html
12668 Foobar
12669 !! end
12670
12671 !! test
12672 message transform: <onlyinclude> in transcluded template (bug 4926)
12673 !! options
12674 msg
12675 !! wikitext
12676 {{Includes2}}
12677 !! html
12678 Foo
12679 !! end
12680
12681 !! test
12682 {{#special:}} page name, known
12683 !! options
12684 msg
12685 !! wikitext
12686 {{#special:Recentchanges}}
12687 !! html
12688 Special:RecentChanges
12689 !! end
12690
12691 !! test
12692 {{#special:}} page name with subpage, known
12693 !! options
12694 msg
12695 !! wikitext
12696 {{#special:Recentchanges/param}}
12697 !! html
12698 Special:RecentChanges/param
12699 !! end
12700
12701 !! test
12702 {{#special:}} page name, unknown
12703 !! options
12704 msg
12705 !! wikitext
12706 {{#special:foobar nonexistent}}
12707 !! html
12708 Special:Foobar nonexistent
12709 !! end
12710
12711 !! test
12712 {{#speciale:}} page name, known
12713 !! options
12714 msg
12715 !! wikitext
12716 {{#speciale:Recentchanges}}
12717 !! html
12718 Special:RecentChanges
12719 !! end
12720
12721 !! test
12722 {{#speciale:}} page name with subpage, known
12723 !! options
12724 msg
12725 !! wikitext
12726 {{#speciale:Recentchanges/param}}
12727 !! html
12728 Special:RecentChanges/param
12729 !! end
12730
12731 !! test
12732 {{#speciale:}} page name, unknown
12733 !! options
12734 msg
12735 !! wikitext
12736 {{#speciale:foobar nonexistent}}
12737 !! html
12738 Special:Foobar_nonexistent
12739 !! end
12740
12741 ###
12742 ### Images
12743 ###
12744 ### For Parsoid-specific tests, see
12745 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12746
12747 !! test
12748 Simple image
12749 !! options
12750 parsoid=wt2html,wt2wt,html2html
12751 !! wikitext
12752 [[Image:foobar.jpg]]
12753 !! html/php
12754 <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>
12755 </p>
12756 !! html/parsoid
12757 <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>
12758 !! end
12759
12760 !! test
12761 Simple image (using File: namespace, now canonical)
12762 !! wikitext
12763 [[File:Foobar.jpg]]
12764 !! html/php
12765 <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>
12766 </p>
12767 !! html/parsoid
12768 <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>
12769 !! end
12770
12771 !! test
12772 Right-aligned image
12773 !! wikitext
12774 [[File:Foobar.jpg|right]]
12775 !! html/php
12776 <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>
12777
12778 !! html/parsoid
12779 <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>
12780 !! end
12781
12782 !! test
12783 Image with caption
12784 !! wikitext
12785 [[File:Foobar.jpg|right|Caption text]]
12786 !! html/php
12787 <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>
12788
12789 !! html/parsoid
12790 <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>
12791 !! end
12792
12793 !! test
12794 Image with caption, bug 53312 #1
12795 !! wikitext
12796 [[File:Foobar.jpg|right|Caption page stuff]]
12797 !! html/php
12798 <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>
12799
12800 !! html/parsoid
12801 <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>
12802 !! end
12803
12804 !! test
12805 Image with caption, bug 53312 #2
12806 !! wikitext
12807 [[File:Foobar.jpg|right|Caption page=]]
12808 !! html/php
12809 <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>
12810
12811 !! html/parsoid
12812 <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>
12813 !! end
12814
12815 !! test
12816 Image with caption, bug 53312 #3
12817 !! wikitext
12818 [[File:Foobar.jpg|right|Caption page=stuff]]
12819 !! html/php
12820 <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>
12821
12822 !! html/parsoid
12823 <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>
12824 !! end
12825
12826 !! test
12827 Allow empty links in image captions (Bug 60753)
12828 !! options
12829 thumbsize=220
12830 !! wikitext
12831 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12832 [[]]
12833 [[Link2]]
12834 ]]
12835 !! html/php
12836 <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>
12837
12838 !! html/parsoid
12839 <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>
12840 [[]]
12841 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12842 </figcaption></figure>
12843 !! end
12844
12845 !! test
12846 Titles in unlinked images (T23454)
12847 !! wikitext
12848 [[File:Foobar.jpg|link=|stuff]]
12849 !! html/php
12850 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12851 </p>
12852 !! end
12853
12854 !! test
12855 Link with empty target
12856 !! wikitext
12857 [[]]
12858 !! html
12859 <p>[[]]
12860 </p>
12861 !! end
12862
12863 !! test
12864 Image with link trail
12865 !! wikitext
12866 Linktrails should not work for images: [[File:Foobar.jpg]]s
12867 !! html/php
12868 <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
12869 </p>
12870 !! html/parsoid
12871 <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>
12872 !! end
12873
12874 !! test
12875 Image with empty attribute
12876 !! options
12877 parsoid=wt2html,wt2wt,html2html
12878 !! wikitext
12879 [[File:Foobar.jpg|right||Caption text]]
12880 !! html/php
12881 <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>
12882
12883 !! html/parsoid
12884 <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>
12885 !! end
12886
12887 !! test
12888 1. Block image with individual attributes from templates
12889 !! wikitext
12890 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12891 !! html/php
12892 <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>
12893
12894 !! html/parsoid
12895 <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>
12896 !! end
12897
12898 !! test
12899 2. Block Image with individual attributes from templates
12900 !! wikitext
12901 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12902 !! html/php
12903 <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>
12904
12905 !! html/parsoid
12906 <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>
12907 !! end
12908
12909 !! test
12910 3. Inline image with individual attributes from templates
12911 !! wikitext
12912 [[File:Foobar.jpg|{{echo|50px}}]]
12913 !! html/php
12914 <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>
12915 </p>
12916 !! html/parsoid
12917 <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>
12918 !! end
12919
12920 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12921 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12922 !! test
12923 Image with multiple attributes from the same template
12924 !! wikitext
12925 [[File:Foobar.jpg|{{image_attribs}}]]
12926 !! html/php
12927 <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>
12928
12929 !! html/parsoid
12930 <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>
12931 !! end
12932
12933 !! test
12934 Image with link tails
12935 !! options
12936 thumbsize=220
12937 !! wikitext
12938 123[[File:Foobar.jpg]]456
12939 123[[File:Foobar.jpg|right]]456
12940 123[[File:Foobar.jpg|thumb]]456
12941 !! html/php
12942 <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
12943 </p>
12944 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
12945 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
12946
12947 !! html/php+tidy
12948 <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>
12949 <p>123</p>
12950 <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>
12951 <p>456 123</p>
12952 <div class="thumb tright">
12953 <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>
12954 <div class="thumbcaption">
12955 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12956 </div>
12957 </div>
12958 </div>
12959 <p>456</p>
12960 !! html/parsoid
12961 <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>
12962 <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>
12963 <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>
12964 !! end
12965
12966 !! test
12967 Image with multiple captions -- only last one is accepted
12968 !! wikitext
12969 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12970 !! html/php
12971 <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>
12972
12973 !! html/parsoid
12974 <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>
12975 !! end
12976
12977 !! test
12978 Image with multiple widths -- use last
12979 !! wikitext
12980 [[File:Foobar.jpg|200px|300px|caption]]
12981 !! html/php
12982 <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>
12983 </p>
12984 !! html/parsoid
12985 <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>
12986 !! end
12987
12988 !! test
12989 Image with multiple alignments -- use first (bug 48664)
12990 !! options
12991 thumbsize=220
12992 !! wikitext
12993 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12994
12995 [[File:Foobar.jpg|middle|text-top|caption]]
12996 !! html/php
12997 <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>
12998 <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>
12999 </p>
13000 !! html/parsoid
13001 <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>
13002 <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>
13003 !! end
13004
13005 !! test
13006 Image with width attribute at different positions
13007 !! wikitext
13008 [[File:Foobar.jpg|200px|right|Caption]]
13009 [[File:Foobar.jpg|right|200px|Caption]]
13010 [[File:Foobar.jpg|right|Caption|200px]]
13011 !! html/php
13012 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
13013 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
13014 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
13015
13016 !! html/parsoid
13017 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13018 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13019 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13020 !! end
13021
13022 # a sad bit of backward-compatibility
13023 !! test
13024 Image with size specified with pxpx (bug 13500, 51628)
13025 !! options
13026 parsoid=wt2html,wt2wt,html2html
13027 !! wikitext
13028 [[File:Foobar.jpg|20pxpx]]
13029 [[File:Foobar.jpg|200x20pxpx]]
13030 !! html/php
13031 <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>
13032 <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>
13033 </p>
13034 !! html/parsoid
13035 <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>
13036 !! end
13037
13038 !! test
13039 Image with link parameter, wiki target
13040 !! wikitext
13041 [[File:Foobar.jpg|link=Main Page]]
13042 !! html/php
13043 <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>
13044 </p>
13045 !! html/parsoid
13046 <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>
13047 !! end
13048
13049 # parsoid bug 49293 (part 1)
13050 !! test
13051 Image with link parameter, URL target
13052 !! wikitext
13053 [[File:Foobar.jpg|link=http://example.com/]]
13054 !! html/php
13055 <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>
13056 </p>
13057 !! html/parsoid
13058 <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>
13059 !! end
13060
13061 # parsoid bug 49293 (part 2)
13062 !! test
13063 Image with link parameter, protocol-less URL target
13064 !! wikitext
13065 [[File:Foobar.jpg|link=//example.com/]]
13066 !! html/php
13067 <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>
13068 </p>
13069 !! html/parsoid
13070 <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>
13071 !! end
13072
13073 !! test
13074 Escaping non-block captions (T107435)
13075 !! options
13076 parsoid={
13077 "modes": ["wt2wt"],
13078 "changes": [
13079 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13080 ]
13081 }
13082 !! wikitext
13083 [[Image:Foobar.jpg|caption]]
13084 !! wikitext/edited
13085 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13086 !! end
13087
13088 # wgExternalLinkTarget not supported by Parsoid
13089 !! test
13090 Image with link parameter, wgExternalLinkTarget
13091 !! wikitext
13092 [[Image:foobar.jpg|link=http://example.com/]]
13093 !! config
13094 wgExternalLinkTarget='foobar'
13095 !! html/php
13096 <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>
13097 </p>
13098 !! end
13099
13100 !! test
13101 Image with link parameter, wgNoFollowLinks set to false
13102 !! wikitext
13103 [[Image:foobar.jpg|link=http://example.com/]]
13104 !! config
13105 wgNoFollowLinks=false
13106 !! html
13107 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13108 </p>
13109 !! end
13110
13111 !! test
13112 Image with link parameter, wgNoFollowDomainExceptions
13113 !! wikitext
13114 [[Image:foobar.jpg|link=http://example.com/]]
13115 !! config
13116 wgNoFollowDomainExceptions='example.com'
13117 !! html
13118 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13119 </p>
13120 !! end
13121
13122 # wgExternalLinkTarget not supported by Parsoid
13123 !! test
13124 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13125 !! wikitext
13126 [[Image:foobar.jpg|link=http://example.com/|Title]]
13127 !! config
13128 wgExternalLinkTarget='foobar'
13129 !! html/php
13130 <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>
13131 </p>
13132 !! end
13133
13134 !! test
13135 Image with empty link parameter
13136 !! wikitext
13137 [[File:Foobar.jpg|link=]]
13138 !! html/php
13139 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13140 </p>
13141 !! html/parsoid
13142 <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>
13143 !! end
13144
13145 !! test
13146 Image with link parameter (wiki target) and unnamed parameter
13147 !! wikitext
13148 [[File:Foobar.jpg|link=Main_Page|Title]]
13149 !! html/php
13150 <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>
13151 </p>
13152 !! html/parsoid
13153 <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>
13154 !! end
13155
13156 !! test
13157 Image with link parameter (URL target) and unnamed parameter
13158 !! wikitext
13159 [[File:Foobar.jpg|link=http://example.com/|Title]]
13160 !! html/php
13161 <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>
13162 </p>
13163 !! html/parsoid
13164 <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>
13165 !! end
13166
13167 !! test
13168 Thumbnail image with link parameter
13169 !! options
13170 thumbsize=220
13171 parsoid=wt2html,wt2wt,html2html
13172 !! wikitext
13173 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13174 !! html/php
13175 <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>
13176
13177 !! html/parsoid
13178 <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>
13179 !! end
13180
13181 !! test
13182 Manually-specified thumbnail image
13183 !! options
13184 thumbsize=220
13185 !! wikitext
13186 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13187 !! html/php
13188 <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>
13189
13190 !! html/parsoid
13191 <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>
13192 !! end
13193
13194 !! test
13195 Manually-specified thumbnail image with explicit link to wiki page
13196 !! options
13197 thumbsize=220
13198 parsoid=wt2html,wt2wt,html2html
13199 !! wikitext
13200 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13201 !! html/php
13202 <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>
13203
13204 !! html/parsoid
13205 <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>
13206 !! end
13207
13208 !! test
13209 Manually-specified thumbnail image with explicit link to url
13210 !! options
13211 thumbsize=220
13212 parsoid=wt2html,wt2wt,html2html
13213 !! wikitext
13214 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13215 !! html/php
13216 <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>
13217
13218 !! html/parsoid
13219 <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>
13220 !! end
13221
13222 !! test
13223 Manually-specified thumbnail image with explicit no link
13224 !! options
13225 thumbsize=220
13226 parsoid=wt2html,wt2wt,html2html
13227 !! wikitext
13228 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13229 !! html/php
13230 <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>
13231
13232 !! html/parsoid
13233 <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>
13234 !! end
13235
13236 !! test
13237 Manually-specified thumbnail image with explicit link and alt text
13238 !! options
13239 thumbsize=220
13240 parsoid=wt2html,wt2wt,html2html
13241 !! wikitext
13242 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13243 !! html/php
13244 <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>
13245
13246 !! html/parsoid
13247 <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>
13248 !! end
13249
13250 !! test
13251 Image with frame and link
13252 !! options
13253 parsoid=wt2html,wt2wt,html2html
13254 !! wikitext
13255 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13256 !! html/php
13257 <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>
13258
13259 !! html/parsoid
13260 <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>
13261 !! end
13262
13263 !! test
13264 Image with frame and link and explicit alt
13265 !! options
13266 parsoid=wt2html,wt2wt,html2html
13267 !! wikitext
13268 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13269 !! html/php
13270 <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>
13271
13272 !! html/parsoid
13273 <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>
13274 !! end
13275
13276 !! test
13277 Image with wiki markup in implicit alt
13278 !! wikitext
13279 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13280
13281 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13282 !! html/php
13283 <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>
13284 </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>
13285 </p>
13286 !! html/parsoid
13287 <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>
13288 <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>
13289 !! end
13290
13291 !! test
13292 Alt image option should handle most kinds of wikitext without barfing
13293 !! wikitext
13294 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13295 !! html/php
13296 <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>
13297
13298 !! html/parsoid
13299 <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>
13300 !! end
13301
13302 ###################
13303 # Conflicting image format options.
13304 # First option specified should 'win'.
13305 # All three cases in each test should be identical.
13306
13307 !! test
13308 Image with 'frameless' first.
13309 !! options
13310 parsoid=wt2html,wt2wt,html2html
13311 !! wikitext
13312 [[File:Foobar.jpg|frameless|caption]]
13313
13314 [[File:Foobar.jpg|frameless|frame|caption]]
13315
13316 [[File:Foobar.jpg|frameless|thumb|caption]]
13317 !! html/php
13318 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
13319 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
13320 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
13321 </p>
13322 !! html/parsoid
13323 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13324 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13325 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13326 !! end
13327
13328 !! test
13329 Image with 'frame' first.
13330 !! options
13331 parsoid=wt2html,wt2wt,html2html
13332 !! wikitext
13333 [[File:Foobar.jpg|frame|caption]]
13334 [[File:Foobar.jpg|frame|frameless|caption]]
13335 [[File:Foobar.jpg|frame|thumb|caption]]
13336 !! html/php
13337 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
13338 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
13339 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
13340
13341 !! html/parsoid
13342 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13343 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13344 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13345 !! end
13346
13347 !! test
13348 Image with 'thumb' first.
13349 !! options
13350 parsoid=wt2html,wt2wt,html2html
13351 !! wikitext
13352 [[File:Foobar.jpg|thumb|caption]]
13353 [[File:Foobar.jpg|thumb|frameless|caption]]
13354 [[File:Foobar.jpg|thumb|frame|caption]]
13355 !! html/php
13356 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13357 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13358 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13359
13360 !! html/parsoid
13361 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13362 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13363 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13364 !! end
13365
13366 ###################
13367 # Image sizing.
13368 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13369 # and https://phabricator.wikimedia.org/T64258
13370 # Foobar has actual size of 1941x220
13371 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13372 # a scalable format.
13373 # 2. Framed images always ignore size options; always render at default size.
13374 # 3. "Unspecified format" and border are the only types which can be
13375 # enlarged.
13376
13377 !! test
13378 Image: "unspecified format" and border enlarge
13379 !! options
13380 parsoid=wt2html,wt2wt,html2html
13381 !! wikitext
13382 [[File:Foobar.jpg|2000px]]
13383
13384 [[File:Foobar.jpg|border|2000px]]
13385 !! html/php
13386 <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>
13387 </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>
13388 </p>
13389 !! html/parsoid
13390 <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>
13391 <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>
13392 !! end
13393
13394 !! test
13395 Image: "unspecified format" and border reduce
13396 !! options
13397 parsoid=wt2html,wt2wt,html2html
13398 !! wikitext
13399 [[File:Foobar.jpg|1000px]]
13400
13401 [[File:Foobar.jpg|border|1000px]]
13402 !! html/php
13403 <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>
13404 </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>
13405 </p>
13406 !! html/parsoid
13407 <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>
13408 <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>
13409 !! end
13410
13411 !! test
13412 Image: thumbs reduce
13413 !! options
13414 parsoid=wt2html,wt2wt,html2html
13415 !! wikitext
13416 [[File:Foobar.jpg|thumb|50px]]
13417 !! html/php
13418 <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>
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/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
13422 !! end
13423
13424 !! test
13425 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13426 !! options
13427 parsoid=wt2html,wt2wt,html2html
13428 !! wikitext
13429 [[File:Foobar.jpg|thumb|2000px]]
13430
13431 [[File:Foobar.svg|thumb|2000px]]
13432 !! html/php
13433 <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>
13434 <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>
13435
13436 !! html/parsoid
13437 <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>
13438 <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>
13439 !! end
13440
13441 !! test
13442 Image: frameless can reduce in size
13443 !! options
13444 parsoid=wt2html,wt2wt,html2html
13445 !! wikitext
13446 [[File:Foobar.jpg|frameless|50px]]
13447 !! html/php
13448 <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>
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/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13452 !! end
13453
13454 !! test
13455 Image: bitmap frameless can't be enlarged past original size, but vector can
13456 !! options
13457 parsoid=wt2html,wt2wt,html2html
13458 !! wikitext
13459 [[File:Foobar.jpg|frameless|2000px]]
13460
13461 [[File:Foobar.svg|frameless|2000px]]
13462 !! html/php
13463 <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>
13464 </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>
13465 </p>
13466 !! html/parsoid
13467 <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>
13468 <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>
13469 !! end
13470
13471 !! test
13472 Image: framed images are always unscaled.
13473 !! options
13474 parsoid=wt2html,wt2wt,html2html
13475 !! wikitext
13476 [[File:Foobar.jpg|frame]]
13477
13478 [[File:Foobar.jpg|frame|50px]]
13479
13480 [[File:Foobar.jpg|frame|50x50px]]
13481
13482 [[File:Foobar.jpg|frame|2000px]]
13483 !! html/php
13484 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13485 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13486 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13487 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13488
13489 !! html/parsoid
13490 <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>
13491 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13492 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13493 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13494 !! end
13495
13496 ###################
13497
13498 !! test
13499 Link to image page- image page normally doesn't exists, hence edit link
13500 Add test with existing image page
13501 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13502 !! wikitext
13503 [[:Image:test]]
13504 !! html
13505 <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>
13506 </p>
13507 !! end
13508
13509 !! test
13510 bug 18784 Link to non-existent image page with caption should use caption as link text
13511 !! wikitext
13512 [[:Image:test|caption]]
13513 !! html
13514 <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>
13515 </p>
13516 !! end
13517
13518 !! test
13519 Frameless image caption with a free URL
13520 !! wikitext
13521 [[File:Foobar.jpg|http://example.com]]
13522 !! html/php
13523 <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>
13524 </p>
13525 !! html/parsoid
13526 <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>
13527 !! end
13528
13529 !! test
13530 Thumbnail image caption with a free URL
13531 !! options
13532 thumbsize=220
13533 !! wikitext
13534 [[File:Foobar.jpg|thumb|http://example.com]]
13535 !! html/php
13536 <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>
13537
13538 !! html/parsoid
13539 <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>
13540 !! end
13541
13542 !! test
13543 Thumbnail image caption with a free URL and explicit alt
13544 !! options
13545 thumbsize=220
13546 parsoid=wt2html,wt2wt,html2html
13547 !! wikitext
13548 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13549 !! html/php
13550 <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>
13551
13552 !! html/parsoid
13553 <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>
13554 !! end
13555
13556 !! test
13557 SVG thumbnails with no language set
13558 !! options
13559 !! wikitext
13560 [[File:Foobar.svg|thumb|caption]]
13561 !! html/php
13562 <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>
13563
13564 !! html/parsoid
13565 <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>
13566 !! end
13567
13568 !! test
13569 SVG thumbnails with language de
13570 !! options
13571 parsoid=wt2html,wt2wt,html2html
13572 !! wikitext
13573 [[File:Foobar.svg|thumb|caption|lang=de]]
13574 !! html/php
13575 <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>
13576
13577 !! html/parsoid
13578 <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>
13579 !! end
13580
13581 !! test
13582 SVG thumbnails with invalid language code
13583 !! options
13584 parsoid=wt2html,wt2wt,html2html
13585 !! wikitext
13586 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13587 !! html/php
13588 <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>
13589
13590 !! html/parsoid
13591 <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>
13592 !! end
13593
13594 !! test
13595 BUG 1887: A ISBN with a thumbnail
13596 !! wikitext
13597 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13598 !! html/php
13599 <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>
13600
13601 !! html/parsoid
13602 <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>
13603 !! end
13604
13605 !! test
13606 BUG 1887: A RFC with a thumbnail
13607 !! wikitext
13608 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13609 !! html/php
13610 <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>
13611
13612 !! html/parsoid
13613 <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>
13614 !! end
13615
13616 !! test
13617 BUG 1887: A mailto link with a thumbnail
13618 !! wikitext
13619 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13620 !! html/php
13621 <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>
13622
13623 !! html/parsoid
13624 <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>
13625 !! end
13626
13627 # Pending resolution to bug 368
13628 !! test
13629 BUG 648: Frameless image caption with a link
13630 !! wikitext
13631 [[File:Foobar.jpg|text with a [[link]] in it]]
13632 !! html/php
13633 <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>
13634 </p>
13635 !! html/parsoid
13636 <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>
13637 !! end
13638
13639 !! test
13640 BUG 648: Frameless image caption with a link (suffix)
13641 !! wikitext
13642 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13643 !! html/php
13644 <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>
13645 </p>
13646 !! html/parsoid
13647 <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>
13648 !! end
13649
13650 !! test
13651 BUG 648: Frameless image caption with an interwiki link
13652 !! wikitext
13653 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13654 !! html/php
13655 <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>
13656 </p>
13657 !! html/parsoid
13658 <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>
13659 !! end
13660
13661 !! test
13662 BUG 648: Frameless image caption with a piped interwiki link
13663 !! wikitext
13664 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13665 !! html/php
13666 <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>
13667 </p>
13668 !! html/parsoid
13669 <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>
13670 !! end
13671
13672 !! test
13673 T107474: Frameless image caption with <nowiki>
13674 !! wikitext
13675 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13676 !! html/parsoid
13677 <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>
13678 !! end
13679
13680 !! test
13681 Escape HTML special chars in image alt text
13682 !! wikitext
13683 [[File:Foobar.jpg|& < > "]]
13684 !! html/php
13685 <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>
13686 </p>
13687 !! html/parsoid
13688 <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>
13689 !! end
13690
13691 !! test
13692 BUG 499: Alt text should have &#1234;, not &amp;1234;
13693 !! wikitext
13694 [[File:Foobar.jpg|&#9792;]]
13695 !! html/php
13696 <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>
13697 </p>
13698 !! html/parsoid
13699 <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>
13700 !! end
13701
13702 !! test
13703 Broken image caption with link
13704 !! options
13705 parsoid=wt2html,wt2wt,html2html
13706 !! wikitext
13707 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13708 !! html/php
13709 <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.
13710 </p>
13711 !! html/parsoid
13712 <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>
13713 !! end
13714
13715 !! test
13716 Image caption containing another image
13717 !! wikitext
13718 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13719 !! html/php
13720 <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>
13721
13722 !! html/parsoid
13723 <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>
13724 !! end
13725
13726 !! test
13727 Image: caption containing a newline
13728 !! wikitext
13729 [[File:Foobar.jpg|This
13730 *is some text]]
13731 !! html/php
13732 <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>
13733 </p>
13734 !! html/parsoid
13735 <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>
13736 !!end
13737
13738 !!test
13739 Image: caption containing leading space
13740 (The leading space should not trigger nowiki escaping in wt2wt mode)
13741 !! wikitext
13742 [[File:Foobar.jpg|thumb| bar]]
13743 !! html/php
13744 <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>
13745
13746 !! html/parsoid
13747 <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>
13748 !!end
13749
13750 !! test
13751 Image: caption containing a table
13752 !! options
13753 parsoid=wt2html,wt2wt,html2html
13754 !! wikitext
13755 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13756 {|
13757 ! Foo !! Bar
13758 |-
13759 | Foo1 || Bar1
13760 |}
13761 and some more text.]]
13762 !! html/php
13763 <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>
13764
13765 !! html/parsoid
13766 <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
13767 <table>
13768 <tbody>
13769 <tr><th>Foo </th><th>Bar</th></tr>
13770 <tr>
13771 <td>Foo1 </td>
13772 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13773 !! end
13774
13775 !! test
13776 Bug 3090: External links other than http: in image captions
13777 !! wikitext
13778 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13779 !! html/php
13780 <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>
13781
13782 !! html/parsoid
13783 <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>
13784 !! end
13785
13786 !! test
13787 Custom class
13788 !! options
13789 parsoid=wt2html,wt2wt,html2html
13790 !! wikitext
13791 [[Image:foobar.jpg|a|class=b]]
13792 !! html/php
13793 <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>
13794 </p>
13795 !! html/parsoid
13796 <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>
13797 !! end
13798
13799 !! test
13800 Localized image handling (1).
13801 !! options
13802 parsoid=wt2html,wt2wt,html2html
13803 language=es
13804 !! wikitext
13805 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13806 !! html/php
13807 <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>
13808
13809 !! html/parsoid
13810 <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>
13811 !! end
13812
13813 !! test
13814 Localized image handling (2).
13815 !! options
13816 thumbsize=220
13817 parsoid=wt2html,wt2wt,html2html
13818 language=es
13819 !! wikitext
13820 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13821 !! html/php
13822 <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>
13823
13824 !! html/parsoid
13825 <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>
13826 !! end
13827
13828 !! test
13829 "border", "frameless" and "class" attributes on an image.
13830 !! options
13831 thumbsize=220
13832 parsoid=wt2html,wt2wt,html2html
13833 !! wikitext
13834 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13835 !! html/php
13836 <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>
13837 </p>
13838 !! html/parsoid
13839 <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>
13840 !! end
13841
13842 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13843 !! test
13844 Invalid image attributes (bug 62500)
13845 !! options
13846 thumbsize=220
13847 parsoid=wt2html,wt2wt,html2html
13848 !! wikitext
13849 [[File:Foobar.jpg|thumb|float|left|caption]]
13850
13851 [[File:Foobar.jpg|thumb|righ|caption]]
13852
13853 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13854 !! html/php
13855 <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>
13856 <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>
13857 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13858
13859 !! html/parsoid
13860 <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>
13861 <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>
13862 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13863 !! end
13864
13865 !! article
13866 File:Barfoo.jpg
13867 !! text
13868 #REDIRECT [[File:Barfoo.jpg]]
13869 !! endarticle
13870
13871 # FIXME: Parsoid should run this test -- but we'd need to teach the
13872 # mockAPI about the redirected Barfoo.jpg image.
13873 !! test
13874 Redirected image
13875 !! wikitext
13876 [[Image:Barfoo.jpg]]
13877 !! html/php
13878 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13879 </p>
13880 !! end
13881
13882 !! test
13883 Missing image with uploads disabled
13884 !! options
13885 wgEnableUploads=0
13886 !! wikitext
13887 [[File:Foobaz.jpg]]
13888 !! html/php
13889 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13890 </p>
13891 !! html/parsoid
13892 <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>
13893 !! end
13894
13895 # Parsoid-specific testing for images
13896 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13897 # Currently imperfect due to a flaw in the Parsoid testrunner
13898 # Work in progress
13899 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13900 # image tests.
13901
13902 !! test
13903 Parsoid-specific image handling - simple image with size and middle alignment
13904 !! wikitext
13905 [[File:Foobar.jpg|middle|50px]]
13906 !! html/parsoid
13907 <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>
13908 !! end
13909
13910 !! test
13911 Parsoid-specific image handling - simple image with size, middle alignment,
13912 non-standard namespace alias
13913 !! options
13914 parsoid=wt2wt,wt2html,html2html
13915 !! wikitext
13916 [[Image:Foobar.jpg|middle|50px]]
13917 !! html/parsoid
13918 <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>
13919 !! end
13920
13921 !! test
13922 Parsoid-specific image handling - simple image with size and middle alignment
13923 (existing content)
13924 !! wikitext
13925 [[File:Foobar.jpg|50px|middle]]
13926 !! html/parsoid
13927 <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>
13928 !! end
13929
13930 !! test
13931 Parsoid-specific image handling - simple image with size and middle alignment
13932 and non-standard namespace name
13933 !! options
13934 parsoid=wt2html,wt2wt,html2html
13935 !! wikitext
13936 [[Image:Foobar.jpg|50px|middle]]
13937 !! html/parsoid
13938 <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>
13939 !! end
13940
13941 !! test
13942 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13943 !! wikitext
13944 [[File:Foobar.jpg|500x10px|baseline|caption]]
13945 !! html/parsoid
13946 <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>
13947 !! end
13948
13949 !! test
13950 Parsoid-specific image handling - simple image with border and size spec
13951 !! wikitext
13952 [[File:Foobar.jpg|50px|border|caption]]
13953 !! html/parsoid
13954 <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>
13955 !! end
13956
13957 !! test
13958 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13959 !! wikitext
13960 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13961 !! html/parsoid
13962 <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>
13963 !! end
13964
13965 !! test
13966 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13967 (existing content)
13968 !! wikitext
13969 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13970 !! html/parsoid
13971 <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>
13972 !! end
13973
13974 !! test
13975 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13976 !! wikitext
13977 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13978 !! html/parsoid
13979 <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>
13980 !! end
13981
13982 !! test
13983 Parsoid-specific image handling - thumbnail with specific size, halign,
13984 valign, and caption (existing content)
13985 !! wikitext
13986 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13987 !! html/parsoid
13988 <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>
13989 !! end
13990
13991 !! test
13992 Parsoid-specific image handling - framed image with specific size and caption
13993 (size is ignored)
13994 !! options
13995 parsoid=wt2html,wt2wt,html2html
13996 !! wikitext
13997 [[File:Foobar.jpg|frame|500x50px|caption]]
13998 !! html/parsoid
13999 <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>
14000 !! end
14001
14002 !! test
14003 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14004 (size is ignored)
14005 !! options
14006 parsoid=wt2html,wt2wt,html2html
14007 !! wikitext
14008 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14009 !! html/parsoid
14010 <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>
14011 !! end
14012
14013 !! test
14014 Parsoid-specific image handling - frameless image with specific size, border, and caption
14015 !! wikitext
14016 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14017 !! html/parsoid
14018 <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>
14019 !! end
14020
14021 !! test
14022 Parsoid-specific image handling - simple image with a formatted caption
14023 !! wikitext
14024 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14025 !! html/parsoid
14026 <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>
14027 !! end
14028
14029 !! test
14030 Parsoid-specific image handling - caption with a template in it
14031 !! wikitext
14032 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14033 !! html/parsoid
14034 <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>
14035 !! end
14036
14037 !! test
14038 Parsoid-specific image handling - caption with unbalanced tags in it
14039 !! options
14040 parsoid=wt2html,wt2wt,html2html
14041 !! wikitext
14042 foo
14043 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14044 bar
14045 !! html/parsoid
14046 <p>foo</p>
14047 <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>
14048 <p>bar</p>
14049 !! end
14050
14051 !! test
14052 Parsoid-specific image handling - empty caption (1)
14053 !! options
14054 parsoid=wt2html,wt2wt
14055 !! wikitext
14056 [[File:Foobar.jpg|thumb|]]
14057 !! html/parsoid
14058 <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>
14059 !! end
14060
14061 # empty captions don't get serialized unless we're in the "round trip" case
14062 !! test
14063 Parsoid-specific image handling - empty caption (2)
14064 !! options
14065 parsoid=html2wt
14066 !! html/parsoid
14067 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14068 <a href="./File:Foobar.jpg">
14069 <img resource="./File:Foobar.jpg"
14070 src="//example.com/images/3/3a/Foobar.jpg"
14071 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14072 height="25" width="220"/>
14073 </a>
14074 <figcaption></figcaption>
14075 </figure>
14076 !! wikitext
14077 [[File:Foobar.jpg|thumb]]
14078 !! end
14079
14080 !! test
14081 Parsoid-specific image handling - whitespace caption
14082 !! wikitext
14083 [[File:Foobar.jpg|thumb| ]]
14084 !! html/parsoid
14085 <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>
14086 !! end
14087
14088 !! test
14089 Parsoid-specific image handling - lang option
14090 !! wikitext
14091 foo
14092 [[File:Foobar.svg|lang=de|caption]]
14093 bar
14094 !! html/parsoid
14095 <p>foo
14096 <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>
14097 bar</p>
14098 !! end
14099
14100 ## Edge case bugs in Parsoid from T93580
14101 !! test
14102 T93580: 1. Templated <ref> inside block images
14103 !! wikitext
14104 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14105
14106 <references />
14107 !! html/parsoid
14108 <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>
14109
14110 <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>
14111 !! end
14112
14113 !! test
14114 T93580: 2. <ref> inside inline images
14115 !! wikitext
14116 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14117
14118 <references />
14119 !! html/parsoid
14120 <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>
14121
14122 <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>
14123 !! end
14124
14125 !! test
14126 T93580: 3. Templated <ref> inside inline images
14127 !! wikitext
14128 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14129
14130 <references />
14131 !! html/parsoid
14132 <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>
14133
14134 <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>
14135 !! end
14136
14137 ###
14138 ### Subpages
14139 ###
14140 !! article
14141 Subpage test/subpage
14142 !! text
14143 foo
14144 !! endarticle
14145
14146 !! test
14147 Subpage link
14148 !! options
14149 subpage title=[[Subpage test]]
14150 !! wikitext
14151 [[/subpage]]
14152 !! html
14153 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14154 </p>
14155 !! end
14156
14157 !! test
14158 Subpage noslash link
14159 !! options
14160 subpage title=[[Subpage test]]
14161 !! wikitext
14162 [[/subpage/]]
14163 !! html
14164 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14165 </p>
14166 !! end
14167
14168 !! article
14169 Subpage test/1/2/subpage
14170 !! text
14171 blah
14172 !! endarticle
14173
14174 !! test
14175 Relative subpage noslash link
14176 !! options
14177 parsoid=wt2wt,wt2html,html2html
14178 subpage title=[[Subpage test/1/2/3/4]]
14179 !! wikitext
14180 [[../../subpage/]]
14181
14182 [[../../subpage]]
14183 !! html/php
14184 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14185 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14186 </p>
14187 !! html/parsoid
14188 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14189 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14190 !! end
14191
14192 !! test
14193 Parsoid: dot-slash prefixed wikilinks
14194 !! wikitext
14195 [[./foo]]
14196
14197 [[././bar]]
14198
14199 [[././baz/]]
14200 !! html/php
14201 <p>[[./foo]]
14202 </p><p>[[././bar]]
14203 </p><p>[[././baz/]]
14204 </p>
14205 !! html/parsoid
14206 <p>[[./foo]]
14207 </p><p>[[././bar]]
14208 </p><p>[[././baz/]]
14209 </p>
14210 !! end
14211
14212 !! test
14213 Render invalid page names as plain text (bug 51090)
14214 !! wikitext
14215 [[./../foo|bar]]
14216 [[foo�|bar]]
14217 [[foo/.|bar]]
14218 [[foo/..|bar]]
14219 [[foo~~~bar]]
14220 [[foo>bar]]
14221 [[foo[bar]]
14222 [[.]]
14223 [[..]]
14224 [[foo././bar]]
14225
14226 [[{{echo|./../foo}}|bar]]
14227 [[{{echo|foo/.}}|bar]]
14228 [[{{echo|foo/..}}|bar]]
14229 [[{{echo|foo~~~~bar}}]]
14230 [[{{echo|foo>bar}}]]
14231 [[{{echo|foo././bar}}]]
14232 [[{{echo|foo{bar}}]]
14233 [[{{echo|foo}bar}}]]
14234 [[{{echo|foo[bar}}]]
14235 [[{{echo|foo]bar}}]]
14236 [[{{echo|foo<bar}}]]
14237 !!html/php
14238 <p>[[./../foo|bar]]
14239 [[foo�|bar]]
14240 [[foo/.|bar]]
14241 [[foo/..|bar]]
14242 [[foo~~~bar]]
14243 [[foo&gt;bar]]
14244 [[foo[bar]]
14245 [[.]]
14246 [[..]]
14247 [[foo././bar]]
14248 </p><p>[[./../foo|bar]]
14249 [[foo/.|bar]]
14250 [[foo/..|bar]]
14251 [[foo~~~~bar]]
14252 [[foo&gt;bar]]
14253 [[foo././bar]]
14254 [[foo{bar]]
14255 [[foo}bar]]
14256 [[foo[bar]]
14257 [[foo]bar]]
14258 [[foo&lt;bar]]
14259 </p>
14260 !!html/parsoid
14261 <p>[[./../foo|bar]]
14262 [[foo�|bar]]
14263 [[foo/.|bar]]
14264 [[foo/..|bar]]
14265 [[foo~~~bar]]
14266 [[foo>bar]]
14267 [[foo[bar]]
14268 [[.]]
14269 [[..]]
14270 [[foo././bar]]</p>
14271
14272 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14273 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14274 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14275 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14276 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14277 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14278 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14279 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14280 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14281 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14282 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
14283 !!end
14284
14285 !! test
14286 Disabled subpages
14287 !! wikitext
14288 [[/subpage]]
14289 !! html
14290 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14291 </p>
14292 !! end
14293
14294 !! test
14295 BUG 561: {{/Subpage}}
14296 !! options
14297 subpage title=[[Page]]
14298 !! wikitext
14299 {{/Subpage}}
14300 !! html
14301 <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>
14302 </p>
14303 !! end
14304
14305 ###
14306 ### Categories
14307 ###
14308 !! article
14309 Category:MediaWiki User's Guide
14310 !! text
14311 blah
14312 !! endarticle
14313
14314 !! test
14315 Link to category
14316 !! wikitext
14317 [[:Category:MediaWiki User's Guide]]
14318 !! html
14319 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14320 </p>
14321 !! end
14322
14323 !! test
14324 Simple category
14325 !! options
14326 cat
14327 !! wikitext
14328 [[Category:MediaWiki User's Guide]]
14329 !! html
14330 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14331 !! end
14332
14333 !! test
14334 PAGESINCATEGORY invalid title fatal (r33546 fix)
14335 !! wikitext
14336 {{PAGESINCATEGORY:<bogus>}}
14337 !! html
14338 <p>0
14339 </p>
14340 !! end
14341
14342 !! test
14343 Category with different sort key
14344 !! options
14345 cat
14346 !! wikitext
14347 [[Category:MediaWiki User's Guide|Foo]]
14348 !! html
14349 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14350 !! end
14351
14352 !! test
14353 Category with identical sort key
14354 !! options
14355 cat
14356 !! wikitext
14357 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14358 !! html
14359 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14360 !! end
14361
14362 !! test
14363 Category with empty sort key
14364 !! options
14365 cat
14366 pst
14367 !! wikitext
14368 [[Category:MediaWiki User's Guide|]]
14369 !! html/php
14370 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14371 !! end
14372
14373 !! test
14374 Category with empty sort key and parentheses
14375 !! options
14376 cat
14377 pst
14378 !! wikitext
14379 [[Category:Foo (bar)|]]
14380 !! html/php
14381 [[Category:Foo (bar)|Foo]]
14382 !! end
14383
14384 ## We used to, but no longer wt2wt this test since the default serializer
14385 ## will normalize all categories to serialize on their own line.
14386 ## This wikitext usage is going to be fairly uncommon in production and
14387 ## selser will take care of preserving formatting in those scenarios.
14388 !! test
14389 Category with link tail
14390 !! options
14391 cat
14392 pst
14393 parsoid=wt2html
14394 !! wikitext
14395 123[[Category:Foo]]456
14396 !! html/php
14397 123[[Category:Foo]]456
14398 !! html/parsoid
14399 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14400 !! end
14401
14402 !! test
14403 Category with template
14404 !! options
14405 cat
14406 pst
14407 !! wikitext
14408 [[Category:{{echo|Foo}}]]
14409 !! html/php
14410 [[Category:{{echo|Foo}}]]
14411 !! end
14412
14413 !! test
14414 Category with template in sort key
14415 !! options
14416 cat
14417 pst
14418 !! wikitext
14419 [[Category:Foo|{{echo|Bar}}]]
14420 !! html/php
14421 [[Category:Foo|{{echo|Bar}}]]
14422 !! end
14423
14424 !! test
14425 Category with template in sort key and title
14426 !! options
14427 cat
14428 pst
14429 !! wikitext
14430 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14431 !! html/php
14432 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14433 !! end
14434
14435 ## We used to, but no longer wt2wt this test since the default serializer
14436 ## will normalize all categories to serialize on their own line.
14437 ## This wikitext usage is going to be fairly uncommon in production and
14438 ## selser will take care of preserving formatting in those scenarios.
14439 !! test
14440 Category / paragraph interactions
14441 !! options
14442 parsoid=wt2html
14443 !! wikitext
14444 Foo [[Category:Baz]] Bar
14445
14446 Foo [[Category:Baz]]
14447 Bar
14448
14449 Foo
14450 [[Category:Baz]]
14451 Bar
14452
14453 Foo
14454 [[Category:Baz]] Bar
14455
14456 Foo
14457 [[Category:Baz]]
14458 [[Category:Baz]]
14459 [[Category:Baz]]
14460 Bar
14461
14462 [[Category:Baz]]
14463 [[Category:Baz]]
14464 [[Category:Baz]]
14465
14466 [[Category:Baz]]
14467 {{echo|[[Category:Baz]]}}
14468 [[Category:Baz]]
14469 !! html/php
14470 <p>Foo Bar
14471 </p><p>Foo
14472 Bar
14473 </p><p>Foo
14474 Bar
14475 </p><p>Foo Bar
14476 </p><p>Foo
14477 Bar
14478 </p>
14479 !! html/parsoid
14480 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14481 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14482 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14483 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14484 <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>
14485 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14486 !! end
14487
14488 ## We used to, but no longer wt2wt this test since the default serializer
14489 ## will normalize all categories to serialize on their own line.
14490 ## This wikitext usage is going to be fairly uncommon in production and
14491 ## selser will take care of preserving formatting in those scenarios.
14492 ##
14493 ## The whitespace on the empty line is part of the test. Please do not delete
14494 !! test
14495 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14496 !! options
14497 parsoid=wt2html
14498 !! wikitext
14499 This
14500
14501 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14502
14503 {{echo|[[Category:Foo]] and so should this!}}
14504 !! html/php
14505 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14506 </p>
14507 !! html/parsoid
14508 <p>This
14509
14510 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14511
14512 <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>
14513 !! end
14514
14515 ## Parsoid will not try to wt2wt this while preserving newlines because
14516 ## it suppresses excess newlines within list items -- and we don't want to
14517 ## introduce a special case just for categories, which is, in reality somewhat
14518 ## odd behavior -- categories are unlikely to be used in list items like this
14519 ## in top-level pages and are only likely to show up in template-generated
14520 ## list items where this RT-ing is a non-issue.
14521 ##
14522 ## The whitespace on the empty line is part of the test. Please do not delete
14523 !! test
14524 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14525 !! options
14526 parsoid=wt2html
14527 !! wikitext
14528 * This
14529
14530 [[Category:Foo]] and this should be part of the same list item
14531 * So should this
14532
14533 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14534 !! html
14535 <ul><li>This and this should be part of the same list item</li>
14536 <li>So should this and this should be part of the same list item</li></ul>
14537 !! html/parsoid
14538 <ul>
14539 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14540 <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>
14541 </ul>
14542 !! end
14543
14544 ## Newlines and categories that follow the last item of a list
14545 ## are treated differently because this (list followed by categories)
14546 ## is an extremely common pattern on wikis.
14547 !! test
14548 3. Categories and newlines: newline suppression for last list item should RT properly
14549 !! wikitext
14550 * a
14551 * b
14552
14553 [[Category:Foo]]
14554
14555 [[Category:Bar]]
14556 [[Category:Baz]]
14557 !! html/parsoid
14558 <ul><li> a</li>
14559 <li> b</li></ul>
14560
14561 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14562
14563 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14564 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14565 !! end
14566
14567 !! test
14568 4. Categories and newlines: newline suppression for last list item should RT properly
14569 !! wikitext
14570 * a
14571 **** b
14572
14573 [[Category:Foo]]
14574 !! html/parsoid
14575 <ul><li> a
14576 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14577
14578 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14579 !! end
14580
14581 ## only wt2html for this to make sure the algo only applies to the rightmost path
14582 !! test
14583 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14584 !! options
14585 parsoid=wt2html
14586 !! wikitext
14587 * a
14588 ** b
14589 [[Category:Foo]]
14590 * c
14591 ** d
14592 [[Category:Foo]]
14593 !! html/parsoid
14594 <ul><li> a
14595 <ul><li> b
14596 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14597 <li> c
14598 <ul><li> d</li></ul></li></ul>
14599 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14600 !! end
14601
14602 ## We used to, but no longer wt2wt this test since the default serializer
14603 ## will normalize all categories to serialize on their own line.
14604 ## This wikitext usage is going to be fairly uncommon in production and
14605 ## selser will take care of preserving formatting in those scenarios.
14606 !! test
14607 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14608 !! options
14609 parsoid=wt2html
14610 !! wikitext
14611 * a [[Category:Foo]]
14612 !! html/parsoid
14613 <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>
14614 !! end
14615
14616 # This test also demonstrates because of newline+category tunneling
14617 # through the list hander, template wrapping doesn't expand to the
14618 # containing list when the list item swallows the category.
14619 !! test
14620 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14621 !! wikitext
14622 * {{echo|a
14623 [[Category:Foo]]}}
14624 !! html/parsoid
14625 <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
14626 </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>
14627 !! end
14628
14629 !! test
14630 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14631 !! wikitext
14632 * a
14633
14634 {{echo|[[Category:Foo]]
14635 [[Category:Bar]]}}
14636 [[Category:Baz]]
14637 !! html/parsoid
14638 <ul><li> a</li></ul>
14639
14640 <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">
14641 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14642 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14643 !! end
14644
14645 !! test
14646 Parsoid: Serialize link to category page with colon escape
14647 !! options
14648 parsoid
14649 !! wikitext
14650
14651 [[:Category:Foo]]
14652 [[:Category:Foo|Bar]]
14653 !! html
14654 <p>
14655 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14656 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14657 </p>
14658 !! end
14659
14660 # We used to, but no longer wt2wt this test since the default serializer
14661 # will normalize all categories to serialize on their own line.
14662 # This wikitext usage is going to be fairly uncommon in production and
14663 # selser will take care of preventing whitespace insertion if this
14664 # occurs in an article.
14665 #
14666 # html2html disabled for the same reason (whitespace insertion between
14667 # x and y).
14668 #
14669 # html2wt disabled because it localizes the "Category" namespace.
14670 !! test
14671 Link prefix/suffixes aren't applied to category links
14672 !! options
14673 parsoid=wt2html
14674 language=is
14675 !! wikitext
14676 x[[Category:Foo]]y
14677 !! html/php
14678 <p>xy
14679 </p>
14680 !! html/parsoid
14681 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14682 !! end
14683
14684 !! test
14685 Parsoid: Serialize link to file page with colon escape
14686 !! options
14687 parsoid
14688 !! wikitext
14689
14690 [[:File:Foo.png]]
14691 [[:File:Foo.png|Bar]]
14692 !! html
14693 <p>
14694 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14695 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14696 </p>
14697 !! end
14698
14699 !! test
14700 Parsoid: Serialize a genuine category link without colon escape
14701 !! options
14702 parsoid
14703 !! wikitext
14704 [[Category:Foo]]
14705 [[Category:Foo|Bar]]
14706 !! html
14707 <link rel="mw:PageProp/Category" href="./Category:Foo">
14708 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14709 !! end
14710
14711 !! test
14712 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14713 !! options
14714 parsoid=html2wt
14715 !! html/parsoid
14716 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14717 !! wikitext
14718 [[Category:Toxine bactérienne]]
14719 !! end
14720
14721 !! test
14722 Parsoid: Defaultsort
14723 !! wikitext
14724 {{DEFAULTSORT:Foo}}
14725 !! html/parsoid
14726 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14727 !! end
14728
14729 !! test
14730 Parsoid: Defaultsort (template-generated)
14731 !! wikitext
14732 {{{{echo|DEFAULTSORT}}:Foo}}
14733 !! html/parsoid
14734 <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}}]}'/>
14735 !! end
14736
14737 ###
14738 ### Inter-language links
14739 ###
14740 !! test
14741 Interlanguage links
14742 !! options
14743 ill
14744 !! wikitext
14745 [[es:Alimento]]
14746 [[fr:Nourriture]]
14747 [[zh:食品]]
14748 !! html/php
14749 es:Alimento fr:Nourriture zh:食品
14750 !! html/parsoid
14751 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14752 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14753 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14754 !! end
14755
14756 !! test
14757 Duplicate interlanguage links (bug 24502)
14758 !! options
14759 ill
14760 !! wikitext
14761 [[es:1]]
14762 [[es:2]]
14763 [[fr:1]]
14764 [[fr:2]]
14765 !! html/php
14766 es:1 fr:1
14767 !! html/parsoid
14768 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14769 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14770 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14771 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14772 !! end
14773
14774 ###
14775 ### Sections
14776 ###
14777 !! test
14778 Basic section headings
14779 !! wikitext
14780 == Headline 1 ==
14781 Some text
14782
14783 ==Headline 2==
14784 More
14785 ===Smaller headline===
14786 Blah blah
14787 !! html
14788 <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>
14789 <p>Some text
14790 </p>
14791 <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>
14792 <p>More
14793 </p>
14794 <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>
14795 <p>Blah blah
14796 </p>
14797 !! end
14798
14799 !! test
14800 Section headings with TOC
14801 !! wikitext
14802 == Headline 1 ==
14803 === Subheadline 1 ===
14804 ===== Skipping a level =====
14805 ====== Skipping a level ======
14806
14807 == Headline 2 ==
14808 Some text
14809 ===Another headline===
14810 !! html
14811 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14812 <ul>
14813 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14814 <ul>
14815 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14816 <ul>
14817 <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>
14818 <ul>
14819 <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>
14820 </ul>
14821 </li>
14822 </ul>
14823 </li>
14824 </ul>
14825 </li>
14826 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14827 <ul>
14828 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14829 </ul>
14830 </li>
14831 </ul>
14832 </div>
14833
14834 <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>
14835 <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>
14836 <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>
14837 <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>
14838 <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>
14839 <p>Some text
14840 </p>
14841 <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>
14842
14843 !! end
14844
14845 !! test
14846 TOC anchors don't collide
14847 !! wikitext
14848 __FORCETOC__
14849 == Headline 2 ==
14850 == Headline ==
14851 == Headline 2 ==
14852 == Headline ==
14853 !! html/php
14854 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14855 <ul>
14856 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14857 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14858 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14859 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14860 </ul>
14861 </div>
14862
14863 <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>
14864 <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>
14865 <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>
14866 <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>
14867
14868 !! end
14869
14870 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14871 !! test
14872 Handling of sections up to level 6 and beyond
14873 !! wikitext
14874 = Level 1 Heading=
14875 == Level 2 Heading==
14876 === Level 3 Heading===
14877 ==== Level 4 Heading====
14878 ===== Level 5 Heading=====
14879 ====== Level 6 Heading======
14880 ======= Level 7 Heading=======
14881 ======== Level 8 Heading========
14882 ========= Level 9 Heading=========
14883 ========== Level 10 Heading==========
14884 !! html
14885 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14886 <ul>
14887 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14888 <ul>
14889 <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>
14890 <ul>
14891 <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>
14892 <ul>
14893 <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>
14894 <ul>
14895 <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>
14896 <ul>
14897 <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>
14898 <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>
14899 <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>
14900 <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>
14901 <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>
14902 </ul>
14903 </li>
14904 </ul>
14905 </li>
14906 </ul>
14907 </li>
14908 </ul>
14909 </li>
14910 </ul>
14911 </li>
14912 </ul>
14913 </div>
14914
14915 <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>
14916 <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>
14917 <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>
14918 <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>
14919 <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>
14920 <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>
14921 <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>
14922 <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>
14923 <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>
14924 <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>
14925
14926 !! end
14927
14928 !! test
14929 TOC regression (T11764)
14930 !! wikitext
14931 == title 1 ==
14932 === title 1.1 ===
14933 ==== title 1.1.1 ====
14934 === title 1.2 ===
14935 == title 2 ==
14936 === title 2.1 ===
14937 !! html
14938 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14939 <ul>
14940 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14941 <ul>
14942 <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>
14943 <ul>
14944 <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>
14945 </ul>
14946 </li>
14947 <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>
14948 </ul>
14949 </li>
14950 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14951 <ul>
14952 <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>
14953 </ul>
14954 </li>
14955 </ul>
14956 </div>
14957
14958 <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>
14959 <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>
14960 <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>
14961 <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>
14962 <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>
14963 <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>
14964
14965 !! end
14966
14967 !! test
14968 TOC for heading containing <span id="..."></span> (T96153)
14969 !! wikitext
14970 __FORCETOC__
14971 ==<span id="old-anchor"></span>New title==
14972 !! html/php
14973 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14974 <ul>
14975 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14976 </ul>
14977 </div>
14978
14979 <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>
14980
14981 !! end
14982
14983 !! test
14984 TOC with wgMaxTocLevel=3 (bug 6204)
14985 !! options
14986 wgMaxTocLevel=3
14987 !! wikitext
14988 == title 1 ==
14989 === title 1.1 ===
14990 ==== title 1.1.1 ====
14991 === title 1.2 ===
14992 == title 2 ==
14993 === title 2.1 ===
14994 !! html
14995 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14996 <ul>
14997 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14998 <ul>
14999 <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>
15000 <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>
15001 </ul>
15002 </li>
15003 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15004 <ul>
15005 <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>
15006 </ul>
15007 </li>
15008 </ul>
15009 </div>
15010
15011 <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>
15012 <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>
15013 <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>
15014 <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>
15015 <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>
15016 <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>
15017
15018 !! end
15019
15020 !! test
15021 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15022 !! options
15023 wgMaxTocLevel=3
15024 !! wikitext
15025 ==Section 1==
15026 ===Section 1.1===
15027 ====Section 1.1.1====
15028 ====Section 1.1.1.1====
15029 ==Section 2==
15030 !! html
15031 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15032 <ul>
15033 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15034 <ul>
15035 <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>
15036 </ul>
15037 </li>
15038 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15039 </ul>
15040 </div>
15041
15042 <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>
15043 <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>
15044 <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>
15045 <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>
15046 <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>
15047
15048 !! end
15049
15050
15051 !! test
15052 Resolving duplicate section names
15053 !! wikitext
15054 == Foo bar ==
15055 == Foo bar ==
15056 !! html
15057 <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>
15058 <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>
15059
15060 !! end
15061
15062 !! test
15063 Resolving duplicate section names with differing case (bug 10721)
15064 !! wikitext
15065 == Foo bar ==
15066 == Foo Bar ==
15067 !! html
15068 <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>
15069 <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>
15070
15071 !! end
15072
15073 !! article
15074 Template:sections
15075 !! text
15076 ===Section 1===
15077 ==Section 2==
15078 !! endarticle
15079
15080 !! test
15081 Template with sections, __NOTOC__
15082 !! wikitext
15083 __NOTOC__
15084 ==Section 0==
15085 {{sections}}
15086 ==Section 4==
15087 !! html
15088 <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>
15089 <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>
15090 <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>
15091 <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>
15092
15093 !! end
15094
15095 !! test
15096 __NOEDITSECTION__ keyword
15097 !! wikitext
15098 __NOEDITSECTION__
15099 ==Section 1==
15100 ==Section 2==
15101 !! html
15102 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15103 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15104
15105 !! end
15106
15107 !! test
15108 Link inside a section heading
15109 !! wikitext
15110 ==Section with a [[Main Page|link]] in it==
15111 !! html
15112 <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>
15113
15114 !! end
15115
15116 !! test
15117 TOC regression (T14077)
15118 !! wikitext
15119 __TOC__
15120 == title 1 ==
15121 === title 1.1 ===
15122 == title 2 ==
15123 !! html
15124 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15125 <ul>
15126 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15127 <ul>
15128 <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>
15129 </ul>
15130 </li>
15131 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15132 </ul>
15133 </div>
15134
15135 <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>
15136 <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>
15137 <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>
15138
15139 !! end
15140
15141 !! test
15142 BUG 1219 URL next to image (good)
15143 !! wikitext
15144 http://example.com [[File:Foobar.jpg]]
15145 !! html/php
15146 <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>
15147 </p>
15148 !! html/parsoid
15149 <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>
15150 !!end
15151
15152 !! test
15153 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15154 !! wikitext
15155 ===
15156 The line above must have a trailing space!
15157 === <!--
15158 --> <!-- -->
15159 But just in case it doesn't...
15160 !! html
15161 <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>
15162 <p>The line above must have a trailing space!
15163 </p>
15164 <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>
15165 <p>But just in case it doesn't...
15166 </p>
15167 !! end
15168
15169 !! test
15170 Header with special characters (bug 25462)
15171 !! wikitext
15172 The tooltips shall not show entities to the user (ie. be double escaped)
15173
15174 == text > text ==
15175 section 1
15176
15177 == text < text ==
15178 section 2
15179
15180 == text & text ==
15181 section 3
15182
15183 == text ' text ==
15184 section 4
15185
15186 == text " text ==
15187 section 5
15188 !! html
15189 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15190 </p>
15191 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15192 <ul>
15193 <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>
15194 <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>
15195 <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>
15196 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15197 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15198 </ul>
15199 </div>
15200
15201 <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>
15202 <p>section 1
15203 </p>
15204 <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>
15205 <p>section 2
15206 </p>
15207 <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>
15208 <p>section 3
15209 </p>
15210 <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>
15211 <p>section 4
15212 </p>
15213 <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>
15214 <p>section 5
15215 </p>
15216 !! end
15217
15218 !! test
15219 Header with space, plus and underscore as entity
15220 !! wikitext
15221 Id should not contain + for spaces
15222
15223 == Space between Text ==
15224 section 1
15225
15226 == Space-Entity&#32;between&#32;Text ==
15227 section 2
15228
15229 == Plus+between+Text ==
15230 section 3
15231
15232 == Plus-Entity&#43;between&#43;Text ==
15233 section 4
15234
15235 == Underscore_between_Text ==
15236 section 5
15237
15238 == Underscore-Entity&#95;between&#95;Text ==
15239 section 6
15240
15241 [[#Space between Text]]
15242 [[#Space-Entity&#32;between&#32;Text]]
15243 [[#Plus+between+Text]]
15244 [[#Plus-Entity&#43;between&#43;Text]]
15245 [[#Underscore_between_Text]]
15246 [[#Underscore-Entity&#95;between&#95;Text]]
15247 !! html
15248 <p>Id should not contain + for spaces
15249 </p>
15250 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15251 <ul>
15252 <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>
15253 <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>
15254 <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>
15255 <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>
15256 <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>
15257 <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>
15258 </ul>
15259 </div>
15260
15261 <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>
15262 <p>section 1
15263 </p>
15264 <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>
15265 <p>section 2
15266 </p>
15267 <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>
15268 <p>section 3
15269 </p>
15270 <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>
15271 <p>section 4
15272 </p>
15273 <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>
15274 <p>section 5
15275 </p>
15276 <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>
15277 <p>section 6
15278 </p><p><a href="#Space_between_Text">#Space between Text</a>
15279 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15280 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15281 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15282 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15283 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15284 </p>
15285 !! end
15286
15287 !! test
15288 Headers with excess '=' characters
15289 (Are similar tests necessary beyond the 1st level?)
15290 !! wikitext
15291 =foo==
15292 ==foo=
15293 =''italic'' heading==
15294 ==''italic'' heading=
15295 !! html
15296 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15297 <ul>
15298 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15299 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15300 <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>
15301 <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>
15302 </ul>
15303 </div>
15304
15305 <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>
15306 <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>
15307 <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>
15308 <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>
15309
15310 !! end
15311
15312 !! test
15313 HTML headers vs TOC (bug 23393)
15314 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15315 !! wikitext
15316 <h1>Header 1</h1>
15317 == Header 1.1 ==
15318 == Header 1.2 ==
15319
15320 <h1>Header 2
15321 </h1>
15322 == Header 2.1 ==
15323 == Header 2.2 ==
15324 __NOEDITSECTION__
15325 !! html
15326 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15327 <ul>
15328 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15329 <ul>
15330 <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>
15331 <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>
15332 </ul>
15333 </li>
15334 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15335 <ul>
15336 <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>
15337 <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>
15338 </ul>
15339 </li>
15340 </ul>
15341 </div>
15342
15343 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15344 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15345 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15346 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15347 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15348 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15349
15350 !! end
15351
15352 !! test
15353 Single-line or multiline-comments can follow headings
15354 !! options
15355 parsoid=wt2html,wt2wt
15356 !! wikitext
15357 ==foo==<!---->
15358 ==bar==<!--c1-->
15359 ==baz==<!--
15360 c2
15361 c3-->
15362 !! html
15363 <h2><span class="mw-headline" id="foo">foo</span></h2>
15364 <h2><span class="mw-headline" id="bar">bar</span></h2>
15365 <h2><span class="mw-headline" id="baz">baz</span></h2>
15366
15367 !! end
15368
15369 !! test
15370 BUG 1219 URL next to image (broken)
15371 !! wikitext
15372 http://example.com[[File:Foobar.jpg]]
15373 !! html/php
15374 <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>
15375 </p>
15376 !! html/parsoid
15377 <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>
15378 !!end
15379
15380 !! test
15381 Bug 1186 news: in the middle of text
15382 !! wikitext
15383 http://en.wikinews.org/wiki/Wikinews:Workplace
15384 !! html
15385 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15386 </p>
15387 !!end
15388
15389
15390 !! test
15391 Namespaced link must have a title
15392 !! wikitext
15393 [[Project:]]
15394 !! html
15395 <p>[[Project:]]
15396 </p>
15397 !!end
15398
15399 !! test
15400 Namespaced link must have a title (bad fragment version)
15401 !! wikitext
15402 [[Project:#fragment]]
15403 !! html
15404 <p>[[Project:#fragment]]
15405 </p>
15406 !!end
15407
15408
15409 ###
15410 ### HTML tags and HTML attributes
15411 ###
15412
15413 !! test
15414 div with no attributes
15415 !! wikitext
15416 <div>HTML rocks</div>
15417 !! html
15418 <div>HTML rocks</div>
15419
15420 !! end
15421
15422 !! test
15423 div with double-quoted attribute
15424 !! wikitext
15425 <div id="rock">HTML rocks</div>
15426 !! html
15427 <div id="rock">HTML rocks</div>
15428
15429 !! end
15430
15431 !! test
15432 div with single-quoted attribute
15433 !! wikitext
15434 <div id='rock'>HTML rocks</div>
15435 !! html
15436 <div id="rock">HTML rocks</div>
15437
15438 !! end
15439
15440 !! test
15441 div with unquoted attribute
15442 !! wikitext
15443 <div id=rock>HTML rocks</div>
15444 !! html
15445 <div id="rock">HTML rocks</div>
15446
15447 !! end
15448
15449 !! test
15450 div with illegal double attributes
15451 !! wikitext
15452 <div id="a" id="b">HTML rocks</div>
15453 !! html
15454 <div id="b">HTML rocks</div>
15455
15456 !!end
15457
15458 !! test
15459 div with empty attribute value, space before equals
15460 !! wikitext
15461 <div class =>HTML rocks</div>
15462 !! html
15463 <div class="">HTML rocks</div>
15464
15465 !! end
15466
15467 # FIXME: Parsoid doesn't match the html5 spec
15468 !! test
15469 div with multiple empty attribute values
15470 !! options
15471 parsoid=wt2html,html2html
15472 !! wikitext
15473 <div id= title=>HTML rocks</div>
15474 !! html/php
15475 <div id="title.3D">HTML rocks</div>
15476
15477 !! html/parsoid
15478 <div id="" title="">HTML rocks</div>
15479 !! end
15480
15481 # FIXME: Parsoid doesn't match the html5 spec
15482 !! test
15483 table with multiple empty attribute values
15484 !! options
15485 parsoid=wt2html,html2html
15486 !! wikitext
15487 {| title= id=
15488 | hi
15489 |}
15490 !! html/php
15491 <table title="id=">
15492 <tr>
15493 <td> hi
15494 </td></tr></table>
15495
15496 !! html/parsoid
15497 <table title="" id="">
15498 <tbody><tr><td> hi</td></tr>
15499 </tbody></table>
15500 !! end
15501
15502 !! test
15503 div with braces in attribute value
15504 !! wikitext
15505 <div title="{}">Foo</div>
15506 !! html/php
15507 <div title="&#123;}">Foo</div>
15508
15509 !! html/parsoid
15510 <div title="{}">Foo</div>
15511 !! end
15512
15513 !! test
15514 div with empty attribute value, no space before equals
15515 !! options
15516 parsoid=wt2html,html2html
15517 !! wikitext
15518 <div class=>HTML rocks</div>
15519 !! html/php
15520 <div class="">HTML rocks</div>
15521
15522 !! html/parsoid
15523 <div class="">HTML rocks</div>
15524 !! end
15525
15526 !! test
15527 HTML multiple attributes correction
15528 !! wikitext
15529 <p class="error" class="awesome">Awesome!</p>
15530 !! html
15531 <p class="awesome">Awesome!</p>
15532
15533 !!end
15534
15535 !! test
15536 Table multiple attributes correction
15537 !! wikitext
15538 {|
15539 !+ class="error" class="awesome"| status
15540 |}
15541 !! html
15542 <table>
15543 <tr>
15544 <th class="awesome"> status
15545 </th></tr></table>
15546
15547 !!end
15548
15549 !! test
15550 DIV IN UPPERCASE
15551 !! wikitext
15552 <DIV ID="x">HTML ROCKS</DIV>
15553 !! html
15554 <div id="x">HTML ROCKS</div>
15555
15556 !!end
15557
15558 !! test
15559 Non-ASCII pseudo-tags are rendered as text
15560 !! wikitext
15561 <khyô>
15562 !! html
15563 <p>&lt;khyô&gt;
15564 </p>
15565 !! end
15566
15567 !! test
15568 Pseudo-tag with URL 'name' renders as url link
15569 !! wikitext
15570 <http://example.com/>
15571 !! html
15572 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15573 </p>
15574 !! end
15575
15576 !! test
15577 text with amp in the middle of nowhere
15578 !! wikitext
15579 Remember AT&T?
15580 !! html
15581 <p>Remember AT&amp;T?
15582 </p>
15583 !! end
15584
15585 !! test
15586 text with character entity: eacute
15587 !! wikitext
15588 I always thought &eacute; was a cute letter.
15589 !! html
15590 <p>I always thought &#233; was a cute letter.
15591 </p>
15592 !! html+tidy
15593 <p>I always thought é was a cute letter.</p>
15594 !! end
15595
15596 !! test
15597 text with entity-escaped character entity-like string: eacute
15598 !! wikitext
15599 I always thought &amp;eacute; was a cute letter.
15600 !! html
15601 <p>I always thought &amp;eacute; was a cute letter.
15602 </p>
15603 !! end
15604
15605 !! test
15606 text with undefined character entity: xacute
15607 !! wikitext
15608 I always thought &xacute; was a cute letter.
15609 !! html
15610 <p>I always thought &amp;xacute; was a cute letter.
15611 </p>
15612 !! end
15613
15614 !! test
15615 HTML5 tags
15616 !! wikitext
15617 <data value="5">five</data>
15618 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15619 <mark>This highlighted text</mark>
15620 !! html
15621 <p><data value="5">five</data>
15622 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15623 <mark>This highlighted text</mark>
15624 </p>
15625 !! end
15626
15627 !! test
15628 HTML tag with leading space is parsed as text
15629 !! wikitext
15630 < div>foo< /div>
15631 !! html
15632 <p>&lt; div&gt;foo&lt; /div&gt;
15633 </p>
15634 !! end
15635
15636 ###
15637 ### Nesting tests (see bug 41545, 50604, 51081)
15638 ###
15639
15640 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15641 # Note that html2wt is considerably more difficult if we use <b> in
15642 # the test case, instead of <big>
15643 !! test
15644 Ensure that HTML adoption agency algorithm is properly implemented.
15645 !! wikitext
15646 <big>X<big>Y</big>Z</big>
15647 !! html
15648 <p><big>X<big>Y</big>Z</big>
15649 </p>
15650 !! end
15651
15652 # This was bug 41545 in the PHP parser.
15653 # Note that tidy doesn't handle this correctly.
15654 !! test
15655 Nesting of <kbd>
15656 !! wikitext
15657 <kbd>X<kbd>Y</kbd>Z</kbd>
15658 !! html
15659 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15660 </p>
15661 !! end
15662
15663 # The following cases were bug 51081 in the PHP parser.
15664 # Note that there are some other nestable tags (b, i, etc) which are
15665 # not covered; see bug 51081 for discussion.
15666
15667 # Note that tidy doesn't handle this correctly.
15668 !! test
15669 Nesting of <em>
15670 !! wikitext
15671 <em>X<em>Y</em>Z</em>
15672 !! html
15673 <p><em>X<em>Y</em>Z</em>
15674 </p>
15675 !! end
15676
15677 # Note that tidy doesn't handle this correctly.
15678 !! test
15679 Nesting of <strong>
15680 !! wikitext
15681 <strong>X<strong>Y</strong>Z</strong>
15682 !! html
15683 <p><strong>X<strong>Y</strong>Z</strong>
15684 </p>
15685 !! end
15686
15687 !! test
15688 Nesting of <q>
15689 !! wikitext
15690 <q>X<q>Y</q>Z</q>
15691 !! html+tidy
15692 <p><q>X<q>Y</q>Z</q></p>
15693 !! end
15694
15695 # Note that tidy doesn't handle this correctly.
15696 !! test
15697 Nesting of <ruby>
15698 !! wikitext
15699 <ruby>X<ruby>Y</ruby>Z</ruby>
15700 !! html
15701 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15702 </p>
15703 !! end
15704
15705 # Note that tidy doesn't handle this correctly.
15706 !! test
15707 Nesting of <bdo>
15708 !! wikitext
15709 <bdo>X<bdo>Y</bdo>Z</bdo>
15710 !! html
15711 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15712 </p>
15713 !! end
15714
15715
15716 ###
15717 ### Media links
15718 ###
15719
15720 !! test
15721 Media link
15722 !! wikitext
15723 [[Media:Foobar.jpg]]
15724 !! html
15725 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15726 </p>
15727 !! end
15728
15729 !! test
15730 Media link with text
15731 !! wikitext
15732 [[Media:Foobar.jpg|A neat file to look at]]
15733 !! html
15734 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15735 </p>
15736 !! end
15737
15738 # FIXME: this is still bad HTML tag nesting
15739 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15740 !! test
15741 Media link with nasty text
15742 !! wikitext
15743 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15744 !! html
15745 <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>
15746
15747 !! html+tidy
15748 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15749 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15750 !! end
15751
15752 !! test
15753 Media link to nonexistent file (bug 1702)
15754 !! wikitext
15755 [[Media:No such.jpg]]
15756 !! html
15757 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15758 </p>
15759 !! end
15760
15761 !! test
15762 Image link to nonexistent file (bug 1850 - good)
15763 !! wikitext
15764 [[File:No_such.jpg]]
15765 !! html/php
15766 <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>
15767 </p>
15768 !! html/parsoid
15769 <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>
15770 !! end
15771
15772 !! test
15773 :Image link to nonexistent file (bug 1850 - bad)
15774 !! wikitext
15775 [[:Image:No such.jpg]]
15776 !! html/php
15777 <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>
15778 </p>
15779 !! html/parsoid
15780 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15781 !! end
15782
15783
15784
15785 !! test
15786 Character reference normalization in link text (bug 1938)
15787 !! wikitext
15788 [[Main Page|this&that]]
15789 !! html
15790 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15791 </p>
15792 !!end
15793
15794 !! article
15795 אַ
15796 !! text
15797 Test for unicode normalization
15798
15799 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15800 !! endarticle
15801
15802 !! test
15803 (bug 19451) Links should refer to the normalized form.
15804 !! wikitext
15805 [[&#xFB2E;]]
15806 [[&#x5d0;&#x5b7;]]
15807 [[&#x5d0;ַ]]
15808 [[א&#x5b7;]]
15809 [[אַ]]
15810 !! html
15811 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15812 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15813 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15814 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15815 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15816 </p>
15817 !! end
15818
15819 !! test
15820 Empty attribute crash test (bug 2067)
15821 !! wikitext
15822 <font color="">foo</font>
15823 !! html
15824 <p><font color="">foo</font>
15825 </p>
15826 !! end
15827
15828 !! test
15829 Empty attribute crash test single-quotes (bug 2067)
15830 !! wikitext
15831 <font color=''>foo</font>
15832 !! html
15833 <p><font color="">foo</font>
15834 </p>
15835 !! end
15836
15837 !! test
15838 Attribute test: equals, then nothing
15839 !! wikitext
15840 <font color=>foo</font>
15841 !! html
15842 <p><font color="">foo</font>
15843 </p>
15844 !! end
15845
15846 !! test
15847 Attribute test: unquoted value
15848 !! wikitext
15849 <font color=x>foo</font>
15850 !! html
15851 <p><font color="x">foo</font>
15852 </p>
15853 !! end
15854
15855 !! test
15856 Attribute test: unquoted but illegal value (hash)
15857 !! wikitext
15858 <font color=#x>foo</font>
15859 !! html
15860 <p><font color="#x">foo</font>
15861 </p>
15862 !! end
15863
15864 # Parsoid does not serialize to empty attribute syntax,
15865 # so wt2wt and html2wt cases are skipped
15866 !! test
15867 Attribute test: no value (T54330)
15868 !! options
15869 parsoid=wt2html,html2html
15870 !! wikitext
15871 <font color>foo</font>
15872 !! html/php
15873 <p><font color="">foo</font>
15874 </p>
15875 !! html/parsoid
15876 <p><font color="">foo</font></p>
15877 !! end
15878
15879 !! test
15880 Bug 2095: link with three closing brackets
15881 !! wikitext
15882 [[Main Page]]]
15883 !! html/php
15884 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15885 </p>
15886 !! html/parsoid
15887 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15888 !! end
15889
15890 !! test
15891 Bug 2095: link with pipe and three closing brackets
15892 !! wikitext
15893 [[Main Page|link]]]
15894 !! html/php
15895 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15896 </p>
15897 !! html/parsoid
15898 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15899 !! end
15900
15901 !! test
15902 Bug 2095: link with pipe and three closing brackets, version 2
15903 !! wikitext
15904 [[Main Page|[http://example.com/]]]
15905 !! html/php
15906 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15907 </p>
15908 !! html/parsoid
15909 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15910 !! end
15911
15912
15913 ###
15914 ### Safety
15915 ###
15916
15917 !! article
15918 Template:Dangerous attribute
15919 !! text
15920 " onmouseover="alert(document.cookie)
15921 !! endarticle
15922
15923 !! article
15924 Template:Dangerous style attribute
15925 !! text
15926 border-size: expression(alert(document.cookie))
15927 !! endarticle
15928
15929 !! article
15930 Template:Div style
15931 !! text
15932 <div style="float: right; {{{1}}}">Magic div</div>
15933 !! endarticle
15934
15935 !! test
15936 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15937 !! wikitext
15938 <div title="{{test}}"></div>
15939 !! html
15940 <div title="This is a test template"></div>
15941
15942 !! end
15943
15944 # Parsoid has enough context to handle this case
15945 !! test
15946 Bug 2304: HTML attribute safety (dangerous template; 2309)
15947 !! wikitext
15948 <div title="{{dangerous attribute}}"></div>
15949 !! html/php
15950 <div title=""></div>
15951
15952 !! html/parsoid
15953 <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>
15954 !! end
15955
15956 !! test
15957 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15958 !! wikitext
15959 <div style="{{dangerous style attribute}}"></div>
15960 !! html
15961 <div style="/* insecure input */"></div>
15962
15963 !! end
15964
15965 !! test
15966 Bug 2304: HTML attribute safety (safe parameter; 2309)
15967 !! wikitext
15968 {{div style|width: 200px}}
15969 !! html
15970 <div style="float: right; width: 200px">Magic div</div>
15971
15972 !! end
15973
15974 !! test
15975 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15976 !! wikitext
15977 {{div style|width: expression(alert(document.cookie))}}
15978 !! html
15979 <div style="/* insecure input */">Magic div</div>
15980
15981 !! end
15982
15983 !! test
15984 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15985 !! wikitext
15986 {{div style|"><script>alert(document.cookie)</script>}}
15987 !! html
15988 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15989
15990 !! end
15991
15992 !! test
15993 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15994 !! wikitext
15995 {{div style|" ><script>alert(document.cookie)</script>}}
15996 !! html
15997 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15998
15999 !! end
16000
16001 !! test
16002 Bug 2304: HTML attribute safety (link)
16003 !! wikitext
16004 <div title="[[Main Page]]"></div>
16005 !! html
16006 <div title="&#91;&#91;Main Page]]"></div>
16007
16008 !! end
16009
16010 !! test
16011 Bug 2304: HTML attribute safety (italics)
16012 !! wikitext
16013 <div title="''foobar''"></div>
16014 !! html
16015 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16016
16017 !! end
16018
16019 !! test
16020 Bug 2304: HTML attribute safety (bold)
16021 !! wikitext
16022 <div title="'''foobar'''"></div>
16023 !! html
16024 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16025
16026 !! end
16027
16028
16029 !! test
16030 Bug 2304: HTML attribute safety (ISBN)
16031 !! wikitext
16032 <div title="ISBN 1234567890"></div>
16033 !! html
16034 <div title="&#73;SBN 1234567890"></div>
16035
16036 !! end
16037
16038 !! test
16039 Bug 2304: HTML attribute safety (RFC)
16040 !! wikitext
16041 <div title="RFC 1234"></div>
16042 !! html
16043 <div title="&#82;FC 1234"></div>
16044
16045 !! end
16046
16047 !! test
16048 Bug 2304: HTML attribute safety (PMID)
16049 !! wikitext
16050 <div title="PMID 1234567890"></div>
16051 !! html
16052 <div title="&#80;MID 1234567890"></div>
16053
16054 !! end
16055
16056 !! test
16057 Bug 2304: HTML attribute safety (web link)
16058 !! wikitext
16059 <div title="http://example.com/"></div>
16060 !! html
16061 <div title="http&#58;//example.com/"></div>
16062
16063 !! end
16064
16065 !! test
16066 Bug 2304: HTML attribute safety (named web link)
16067 !! wikitext
16068 <div title="[http://example.com/ link]"></div>
16069 !! html
16070 <div title="&#91;http&#58;//example.com/ link]"></div>
16071
16072 !! end
16073
16074 !! test
16075 Bug 3244: HTML attribute safety (extension; safe)
16076 !! wikitext
16077 <div style="<nowiki>background:blue</nowiki>"></div>
16078 !! html
16079 <div style="background:blue"></div>
16080
16081 !! end
16082
16083 !! test
16084 Bug 3244: HTML attribute safety (extension; unsafe)
16085 !! wikitext
16086 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16087 !! html
16088 <div style="/* insecure input */"></div>
16089
16090 !! end
16091
16092 # More MSIE fun discovered by Tom Gilder
16093
16094 !! test
16095 MSIE CSS safety test: spurious slash
16096 !! wikitext
16097 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16098 !! html
16099 <div style="/* insecure input */">evil</div>
16100
16101 !! end
16102
16103 !! test
16104 MSIE CSS safety test: hex code
16105 !! wikitext
16106 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16107 !! html
16108 <div style="/* insecure input */">evil</div>
16109
16110 !! end
16111
16112 !! test
16113 MSIE CSS safety test: comment in url
16114 !! wikitext
16115 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16116 !! html
16117 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16118
16119 !! end
16120
16121 !! test
16122 MSIE CSS safety test: comment in expression
16123 !! wikitext
16124 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16125 !! html
16126 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16127
16128 !! end
16129
16130 !! test
16131 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16132 !! wikitext
16133 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16134 !! html
16135 <p style="/* invalid control char */">A</p>
16136
16137 !! end
16138
16139 !! test
16140 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16141 !! wikitext
16142 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16143 <div style="top:EXPRESSION(alert())">B</div>
16144 !! html
16145 <p style="/* insecure input */">A</p>
16146 <div style="/* insecure input */">B</div>
16147
16148 !! end
16149
16150 !! test
16151 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16152 !! wikitext
16153 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16154 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16155 !! html
16156 <div style="/* insecure input */">A</div>
16157 <p style="/* insecure input */">B</p>
16158
16159 !! end
16160
16161 !! test
16162 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16163 !! wikitext
16164 <div style="background-image:url⁽javascript:alert())">A</div>
16165 <div style="background-image:url₍javascript:alert())">B</div>
16166 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16167 !! html
16168 <div style="/* insecure input */">A</div>
16169 <div style="/* insecure input */">B</div>
16170 <p style="/* insecure input */">C</p>
16171
16172 !! end
16173
16174 # FIXME: Parsoid fails to sanitize this! See T58846.
16175 !! test
16176 Opera -o-link CSS
16177 !! wikitext
16178 <div
16179 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;"
16180 style="-o-link:attr(title);-o-link-source:current">X</div>
16181 !! html
16182 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16183
16184 !! end
16185
16186 !! test
16187 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16188 !! wikitext
16189 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16190 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16191 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16192 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16193 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16194 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16195 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16196 !! html
16197 <p style="/* insecure input */">A</p>
16198 <p style="/* insecure input */">B</p>
16199 <p style="/* insecure input */">C</p>
16200 <p style="/* insecure input */">D</p>
16201 <p style="/* insecure input */">E</p>
16202 <p style="/* insecure input */">F</p>
16203 <p style="/* insecure input */">G</p>
16204
16205 !! end
16206
16207 !! test
16208 Table attribute legitimate extension
16209 !! wikitext
16210 {|
16211 !+ style="<nowiki>color:blue</nowiki>"| status
16212 |}
16213 !! html
16214 <table>
16215 <tr>
16216 <th style="color:blue"> status
16217 </th></tr></table>
16218
16219 !!end
16220
16221 !! test
16222 Table attribute safety
16223 !! wikitext
16224 {|
16225 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16226 |}
16227 !! html
16228 <table>
16229 <tr>
16230 <th style="/* insecure input */"> status
16231 </th></tr></table>
16232
16233 !! end
16234
16235 !! test
16236 CSS line continuation 1
16237 !! wikitext
16238 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16239 !! html
16240 <div style="/* insecure input */"></div>
16241
16242 !! end
16243
16244 !! test
16245 CSS line continuation 2
16246 !! wikitext
16247 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16248 !! html
16249 <div style="/* invalid control char */"></div>
16250
16251 !! end
16252
16253 !! article
16254 Template:Identity
16255 !! text
16256 {{{1}}}
16257 !! endarticle
16258
16259 !! test
16260 Expansion of multi-line templates in attribute values (bug 6255)
16261 !! wikitext
16262 <div style="background: {{identity|#00FF00}}">-</div>
16263 !! html
16264 <div style="background: #00FF00">-</div>
16265
16266 !! end
16267
16268
16269 !! test
16270 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16271 !! wikitext
16272 <div style="background:
16273 #00FF00">-</div>
16274 !! html/php
16275 <div style="background: #00FF00">-</div>
16276
16277 !! html/parsoid
16278 <div style="background:
16279 #00FF00">-</div>
16280 !! end
16281
16282 !! test
16283 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16284 !! wikitext
16285 <div style="background: &#10;#00FF00">-</div>
16286 !! html
16287 <div style="background: &#10;#00FF00">-</div>
16288
16289 !! end
16290
16291 !! test
16292 evil <math>-wiki-tags without Extension:Math enabled
16293 !! wikitext
16294 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16295 !! html+tidy
16296 <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>
16297 !! end
16298
16299 ###
16300 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16301 ###
16302 !! test
16303 Parser hook: empty input
16304 !! wikitext
16305 <tag></tag>
16306 !! html/php
16307 <pre>
16308 ''
16309 array (
16310 )
16311 </pre>
16312
16313 !! html/parsoid
16314 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16315 !! end
16316
16317 ## Don't expect parsoid to rt this form.
16318 !! test
16319 Parser hook: empty input using terminated empty elements
16320 !! options
16321 parsoid=wt2html,html2html
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: empty input using terminated empty elements (space before)
16337 !! wikitext
16338 <tag />
16339 !! html/php
16340 <pre>
16341 NULL
16342 array (
16343 )
16344 </pre>
16345
16346 !! html/parsoid
16347 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16348 !! end
16349
16350 !! test
16351 Parser hook: basic input
16352 !! wikitext
16353 <tag>input</tag>
16354 !! html/php
16355 <pre>
16356 'input'
16357 array (
16358 )
16359 </pre>
16360
16361 !! html/parsoid
16362 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16363 !! end
16364
16365 ## Don't expect parsoid to rt this form.
16366 !! test
16367 Parser hook: case insensitive
16368 !! options
16369 parsoid=wt2html,html2html
16370 !! wikitext
16371 <TAG>input</TAG>
16372 !! html/php
16373 <pre>
16374 'input'
16375 array (
16376 )
16377 </pre>
16378
16379 !! html/parsoid
16380 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16381 !! end
16382
16383 ## Don't expect parsoid to rt this form.
16384 !! test
16385 Parser hook: case insensitive, redux
16386 !! options
16387 parsoid=wt2html,html2html
16388 !! wikitext
16389 <TaG>input</TAg>
16390 !! html/php
16391 <pre>
16392 'input'
16393 array (
16394 )
16395 </pre>
16396
16397 !! html/parsoid
16398 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16399 !! end
16400
16401 !! test
16402 Parser hook: nested tags
16403 !! options
16404 noxml
16405 !! wikitext
16406 <tag><tag></tag></tag>
16407 !! html/php
16408 <pre>
16409 '<tag>'
16410 array (
16411 )
16412 </pre>&lt;/tag&gt;
16413
16414 !! html/parsoid
16415 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16416 !! end
16417
16418 !! test
16419 Parser hook: basic arguments
16420 !! wikitext
16421 <tag width="200" height="100" depth="50" square=""></tag>
16422 !! html/php
16423 <pre>
16424 ''
16425 array (
16426 'width' => '200',
16427 'height' => '100',
16428 'depth' => '50',
16429 'square' => '',
16430 )
16431 </pre>
16432
16433 !! html/parsoid
16434 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16435 !! end
16436
16437 ## Don't expect parsoid to rt this form.
16438 !! test
16439 Parser hook: basic arguments, variations
16440 !! options
16441 parsoid=wt2html,html2html
16442 !! wikitext
16443 <tag width=200 height = "100" depth = '50' square></tag>
16444 !! html/php
16445 <pre>
16446 ''
16447 array (
16448 'width' => '200',
16449 'height' => '100',
16450 'depth' => '50',
16451 'square' => '',
16452 )
16453 </pre>
16454
16455 !! html/parsoid
16456 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16457 !! end
16458
16459 !! test
16460 Parser hook: argument containing a forward slash (bug 5344)
16461 !! wikitext
16462 <tag filename="/tmp/bla"></tag>
16463 !! html/php
16464 <pre>
16465 ''
16466 array (
16467 'filename' => '/tmp/bla',
16468 )
16469 </pre>
16470
16471 !! html/parsoid
16472 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16473 !! end
16474
16475 ## Don't expect parsoid to rt this form.
16476 !! test
16477 Parser hook: empty input using terminated empty elements (bug 2374)
16478 !! options
16479 parsoid=wt2html,html2html
16480 !! wikitext
16481 <tag foo=bar/>text
16482 !! html/php
16483 <pre>
16484 NULL
16485 array (
16486 'foo' => 'bar',
16487 )
16488 </pre>text
16489
16490 !! html/parsoid
16491 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16492 !! end
16493
16494 # </tag> should be output literally since there is no matching tag that begins it
16495 !! test
16496 Parser hook: basic arguments using terminated empty elements (bug 2374)
16497 !! wikitext
16498 <tag width=200 height = "100" depth = '50' square/>
16499 other stuff
16500 </tag>
16501 !! html/php
16502 <pre>
16503 NULL
16504 array (
16505 'width' => '200',
16506 'height' => '100',
16507 'depth' => '50',
16508 'square' => '',
16509 )
16510 </pre>
16511 <p>other stuff
16512 &lt;/tag&gt;
16513 </p>
16514 !! end
16515
16516 ###
16517 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16518 ###
16519
16520 !! test
16521 Parser hook: static parser hook not inside a comment
16522 !! wikitext
16523 <statictag>hello, world</statictag>
16524
16525 <statictag action="flush" />
16526 !! html/php
16527 <p><br />
16528 hello, world
16529 </p>
16530 !! html/parsoid
16531 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16532 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16533 !! end
16534
16535 !! test
16536 Parser hook: static parser hook inside a comment
16537 !! wikitext
16538 <!-- <statictag>hello, world</statictag> -->
16539 <statictag action="flush" />
16540 !! html/php
16541 <p><br />
16542 </p>
16543 !! html/parsoid
16544 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16545 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16546 !! end
16547
16548 # Nested template calls; this case was broken by Parser.php rev 1.506,
16549 # since reverted.
16550
16551 !! article
16552 Template:One-parameter
16553 !! text
16554 (My parameter is: {{{1}}})
16555 !! endarticle
16556
16557 !! article
16558 Template:Map-one-parameter
16559 !! text
16560 {{{{{1}}}|{{{2}}}}}
16561 !! endarticle
16562
16563 !! test
16564 Nested template calls
16565 !! wikitext
16566 {{Map-one-parameter|One-parameter|param}}
16567 !! html
16568 <p>(My parameter is: param)
16569 </p>
16570 !! end
16571
16572
16573 ###
16574 ### Sanitizer
16575 ###
16576
16577 # HTML+Tidy effectively strips out the empty tags completely
16578 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16579 # which Tidy would have done for the PHP parser had there been content inside it.
16580 !! test
16581 Sanitizer: Closing of open tags
16582 !! wikitext
16583 <s></s><table></table>
16584 !! html
16585 <s></s><table></table>
16586
16587 !! html/parsoid
16588 <p><s></s></p><table></table>
16589 !! end
16590
16591 !! test
16592 Sanitizer: Closing of open but not closed tags
16593 !! wikitext
16594 <s>foo
16595 !! html
16596 <p><s>foo</s>
16597 </p>
16598 !! end
16599
16600 !! test
16601 Sanitizer: Closing of closed but not open tags
16602 !! options
16603 parsoid=wt2html
16604 !! wikitext
16605 </s>
16606 !! html/php+tidy
16607 !! html/parsoid
16608 !! end
16609
16610 !! test
16611 Sanitizer: Closing of closed but not open table tags
16612 !! options
16613 parsoid=wt2html
16614 !! wikitext
16615 Table not started</td></tr></table>
16616 !! html/php+tidy
16617 <p>Table not started</p>
16618 !! html/parsoid
16619 <p>Table not started</p>
16620 !! end
16621
16622 !! test
16623 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16624 !! wikitext
16625 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16626 !! html
16627 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16628 </p>
16629 !! end
16630
16631 # In HTML5, the restrictions are that id must contain at least one character,
16632 # and must not contain any space characters.
16633 !! test
16634 Sanitizer: Validating the contents of the id attribute (bug 4515)
16635 !! options
16636 disabled
16637 !! wikitext
16638 <br id="" /><br id="a space" />
16639 !! html
16640 Something ...
16641 !! end
16642
16643 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16644 !! test
16645 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16646 !! options
16647 disabled
16648 !! wikitext
16649 <br id="foo" /><br id="foo" />
16650 !! html
16651 Something need to be done. foo-2 ?
16652 !! end
16653
16654 !! test
16655 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16656 !! wikitext
16657 <div itemscope>
16658 <meta itemprop="hello" content="world">
16659 <meta http-equiv="refresh" content="5">
16660 <meta itemprop="hello" http-equiv="refresh" content="5">
16661 <link itemprop="hello" href="{{SERVER}}">
16662 <link rel="stylesheet" href="{{SERVER}}">
16663 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16664 </div>
16665 !! html
16666 <div itemscope="">
16667 <p> <meta itemprop="hello" content="world" />
16668 &lt;meta http-equiv="refresh" content="5"&gt;
16669 <meta itemprop="hello" content="5" />
16670 </p>
16671 <link itemprop="hello" href="http&#58;//example.org" />
16672 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16673 <link itemprop="hello" href="http&#58;//example.org" />
16674 </div>
16675
16676 !! end
16677
16678 !! test
16679 Language converter: output gets cut off unexpectedly (bug 5757)
16680 !! options
16681 language=zh
16682 !! wikitext
16683 this bit is safe: }-
16684
16685 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16686
16687 then we get cut off here: }-
16688
16689 all additional text is vanished
16690 !! html
16691 <p>this bit is safe: }-
16692 </p><p>but if we add a conversion instance: xxx
16693 </p><p>then we get cut off here: }-
16694 </p><p>all additional text is vanished
16695 </p>
16696 !! end
16697
16698 !! test
16699 Self closed html pairs (bug 5487)
16700 !! options
16701 !! wikitext
16702 <center><font id="bug" />Centered text</center>
16703 <div><font id="bug2" />In div text</div>
16704 !! html
16705 <center>&lt;font id="bug" /&gt;Centered text</center>
16706 <div>&lt;font id="bug2" /&gt;In div text</div>
16707
16708 !! end
16709
16710 #
16711 #
16712 #
16713
16714 !! test
16715 Punctuation: nbsp before exclamation
16716 !! wikitext
16717 C'est grave !
16718 !! html
16719 <p>C'est grave&#160;!
16720 </p>
16721 !! end
16722
16723 !! test
16724 Punctuation: CSS !important (bug 11874)
16725 !! wikitext
16726 <div style="width:50% !important">important</div>
16727 !! html
16728 <div style="width:50% !important">important</div>
16729
16730 !!end
16731
16732 !! test
16733 Punctuation: CSS ! important (bug 11874; with space after)
16734 !! wikitext
16735 <div style="width:50% ! important">important</div>
16736 !! html
16737 <div style="width:50% ! important">important</div>
16738
16739 !!end
16740
16741 !! test
16742 HTML bullet list, closed tags (bug 5497)
16743 !! wikitext
16744 <ul>
16745 <li>One</li>
16746 <li>Two</li>
16747 </ul>
16748 !! html/php
16749 <ul>
16750 <li>One</li>
16751 <li>Two</li>
16752 </ul>
16753
16754 !! html/parsoid
16755 <ul data-parsoid='{"stx":"html"}'>
16756 <li data-parsoid='{"stx":"html"}'>One</li>
16757 <li data-parsoid='{"stx":"html"}'>Two</li>
16758 </ul>
16759
16760 !! end
16761
16762 !! test
16763 HTML bullet list, unclosed tags (bug 5497)
16764 !! wikitext
16765 <ul>
16766 <li>One
16767 <li>Two
16768 </ul>
16769 !! html/php+tidy
16770 <ul>
16771 <li>One</li>
16772 <li>Two</li>
16773 </ul>
16774 !! html/parsoid
16775 <ul data-parsoid='{"stx":"html"}'>
16776 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16777 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16778 </ul>
16779
16780 !! end
16781
16782 !! test
16783 HTML ordered list, closed tags (bug 5497)
16784 !! wikitext
16785 <ol>
16786 <li>One</li>
16787 <li>Two</li>
16788 </ol>
16789 !! html/php
16790 <ol>
16791 <li>One</li>
16792 <li>Two</li>
16793 </ol>
16794
16795 !! html/parsoid
16796 <ol data-parsoid='{"stx":"html"}'>
16797 <li data-parsoid='{"stx":"html"}'>One</li>
16798 <li data-parsoid='{"stx":"html"}'>Two</li>
16799 </ol>
16800
16801 !! end
16802
16803 !! test
16804 HTML ordered list, unclosed tags (bug 5497)
16805 !! options
16806 !! wikitext
16807 <ol>
16808 <li>One
16809 <li>Two
16810 </ol>
16811 !! html/php+tidy
16812 <ol>
16813 <li>One</li>
16814 <li>Two</li>
16815 </ol>
16816 !! html/parsoid
16817 <ol data-parsoid='{"stx":"html"}'>
16818 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16819 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16820 </ol>
16821
16822 !! end
16823
16824 !! test
16825 HTML nested bullet list, closed tags (bug 5497)
16826 !! wikitext
16827 <ul>
16828 <li>One</li>
16829 <li>Two:
16830 <ul>
16831 <li>Sub-one</li>
16832 <li>Sub-two</li>
16833 </ul>
16834 </li>
16835 </ul>
16836 !! html
16837 <ul>
16838 <li>One</li>
16839 <li>Two:
16840 <ul>
16841 <li>Sub-one</li>
16842 <li>Sub-two</li>
16843 </ul>
16844 </li>
16845 </ul>
16846
16847 !! end
16848
16849 !! test
16850 HTML nested bullet list, open tags (bug 5497)
16851 !! wikitext
16852 <ul>
16853 <li>One
16854 <li>Two:
16855 <ul>
16856 <li>Sub-one
16857 <li>Sub-two
16858 </ul>
16859 </ul>
16860 !! html/php+tidy
16861 <ul>
16862 <li>One</li>
16863 <li>Two:
16864 <ul>
16865 <li>Sub-one</li>
16866 <li>Sub-two</li>
16867 </ul>
16868 </li>
16869 </ul>
16870 !! html/parsoid
16871 <ul>
16872 <li>One
16873 </li>
16874 <li>Two:
16875 <ul>
16876 <li>Sub-one
16877 </li>
16878 <li>Sub-two
16879 </li>
16880 </ul>
16881 </li>
16882 </ul>
16883
16884 !! end
16885
16886 !! test
16887 HTML nested ordered list, closed tags (bug 5497)
16888 !! wikitext
16889 <ol>
16890 <li>One</li>
16891 <li>Two:
16892 <ol>
16893 <li>Sub-one</li>
16894 <li>Sub-two</li>
16895 </ol>
16896 </li>
16897 </ol>
16898 !! html
16899 <ol>
16900 <li>One</li>
16901 <li>Two:
16902 <ol>
16903 <li>Sub-one</li>
16904 <li>Sub-two</li>
16905 </ol>
16906 </li>
16907 </ol>
16908
16909 !! end
16910
16911 !! test
16912 HTML nested ordered list, open tags (bug 5497)
16913 !! wikitext
16914 <ol>
16915 <li>One
16916 <li>Two:
16917 <ol>
16918 <li>Sub-one
16919 <li>Sub-two
16920 </ol>
16921 </ol>
16922 !! html/php
16923 <ol>
16924 <li>One
16925 <li>Two:
16926 <ol>
16927 <li>Sub-one
16928 <li>Sub-two
16929 </ol>
16930 </ol>
16931
16932 !! html/parsoid
16933 <ol>
16934 <li>One
16935 </li>
16936 <li>Two:
16937 <ol>
16938 <li>Sub-one
16939 </li>
16940 <li>Sub-two
16941 </li>
16942 </ol>
16943 </li>
16944 </ol>
16945
16946 !! end
16947
16948 !! test
16949 HTML ordered list item with parameters oddity
16950 !! wikitext
16951 <ol><li id="fragment">One</li>
16952 </ol>
16953 !! html
16954 <ol><li id="fragment">One</li>
16955 </ol>
16956
16957 !! end
16958
16959 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16960 !!test
16961 bug 5918: autonumbering
16962 !! wikitext
16963 [http://first/] [http://second] [ftp://ftp]
16964
16965 ftp://inlineftp
16966
16967 [mailto:enclosed@mail.tld With target]
16968
16969 [mailto:enclosed@mail.tld]
16970
16971 mailto:inline@mail.tld
16972 !! html/php
16973 <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>
16974 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16975 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16976 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16977 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16978 </p>
16979 !! html/parsoid
16980 <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>
16981 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16982 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16983 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16984 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16985 !! end
16986
16987
16988 #
16989 # Security and HTML correctness
16990 # From Nick Jenkins' fuzz testing
16991 #
16992
16993 !! test
16994 Fuzz testing: Parser13
16995 !! wikitext
16996 {|
16997 | http://a|
16998 !! html
16999 <table>
17000 <tr>
17001 <td>
17002 </td>
17003 </tr>
17004 </table>
17005
17006 !! end
17007
17008 !! test
17009 Fuzz testing: Parser14
17010 !! wikitext
17011 == onmouseover= ==
17012 http://__TOC__
17013 !! html
17014 <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>
17015 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17016 <ul>
17017 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17018 </ul>
17019 </div>
17020
17021
17022 !! html+tidy
17023 <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>
17024 <p>http://</p>
17025 <div id="toc" class="toc">
17026 <div id="toctitle">
17027 <h2>Contents</h2>
17028 </div>
17029 <ul>
17030 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17031 </ul>
17032 </div>
17033 <p></p>
17034 !! end
17035
17036 !! test
17037 Fuzz testing: Parser14-table
17038 !! wikitext
17039 ==a==
17040 {| STYLE=__TOC__
17041 !! html
17042 <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>
17043 <table style="&#95;_TOC&#95;_">
17044 <tr><td></td></tr>
17045 </table>
17046
17047 !! html+tidy
17048 <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>
17049 <table style="__TOC__">
17050 <tr>
17051 <td></td>
17052 </tr>
17053 </table>
17054 !! end
17055
17056 # Known to produce bogus xml (extra </td>)
17057 !! test
17058 Fuzz testing: Parser16
17059 !! options
17060 noxml
17061 !! wikitext
17062 {|
17063 !https://||||||
17064 !! html
17065 <table>
17066 <tr>
17067 <th>https://</th>
17068 <th></th>
17069 <th></th>
17070 <th>
17071 </td>
17072 </tr>
17073 </table>
17074
17075 !! html+tidy
17076 <table>
17077 <tr>
17078 <th>https://</th>
17079 <th></th>
17080 <th></th>
17081 <th></th>
17082 </tr>
17083 </table>
17084 !! end
17085
17086 !! test
17087 Fuzz testing: Parser21
17088 !! wikitext
17089 {|
17090 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17091 |
17092 !! html
17093 <table>
17094 <tr>
17095 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17096 </th>
17097 <td>
17098 </td>
17099 </tr>
17100 </table>
17101
17102 !! end
17103
17104 !! test
17105 Fuzz testing: Parser22
17106 !! wikitext
17107 http://===r:::https://b
17108
17109 {|
17110 !! html
17111 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17112 </p>
17113 <table>
17114 <tr><td></td></tr>
17115 </table>
17116
17117 !! end
17118
17119 # Known to produce bad XML for now
17120 !! test
17121 Fuzz testing: Parser24
17122 !! options
17123 noxml
17124 !! wikitext
17125 {|
17126 {{{|
17127 <u CLASS=
17128 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17129 <br style="onmouseover='alert(document.cookie);' " />
17130
17131 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17132 |
17133 !! html
17134 <table>
17135 {{{|
17136 <u class="&#124;">}}}} &gt;
17137 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17138
17139 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17140 <tr>
17141 <td></u>
17142 </td>
17143 </tr>
17144 </table>
17145
17146 !! end
17147
17148 # Note: the current result listed for this is not what the original one was,
17149 # but the original bug was JavaScript injection, which is fixed in any case.
17150 # It's not clear that the original result listed was any more correct than the
17151 # current one. Original result:
17152 # <p>{{{|
17153 # </p>
17154 # <li class="&#124;&#124;">
17155 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17156 !!test
17157 Fuzz testing: Parser25 (bug 6055)
17158 !! wikitext
17159 {{{
17160 |
17161 <LI CLASS=||
17162 >
17163 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17164 !! html
17165 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17166 </p>
17167 !! end
17168
17169 !!test
17170 Fuzz testing: URL adjacent extension (with space, clean)
17171 !! wikitext
17172 http://example.com <nowiki>junk</nowiki>
17173 !! html/php
17174 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17175 </p>
17176 !! html/parsoid
17177 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17178 !! end
17179
17180 !!test
17181 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17182 !! wikitext
17183 http://example.com<nowiki>junk</nowiki>
17184 !! html/php
17185 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17186 </p>
17187 !! html/parsoid
17188 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17189 !! end
17190
17191 !!test
17192 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17193 !! wikitext
17194 http://example.com<pre>junk</pre>
17195 !! html/php
17196 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17197
17198 !! html/php+tidy
17199 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17200 <pre>
17201 junk
17202 </pre>
17203 !! html/parsoid
17204 <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>
17205 !!end
17206
17207 !!test
17208 Fuzz testing: image with bogus manual thumbnail
17209 !! wikitext
17210 [[Image:foobar.jpg|thumbnail= ]]
17211 !! html/php
17212 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17213
17214 !! html/parsoid
17215 <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>
17216 !!end
17217
17218 !! test
17219 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17220 !! wikitext
17221 <pre dir="&#10;"></pre>
17222 !! html
17223 <pre dir="&#10;"></pre>
17224
17225 !! end
17226
17227 !! test
17228 Parsing optional HTML elements (Bug 6171)
17229 !! options
17230 !! wikitext
17231 <table>
17232 <tr>
17233 <td> Some tabular data</td>
17234 <td> More tabular data ...
17235 <td> And yet som tabular data</td>
17236 </tr>
17237 </table>
17238 !! html
17239 <table>
17240 <tr>
17241 <td> Some tabular data</td>
17242 <td> More tabular data ...
17243 </td><td> And yet som tabular data</td>
17244 </tr>
17245 </table>
17246
17247 !! end
17248
17249 !! test
17250 Correct handling of <td>, <tr> (Bug 6171)
17251 !! options
17252 !! wikitext
17253 <table>
17254 <tr>
17255 <td> Some tabular data</td>
17256 <td> More tabular data ...</td>
17257 <td> And yet som tabular data</td>
17258 </tr>
17259 </table>
17260 !! html
17261 <table>
17262 <tr>
17263 <td> Some tabular data</td>
17264 <td> More tabular data ...</td>
17265 <td> And yet som tabular data</td>
17266 </tr>
17267 </table>
17268
17269 !! end
17270
17271
17272 !! test
17273 Parsing crashing regression (fr:JavaScript)
17274 !! wikitext
17275 </body></x>
17276 !! html
17277 <p>&lt;/body&gt;&lt;/x&gt;
17278 </p>
17279 !! end
17280
17281 !! test
17282 Inline wiki vs wiki block nesting
17283 !! wikitext
17284 '''Bold paragraph
17285
17286 New wiki paragraph
17287 !! html
17288 <p><b>Bold paragraph</b>
17289 </p><p>New wiki paragraph
17290 </p>
17291 !! end
17292
17293 # FIXME: The current php output is documented
17294 # and desired output is the parsoid target.
17295 !! test
17296 Inline HTML vs wiki block nesting
17297 !! wikitext
17298 <b>Bold paragraph
17299
17300 New wiki paragraph
17301 !! html/php
17302 <p><b>Bold paragraph
17303 </p><p>New wiki paragraph</b>
17304 </p>
17305 !! html/parsoid
17306 <p><b>Bold paragraph</b>
17307 </p><p>New wiki paragraph
17308 </p>
17309 !! end
17310
17311 # Original result was this:
17312 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17313 # </p>
17314 # While that might be marginally more intuitive, maybe, the six-apostrophe
17315 # construct is clearly pathological and the result stated here (which is what
17316 # the parser actually does) is about as reasonable as anything.
17317 !!test
17318 Mixing markup for italics and bold
17319 !! options
17320 !! wikitext
17321 '''bold''''''bold''bolditalics'''''
17322 !! html
17323 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17324 </p>
17325 !! end
17326
17327
17328 !! article
17329 Xyzzyx
17330 !! text
17331 Article for special page transclusion test
17332 !! endarticle
17333
17334 !! test
17335 Special page transclusion
17336 !! options
17337 !! wikitext
17338 {{Special:Prefixindex/Xyzzyx}}
17339 !! html
17340 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17341 </ul>
17342
17343 !! end
17344
17345 !! test
17346 Special page transclusion twice (bug 5021)
17347 !! options
17348 !! wikitext
17349 {{Special:Prefixindex/Xyzzyx}}
17350 {{Special:Prefixindex/Xyzzyx}}
17351 !! html
17352 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17353 </ul>
17354 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17355 </ul>
17356
17357 !! end
17358
17359 !! test
17360 Transclusion of default MediaWiki message
17361 !! wikitext
17362 {{MediaWiki:Mainpage}}
17363 !! html
17364 <p>Main Page
17365 </p>
17366 !! end
17367
17368 !! test
17369 Transclusion of nonexistent MediaWiki message
17370 !! wikitext
17371 {{MediaWiki:Mainpagexxx}}
17372 !! html
17373 <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>
17374 </p>
17375 !! end
17376
17377 !! test
17378 Transclusion of MediaWiki message with underscore
17379 !! wikitext
17380 {{MediaWiki:history_short}}
17381 !! html
17382 <p>History
17383 </p>
17384 !! end
17385
17386 !! test
17387 Transclusion of MediaWiki message with space
17388 !! wikitext
17389 {{MediaWiki:history short}}
17390 !! html
17391 <p>History
17392 </p>
17393 !! end
17394
17395 !! test
17396 Invalid header with following text
17397 !! wikitext
17398 = x = y
17399 !! html
17400 <p>= x = y
17401 </p>
17402 !! end
17403
17404
17405 !! test
17406 Section extraction test (section 0)
17407 !! options
17408 section=0
17409 !! wikitext
17410 start
17411 ==a==
17412 ===aa===
17413 ====aaa====
17414 ==b==
17415 ===ba===
17416 ===bb===
17417 ====bba====
17418 ===bc===
17419 ==c==
17420 ===ca===
17421 !! html/php
17422 start
17423 !! end
17424
17425 !! test
17426 Section extraction test (section 1)
17427 !! options
17428 section=1
17429 !! wikitext
17430 start
17431 ==a==
17432 ===aa===
17433 ====aaa====
17434 ==b==
17435 ===ba===
17436 ===bb===
17437 ====bba====
17438 ===bc===
17439 ==c==
17440 ===ca===
17441 !! html/php
17442 ==a==
17443 ===aa===
17444 ====aaa====
17445 !! end
17446
17447 !! test
17448 Section extraction test (section 2)
17449 !! options
17450 section=2
17451 !! wikitext
17452 start
17453 ==a==
17454 ===aa===
17455 ====aaa====
17456 ==b==
17457 ===ba===
17458 ===bb===
17459 ====bba====
17460 ===bc===
17461 ==c==
17462 ===ca===
17463 !! html/php
17464 ===aa===
17465 ====aaa====
17466 !! end
17467
17468 !! test
17469 Section extraction test (section 3)
17470 !! options
17471 section=3
17472 !! wikitext
17473 start
17474 ==a==
17475 ===aa===
17476 ====aaa====
17477 ==b==
17478 ===ba===
17479 ===bb===
17480 ====bba====
17481 ===bc===
17482 ==c==
17483 ===ca===
17484 !! html/php
17485 ====aaa====
17486 !! end
17487
17488 !! test
17489 Section extraction test (section 4)
17490 !! options
17491 section=4
17492 !! wikitext
17493 start
17494 ==a==
17495 ===aa===
17496 ====aaa====
17497 ==b==
17498 ===ba===
17499 ===bb===
17500 ====bba====
17501 ===bc===
17502 ==c==
17503 ===ca===
17504 !! html/php
17505 ==b==
17506 ===ba===
17507 ===bb===
17508 ====bba====
17509 ===bc===
17510 !! end
17511
17512 !! test
17513 Section extraction test (section 5)
17514 !! options
17515 section=5
17516 !! wikitext
17517 start
17518 ==a==
17519 ===aa===
17520 ====aaa====
17521 ==b==
17522 ===ba===
17523 ===bb===
17524 ====bba====
17525 ===bc===
17526 ==c==
17527 ===ca===
17528 !! html/php
17529 ===ba===
17530 !! end
17531
17532 !! test
17533 Section extraction test (section 6)
17534 !! options
17535 section=6
17536 !! wikitext
17537 start
17538 ==a==
17539 ===aa===
17540 ====aaa====
17541 ==b==
17542 ===ba===
17543 ===bb===
17544 ====bba====
17545 ===bc===
17546 ==c==
17547 ===ca===
17548 !! html/php
17549 ===bb===
17550 ====bba====
17551 !! end
17552
17553 !! test
17554 Section extraction test (section 7)
17555 !! options
17556 section=7
17557 !! wikitext
17558 start
17559 ==a==
17560 ===aa===
17561 ====aaa====
17562 ==b==
17563 ===ba===
17564 ===bb===
17565 ====bba====
17566 ===bc===
17567 ==c==
17568 ===ca===
17569 !! html/php
17570 ====bba====
17571 !! end
17572
17573 !! test
17574 Section extraction test (section 8)
17575 !! options
17576 section=8
17577 !! wikitext
17578 start
17579 ==a==
17580 ===aa===
17581 ====aaa====
17582 ==b==
17583 ===ba===
17584 ===bb===
17585 ====bba====
17586 ===bc===
17587 ==c==
17588 ===ca===
17589 !! html/php
17590 ===bc===
17591 !! end
17592
17593 !! test
17594 Section extraction test (section 9)
17595 !! options
17596 section=9
17597 !! wikitext
17598 start
17599 ==a==
17600 ===aa===
17601 ====aaa====
17602 ==b==
17603 ===ba===
17604 ===bb===
17605 ====bba====
17606 ===bc===
17607 ==c==
17608 ===ca===
17609 !! html/php
17610 ==c==
17611 ===ca===
17612 !! end
17613
17614 !! test
17615 Section extraction test (section 10)
17616 !! options
17617 section=10
17618 !! wikitext
17619 start
17620 ==a==
17621 ===aa===
17622 ====aaa====
17623 ==b==
17624 ===ba===
17625 ===bb===
17626 ====bba====
17627 ===bc===
17628 ==c==
17629 ===ca===
17630 !! html/php
17631 ===ca===
17632 !! end
17633
17634 !! test
17635 Section extraction test (nonexistent section 11)
17636 !! options
17637 section=11
17638 !! wikitext
17639 start
17640 ==a==
17641 ===aa===
17642 ====aaa====
17643 ==b==
17644 ===ba===
17645 ===bb===
17646 ====bba====
17647 ===bc===
17648 ==c==
17649 ===ca===
17650 !! html/php
17651 !! end
17652
17653 !! test
17654 Section extraction test with bogus heading (section 1)
17655 !! options
17656 section=1
17657 !! wikitext
17658 ==a==
17659 ==bogus== not a legal section
17660 ==b==
17661 !! html/php
17662 ==a==
17663 ==bogus== not a legal section
17664 !! end
17665
17666 !! test
17667 Section extraction test with bogus heading (section 2)
17668 !! options
17669 section=2
17670 !! wikitext
17671 ==a==
17672 ==bogus== not a legal section
17673 ==b==
17674 !! html/php
17675 ==b==
17676 !! end
17677
17678 !! test
17679 Section extraction test with comment after heading (section 1)
17680 !! options
17681 section=1
17682 !! wikitext
17683 ==a==
17684 ==b== <!-- -->
17685 ==c==
17686 !! html/php
17687 ==a==
17688 !! end
17689
17690 !! test
17691 Section extraction test with comment after heading (section 2)
17692 !! options
17693 section=2
17694 !! wikitext
17695 ==a==
17696 ==b== <!-- -->
17697 ==c==
17698 !! html/php
17699 ==b== <!-- -->
17700 !! end
17701
17702 !! test
17703 Section extraction test with bogus <nowiki> heading (section 1)
17704 !! options
17705 section=1
17706 !! wikitext
17707 ==a==
17708 ==bogus== <nowiki>not a legal section</nowiki>
17709 ==b==
17710 !! html/php
17711 ==a==
17712 ==bogus== <nowiki>not a legal section</nowiki>
17713 !! end
17714
17715 !! test
17716 Section extraction test with bogus <nowiki> heading (section 2)
17717 !! options
17718 section=2
17719 !! wikitext
17720 ==a==
17721 ==bogus== <nowiki>not a legal section</nowiki>
17722 ==b==
17723 !! html/php
17724 ==b==
17725 !! end
17726
17727 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17728 # instead of respecting commented sections
17729 !! test
17730 Section extraction prefixed by comment (section 1)
17731 !! options
17732 section=1
17733 !! wikitext
17734 <!-- -->==sec1==
17735 ==sec2==
17736 !! html/php
17737 ==sec2==
17738 !!end
17739
17740 !! test
17741 Section extraction prefixed by comment (section 2)
17742 !! options
17743 section=2
17744 !! wikitext
17745 <!-- -->==sec1==
17746 ==sec2==
17747 !! html/php
17748
17749 !!end
17750
17751 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17752 # instead of respecting HTML-style headings
17753 !! test
17754 Section extraction, mixed wiki and html (section 1)
17755 !! options
17756 section=1
17757 !! wikitext
17758 <h2>unmarked</h2>
17759 unmarked
17760 ==1==
17761 one
17762 ==2==
17763 two
17764 !! html/php
17765 ==1==
17766 one
17767 !! end
17768
17769 !! test
17770 Section extraction, mixed wiki and html (section 2)
17771 !! options
17772 section=2
17773 !! wikitext
17774 <h2>unmarked</h2>
17775 unmarked
17776 ==1==
17777 one
17778 ==2==
17779 two
17780 !! html/php
17781 ==2==
17782 two
17783 !! end
17784
17785
17786 # Formerly testing for bug 3342
17787 !! test
17788 Section extraction, heading surrounded by <noinclude>
17789 !! options
17790 section=1
17791 !! wikitext
17792 <noinclude>==unmarked==</noinclude>
17793 ==marked==
17794 !! html/php
17795 ==marked==
17796 !!end
17797
17798 # Test behavior of bug 19910
17799 !! test
17800 Sectiion with all-equals
17801 !! options
17802 section=2
17803 !! wikitext
17804 ===
17805 The line above must have a trailing space
17806 === <!--
17807 --> <!-- -->
17808 But just in case it doesn't...
17809 !! html/php
17810 === <!--
17811 --> <!-- -->
17812 But just in case it doesn't...
17813 !! end
17814
17815 !! test
17816 Section replacement test (section 0)
17817 !! options
17818 replace=0,"xxx"
17819 !! wikitext
17820 start
17821 ==a==
17822 ===aa===
17823 ====aaa====
17824 ==b==
17825 ===ba===
17826 ===bb===
17827 ====bba====
17828 ===bc===
17829 ==c==
17830 ===ca===
17831 !! html/php
17832 xxx
17833
17834 ==a==
17835 ===aa===
17836 ====aaa====
17837 ==b==
17838 ===ba===
17839 ===bb===
17840 ====bba====
17841 ===bc===
17842 ==c==
17843 ===ca===
17844 !! end
17845
17846 !! test
17847 Section replacement test (section 1)
17848 !! options
17849 replace=1,"xxx"
17850 !! wikitext
17851 start
17852 ==a==
17853 ===aa===
17854 ====aaa====
17855 ==b==
17856 ===ba===
17857 ===bb===
17858 ====bba====
17859 ===bc===
17860 ==c==
17861 ===ca===
17862 !! html/php
17863 start
17864 xxx
17865
17866 ==b==
17867 ===ba===
17868 ===bb===
17869 ====bba====
17870 ===bc===
17871 ==c==
17872 ===ca===
17873 !! end
17874
17875 !! test
17876 Section replacement test (section 2)
17877 !! options
17878 replace=2,"xxx"
17879 !! wikitext
17880 start
17881 ==a==
17882 ===aa===
17883 ====aaa====
17884 ==b==
17885 ===ba===
17886 ===bb===
17887 ====bba====
17888 ===bc===
17889 ==c==
17890 ===ca===
17891 !! html/php
17892 start
17893 ==a==
17894 xxx
17895
17896 ==b==
17897 ===ba===
17898 ===bb===
17899 ====bba====
17900 ===bc===
17901 ==c==
17902 ===ca===
17903 !! end
17904
17905 !! test
17906 Section replacement test (section 3)
17907 !! options
17908 replace=3,"xxx"
17909 !! wikitext
17910 start
17911 ==a==
17912 ===aa===
17913 ====aaa====
17914 ==b==
17915 ===ba===
17916 ===bb===
17917 ====bba====
17918 ===bc===
17919 ==c==
17920 ===ca===
17921 !! html/php
17922 start
17923 ==a==
17924 ===aa===
17925 xxx
17926
17927 ==b==
17928 ===ba===
17929 ===bb===
17930 ====bba====
17931 ===bc===
17932 ==c==
17933 ===ca===
17934 !! end
17935
17936 !! test
17937 Section replacement test (section 4)
17938 !! options
17939 replace=4,"xxx"
17940 !! wikitext
17941 start
17942 ==a==
17943 ===aa===
17944 ====aaa====
17945 ==b==
17946 ===ba===
17947 ===bb===
17948 ====bba====
17949 ===bc===
17950 ==c==
17951 ===ca===
17952 !! html/php
17953 start
17954 ==a==
17955 ===aa===
17956 ====aaa====
17957 xxx
17958
17959 ==c==
17960 ===ca===
17961 !! end
17962
17963 !! test
17964 Section replacement test (section 5)
17965 !! options
17966 replace=5,"xxx"
17967 !! wikitext
17968 start
17969 ==a==
17970 ===aa===
17971 ====aaa====
17972 ==b==
17973 ===ba===
17974 ===bb===
17975 ====bba====
17976 ===bc===
17977 ==c==
17978 ===ca===
17979 !! html/php
17980 start
17981 ==a==
17982 ===aa===
17983 ====aaa====
17984 ==b==
17985 xxx
17986
17987 ===bb===
17988 ====bba====
17989 ===bc===
17990 ==c==
17991 ===ca===
17992 !! end
17993
17994 !! test
17995 Section replacement test (section 6)
17996 !! options
17997 replace=6,"xxx"
17998 !! wikitext
17999 start
18000 ==a==
18001 ===aa===
18002 ====aaa====
18003 ==b==
18004 ===ba===
18005 ===bb===
18006 ====bba====
18007 ===bc===
18008 ==c==
18009 ===ca===
18010 !! html/php
18011 start
18012 ==a==
18013 ===aa===
18014 ====aaa====
18015 ==b==
18016 ===ba===
18017 xxx
18018
18019 ===bc===
18020 ==c==
18021 ===ca===
18022 !! end
18023
18024 !! test
18025 Section replacement test (section 7)
18026 !! options
18027 replace=7,"xxx"
18028 !! wikitext
18029 start
18030 ==a==
18031 ===aa===
18032 ====aaa====
18033 ==b==
18034 ===ba===
18035 ===bb===
18036 ====bba====
18037 ===bc===
18038 ==c==
18039 ===ca===
18040 !! html/php
18041 start
18042 ==a==
18043 ===aa===
18044 ====aaa====
18045 ==b==
18046 ===ba===
18047 ===bb===
18048 xxx
18049
18050 ===bc===
18051 ==c==
18052 ===ca===
18053 !! end
18054
18055 !! test
18056 Section replacement test (section 8)
18057 !! options
18058 replace=8,"xxx"
18059 !! wikitext
18060 start
18061 ==a==
18062 ===aa===
18063 ====aaa====
18064 ==b==
18065 ===ba===
18066 ===bb===
18067 ====bba====
18068 ===bc===
18069 ==c==
18070 ===ca===
18071 !! html/php
18072 start
18073 ==a==
18074 ===aa===
18075 ====aaa====
18076 ==b==
18077 ===ba===
18078 ===bb===
18079 ====bba====
18080 xxx
18081
18082 ==c==
18083 ===ca===
18084 !!end
18085
18086 !! test
18087 Section replacement test (section 9)
18088 !! options
18089 replace=9,"xxx"
18090 !! wikitext
18091 start
18092 ==a==
18093 ===aa===
18094 ====aaa====
18095 ==b==
18096 ===ba===
18097 ===bb===
18098 ====bba====
18099 ===bc===
18100 ==c==
18101 ===ca===
18102 !! html/php
18103 start
18104 ==a==
18105 ===aa===
18106 ====aaa====
18107 ==b==
18108 ===ba===
18109 ===bb===
18110 ====bba====
18111 ===bc===
18112 xxx
18113 !! end
18114
18115 !! test
18116 Section replacement test (section 10)
18117 !! options
18118 replace=10,"xxx"
18119 !! wikitext
18120 start
18121 ==a==
18122 ===aa===
18123 ====aaa====
18124 ==b==
18125 ===ba===
18126 ===bb===
18127 ====bba====
18128 ===bc===
18129 ==c==
18130 ===ca===
18131 !! html/php
18132 start
18133 ==a==
18134 ===aa===
18135 ====aaa====
18136 ==b==
18137 ===ba===
18138 ===bb===
18139 ====bba====
18140 ===bc===
18141 ==c==
18142 xxx
18143 !! end
18144
18145 !! test
18146 Section replacement test with initial whitespace (bug 13728)
18147 !! options
18148 replace=2,"xxx"
18149 !! wikitext
18150 Preformatted initial line
18151 ==a==
18152 ===a===
18153 !! html/php
18154 Preformatted initial line
18155 ==a==
18156 xxx
18157 !! end
18158
18159
18160 !! test
18161 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18162 !! options
18163 section=1
18164 !! wikitext
18165 ==a==
18166 a
18167 !! html/php
18168 ==a==
18169 a
18170 !! end
18171
18172 !! test
18173 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18174 !! options
18175 section=1
18176 !! wikitext
18177 ==a==
18178 a
18179 !! html/php
18180 ==a==
18181 a
18182 !! end
18183
18184
18185 !! test
18186 Section extraction, <pre> around bogus header (bug 10309)
18187 !! options
18188 noxml section=2
18189 !! wikitext
18190 == Section One ==
18191 <pre>
18192 =======
18193 </pre>
18194
18195 == Section Two ==
18196 stuff
18197 !! html/php
18198 == Section Two ==
18199 stuff
18200 !! end
18201
18202 !! test
18203 Section replacement, <pre> around bogus header (bug 10309)
18204 !! options
18205 noxml replace=2,"xxx"
18206 !! wikitext
18207 == Section One ==
18208 <pre>
18209 =======
18210 </pre>
18211
18212 == Section Two ==
18213 stuff
18214 !! html/php
18215 == Section One ==
18216 <pre>
18217 =======
18218 </pre>
18219
18220 xxx
18221 !! end
18222
18223
18224 !! test
18225 Handling of &#x0A; in URLs
18226 !! wikitext
18227 ** irc://&#x0A;a
18228 !! html/php
18229 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18230
18231 !! html/parsoid
18232 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18233 a">irc://
18234 a</a></li></ul></li></ul>
18235 !! end
18236
18237 !! test
18238 Handling of %0A in URLs
18239 !! wikitext
18240 ** irc://%0Aa
18241 !! html/php
18242 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18243
18244 !! html/parsoid
18245 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18246 !! end
18247
18248
18249 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18250 !! test
18251 5 quotes, code coverage +1 line
18252 !! options
18253 parsoid=wt2html
18254 !! wikitext
18255 '''''
18256 !! html/php
18257 !! html/parsoid
18258 <p><b><i></i></b></p>
18259 !! end
18260
18261 # same html as previous, but wikitext adjusted to match parsoid html2wt
18262 # note that wt2html and html2html will put the <i> before the <b>
18263 !! test
18264 5 quotes, code coverage +1 line w/ nowiki (1)
18265 !! options
18266 parsoid=wt2wt,html2wt
18267 !! wikitext
18268 '''''<nowiki/>'''''
18269 !! html/php
18270 <p><i></i>
18271 </p>
18272 !! html/parsoid
18273 <p><b><i></i></b></p>
18274 !! end
18275
18276 # same as previous, just swapping the <i> and <b>
18277 !! test
18278 5 quotes, code coverage +1 line w/ nowiki (2)
18279 !! wikitext
18280 '''''<nowiki/>'''''
18281 !! html/php
18282 <p><i></i>
18283 </p>
18284 !! html/parsoid
18285 <p><i><b></b></i></p>
18286 !! end
18287
18288 !! test
18289 Special:Search page linking.
18290 !! wikitext
18291 {{Special:search}}
18292 !! html
18293 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18294 </p>
18295 !! end
18296
18297 !! test
18298 {{!}} is a magic word
18299 !! wikitext
18300 {{!}} is a magic word there and {{!}} is still a magic word here
18301 | is not a magic word here but {{!}} is still a magic word here
18302 !! html/php
18303 <p>| is a magic word there and | is still a magic word here
18304 | is not a magic word here but | is still a magic word here
18305 </p>
18306 !! html/parsoid
18307 <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
18308 | 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>
18309
18310 !! end
18311
18312 !! test
18313 Say the magic word
18314 !! options
18315 title=[[Parser test]]
18316 !! wikitext
18317 * {{PAGENAME}}
18318 * {{PAGENAMEE}}
18319 * {{FULLPAGENAME}}
18320 * {{FULLPAGENAMEE}}
18321 * {{BASEPAGENAME}}
18322 * {{BASEPAGENAMEE}}
18323 * {{SUBPAGENAME}}
18324 * {{SUBPAGENAMEE}}
18325 * {{ROOTPAGENAME}}
18326 * {{ROOTPAGENAMEE}}
18327 * {{TALKPAGENAME}}
18328 * {{TALKPAGENAMEE}}
18329 * {{SUBJECTPAGENAME}}
18330 * {{SUBJECTPAGENAMEE}}
18331 * {{NAMESPACEE}}
18332 * {{NAMESPACE}}
18333 * {{NAMESPACENUMBER}}
18334 * {{TALKSPACE}}
18335 * {{TALKSPACEE}}
18336 * {{SUBJECTSPACE}}
18337 * {{SUBJECTSPACEE}}
18338 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18339 !! html
18340 <ul><li> Parser test</li>
18341 <li> Parser_test</li>
18342 <li> Parser test</li>
18343 <li> Parser_test</li>
18344 <li> Parser test</li>
18345 <li> Parser_test</li>
18346 <li> Parser test</li>
18347 <li> Parser_test</li>
18348 <li> Parser test</li>
18349 <li> Parser_test</li>
18350 <li> Talk:Parser test</li>
18351 <li> Talk:Parser_test</li>
18352 <li> Parser test</li>
18353 <li> Parser_test</li>
18354 <li> </li>
18355 <li> </li>
18356 <li> 0</li>
18357 <li> Talk</li>
18358 <li> Talk</li>
18359 <li> </li>
18360 <li> </li>
18361 <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>
18362
18363 !! end
18364 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18365
18366 !! test
18367 Gallery
18368 !! wikitext
18369 <gallery>
18370 image1.png |
18371 image2.gif|||||
18372
18373 image3|
18374 image4 |300px| centre
18375 image5.svg| http://///////
18376 [[x|xx]]]]
18377 * image6
18378 </gallery>
18379 !! html
18380 <ul class="gallery mw-gallery-traditional">
18381 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18382 <div class="thumb" style="height: 150px;">Image1.png</div>
18383 <div class="gallerytext">
18384 </div>
18385 </div></li>
18386 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18387 <div class="thumb" style="height: 150px;">Image2.gif</div>
18388 <div class="gallerytext">
18389 </div>
18390 </div></li>
18391 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18392 <div class="thumb" style="height: 150px;">Image3</div>
18393 <div class="gallerytext">
18394 </div>
18395 </div></li>
18396 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18397 <div class="thumb" style="height: 150px;">Image4</div>
18398 <div class="gallerytext">
18399 <pre>centre
18400 </pre>
18401 </div>
18402 </div></li>
18403 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18404 <div class="thumb" style="height: 150px;">Image5.svg</div>
18405 <div class="gallerytext">
18406 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18407 </p>
18408 </div>
18409 </div></li>
18410 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18411 <div class="thumb" style="height: 150px;">* image6</div>
18412 <div class="gallerytext">
18413 </div>
18414 </div></li>
18415 </ul>
18416
18417 !! end
18418
18419 !! test
18420 Gallery (with options)
18421 !! wikitext
18422 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18423 File:Nonexistent.jpg|caption
18424 File:Nonexistent.jpg
18425 image:foobar.jpg|some '''caption''' [[Main Page]]
18426 image:foobar.jpg
18427 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18428 </gallery>
18429 !! html
18430 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18431 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18432 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18433 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18434 <div class="gallerytext">
18435 <p>caption
18436 </p>
18437 </div>
18438 </div></li>
18439 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18440 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18441 <div class="gallerytext">
18442 </div>
18443 </div></li>
18444 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18445 <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>
18446 <div class="gallerytext">
18447 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18448 </p>
18449 </div>
18450 </div></li>
18451 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18452 <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>
18453 <div class="gallerytext">
18454 </div>
18455 </div></li>
18456 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18457 <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>
18458 <div class="gallerytext">
18459 <p>blabla.
18460 </p>
18461 </div>
18462 </div></li>
18463 </ul>
18464
18465 !! end
18466
18467 !! test
18468 Gallery with link that has fragment
18469 !! wikitext
18470 <gallery>
18471 image:foobar.jpg|link=Main_Page
18472 image:foobar.jpg|link=Main_Page#section
18473 image:foobar.jpg|link=Main Page#section|caption
18474 </gallery>
18475 !! html
18476 <ul class="gallery mw-gallery-traditional">
18477 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18478 <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>
18479 <div class="gallerytext">
18480 </div>
18481 </div></li>
18482 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18483 <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>
18484 <div class="gallerytext">
18485 </div>
18486 </div></li>
18487 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18488 <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>
18489 <div class="gallerytext">
18490 <p>caption
18491 </p>
18492 </div>
18493 </div></li>
18494 </ul>
18495
18496 !! end
18497
18498 !! test
18499 Gallery with wikitext inside caption
18500 !! wikitext
18501 <gallery>
18502 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18503 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18504 </gallery>
18505 !! html
18506 <ul class="gallery mw-gallery-traditional">
18507 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18508 <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>
18509 <div class="gallerytext">
18510 <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>
18511 </p>
18512 </div>
18513 </div></li>
18514 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18515 <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>
18516 <div class="gallerytext">
18517 <p>This is a test template
18518 </p>
18519 </div>
18520 </div></li>
18521 </ul>
18522
18523 !! end
18524
18525 !! test
18526 gallery (with showfilename option)
18527 !! wikitext
18528 <gallery showfilename>
18529 File:Nonexistent.jpg|caption
18530 File:Nonexistent.jpg
18531 image:foobar.jpg|some '''caption''' [[Main Page]]
18532 File:Foobar.jpg
18533 </gallery>
18534 !! html
18535 <ul class="gallery mw-gallery-traditional">
18536 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18537 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18538 <div class="gallerytext">
18539 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18540 caption
18541 </p>
18542 </div>
18543 </div></li>
18544 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18545 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18546 <div class="gallerytext">
18547 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18548 </p>
18549 </div>
18550 </div></li>
18551 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18552 <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>
18553 <div class="gallerytext">
18554 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18555 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18556 </p>
18557 </div>
18558 </div></li>
18559 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18560 <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>
18561 <div class="gallerytext">
18562 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18563 </p>
18564 </div>
18565 </div></li>
18566 </ul>
18567
18568 !! end
18569
18570 !! test
18571 Gallery (with namespace-less filenames)
18572 !! wikitext
18573 <gallery>
18574 File:Nonexistent.jpg
18575 Nonexistent.jpg
18576 image:foobar.jpg
18577 foobar.jpg
18578 </gallery>
18579 !! html
18580 <ul class="gallery mw-gallery-traditional">
18581 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18582 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18583 <div class="gallerytext">
18584 </div>
18585 </div></li>
18586 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18587 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18588 <div class="gallerytext">
18589 </div>
18590 </div></li>
18591 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18592 <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>
18593 <div class="gallerytext">
18594 </div>
18595 </div></li>
18596 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18597 <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>
18598 <div class="gallerytext">
18599 </div>
18600 </div></li>
18601 </ul>
18602
18603 !! end
18604
18605 !! test
18606 HTML Hex character encoding (spells the word "JavaScript")
18607 !! options
18608 parsoid=wt2html,wt2wt,html2html
18609 !! wikitext
18610 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18611 !! html/php
18612 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18613 </p>
18614 !! html/php+tidy
18615 <p>JavaScript</p>
18616 !! html/parsoid
18617 <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>
18618 !! end
18619
18620 !! test
18621 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18622 !! wikitext
18623 &#xsee;&#XSEE;
18624 !! html/php
18625 <p>&amp;#xsee;&amp;#XSEE;
18626 </p>
18627 !! html/parsoid
18628 <p>&amp;#xsee;&amp;#XSEE;</p>
18629 !! end
18630
18631 !! test
18632 HTML Hex character encoding mixed case
18633 !! options
18634 parsoid=wt2html,wt2wt,html2html
18635 !! wikitext
18636 &#xEE;&#Xee;
18637 !! html/php
18638 <p>&#xee;&#xee;
18639 </p>
18640 !! html/php+tidy
18641 <p>îî</p>
18642 !! html/parsoid
18643 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18644 !! end
18645
18646 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18647 # Note that U+000C (form feed) is not a valid XML character, so
18648 # it is banned even though allowed in HTML5.
18649 !! test
18650 Illegal character references (T106578)
18651 !! wikitext
18652 ; Null: &#00;
18653 ; FF: &#xC;
18654 ; CR: &#xD;
18655 ; Control (low): &#8;
18656 ; Control (high): &#x7F; &#x9F;
18657 ; Surrogate: &#xD83D;&#xDCA9;
18658 ; This is an okay astral character: &#x1F4A9;
18659 !! html+tidy
18660 <dl>
18661 <dt>Null</dt>
18662 <dd>&amp;#00;</dd>
18663 <dt>FF</dt>
18664 <dd>&amp;#xC;</dd>
18665 <dt>CR</dt>
18666 <dd>&amp;#xD;</dd>
18667 <dt>Control (low)</dt>
18668 <dd>&amp;#8;</dd>
18669 <dt>Control (high)</dt>
18670 <dd>&amp;#x7F; &amp;#x9F;</dd>
18671 <dt>Surrogate</dt>
18672 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18673 <dt>This is an okay astral character</dt>
18674 <dd>💩</dd>
18675 </dl>
18676 !! end
18677
18678 !! test
18679 __FORCETOC__ override
18680 !! wikitext
18681 __NEWSECTIONLINK__
18682 __FORCETOC__
18683 !! html/php
18684 <p><br />
18685 </p>
18686 !! end
18687
18688 !! test
18689 ISBN code coverage
18690 !! wikitext
18691 ISBN 978-0-1234-56&#x20;789
18692 !! html
18693 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18694 </p>
18695 !! html+tidy
18696 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18697 !! html/parsoid
18698 <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>
18699 !! end
18700
18701 !! test
18702 ISBN followed by 5 spaces
18703 !! wikitext
18704 ISBN
18705 !! html
18706 <p>ISBN
18707 </p>
18708 !! end
18709
18710 !! test
18711 Double ISBN
18712 !! wikitext
18713 ISBN ISBN 1234567890
18714 !! html/php
18715 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18716 </p>
18717 !! html/parsoid
18718 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18719 !! end
18720
18721 # Uppercase X and lowercase x as well
18722 !! test
18723 ISBN with an X
18724 !! wikitext
18725 ISBN 3-462-04561-X
18726 ISBN 3-462-04561-x
18727 ISBN 080442957X
18728 ISBN 080442957x
18729 ISBN 978080442957X
18730 ISBN 978080442957x
18731 !! html/php
18732 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18733 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18734 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18735 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18736 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18737 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18738 </p>
18739 !! html/parsoid
18740 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18741 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18742 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18743 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18744 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18745 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18746 !! end
18747
18748 !! test
18749 ISBN with empty prefix (parsoid test)
18750 !! wikitext
18751 ISBN 1234567890
18752 !! html/php
18753 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18754 </p>
18755 !! html/parsoid
18756 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18757 !! end
18758
18759 !! test
18760 Bug 22905: <abbr> followed by ISBN followed by </a>
18761 !! wikitext
18762 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18763 !! html/php
18764 <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>
18765 </p>
18766 !! html/parsoid
18767 <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>
18768 !! end
18769
18770 !! test
18771 Double RFC
18772 !! wikitext
18773 RFC RFC 1234
18774 !! html
18775 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18776 </p>
18777 !! end
18778
18779 !! test
18780 Double RFC with a wiki link
18781 !! wikitext
18782 RFC [[RFC 1234]]
18783 !! html
18784 <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>
18785 </p>
18786 !! end
18787
18788 !! test
18789 RFC code coverage
18790 !! wikitext
18791 RFC 983&#x20;987
18792 !! html
18793 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18794 </p>
18795 !! html+tidy
18796 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18797 !! end
18798
18799 !! test
18800 Centre-aligned image
18801 !! wikitext
18802 [[Image:foobar.jpg|centre]]
18803 !! html
18804 <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>
18805
18806 !!end
18807
18808 !! test
18809 None-aligned image
18810 !! wikitext
18811 [[Image:foobar.jpg|none]]
18812 !! html
18813 <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>
18814
18815 !!end
18816
18817 !! test
18818 Width + Height sized image (using px) (height is ignored)
18819 !! wikitext
18820 [[Image:foobar.jpg|640x480px]]
18821 !! html
18822 <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>
18823 </p>
18824 !!end
18825
18826 !! test
18827 Width-sized image (using px, no following whitespace)
18828 !! wikitext
18829 [[Image:foobar.jpg|640px]]
18830 !! html
18831 <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>
18832 </p>
18833 !!end
18834
18835 !! test
18836 Width-sized image (using px, with following whitespace - test regression from r39467)
18837 !! wikitext
18838 [[Image:foobar.jpg|640px ]]
18839 !! html
18840 <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>
18841 </p>
18842 !!end
18843
18844 !! test
18845 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18846 !! wikitext
18847 [[Image:foobar.jpg| 640px]]
18848 !! html
18849 <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>
18850 </p>
18851 !!end
18852
18853 !! test
18854 Image with page parameter
18855 !! options
18856 djvu
18857 !! wikitext
18858 [[File:LoremIpsum.djvu|page=2]]
18859 !! html/php
18860 <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>
18861 </p>
18862 !! html/parsoid
18863 <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>
18864 !! end
18865
18866 !! test
18867 Another italics / bold test
18868 !! wikitext
18869 ''' ''x'
18870 !! html
18871 <pre>'<i> </i>x'
18872 </pre>
18873 !!end
18874
18875 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18876 !! test
18877 dt/dd/dl test
18878 !! wikitext
18879 :;;;::
18880 !! html/php
18881 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18882
18883 !! html/parsoid
18884 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18885
18886 !!end
18887
18888
18889 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18890 !! test
18891 Images with the "|" character in the comment
18892 !! wikitext
18893 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18894 !! html/php
18895 <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>
18896
18897 !! html/parsoid
18898 <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>
18899 !! end
18900
18901 !! test
18902 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18903 !! wikitext
18904 <html><script>alert(1);</script></html>
18905 !! html
18906 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18907 </p>
18908 !! end
18909
18910 !! test
18911 HTML with raw HTML ($wgRawHtml==true)
18912 !! options
18913 wgRawHtml=1
18914 !! wikitext
18915 <html><script>alert(1);</script></html>
18916 !! html
18917 <p><script>alert(1);</script>
18918 </p>
18919 !! end
18920
18921 !! test
18922 Parents of subpages, one level up
18923 !! options
18924 subpage title=[[Subpage test/L1/L2/L3]]
18925 !! wikitext
18926 [[../|L2]]
18927 !! html
18928 <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>
18929 </p>
18930 !! end
18931
18932
18933 !! test
18934 Parents of subpages, one level up, not named
18935 !! options
18936 subpage title=[[Subpage test/L1/L2/L3]]
18937 !! wikitext
18938 [[../]]
18939 !! html
18940 <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>
18941 </p>
18942 !! end
18943
18944
18945
18946 !! test
18947 Parents of subpages, two levels up
18948 !! options
18949 subpage title=[[Subpage test/L1/L2/L3]]
18950 !! wikitext
18951 [[../../|L1]]2
18952
18953 [[../../|L1]]l
18954 !! html
18955 <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
18956 </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>
18957 </p>
18958 !! end
18959
18960 !! test
18961 Parents of subpages, two levels up, without trailing slash or name.
18962 !! options
18963 subpage title=[[Subpage test/L1/L2/L3]]
18964 !! wikitext
18965 [[../..]]
18966 !! html
18967 <p>[[../..]]
18968 </p>
18969 !! end
18970
18971 !! test
18972 Parents of subpages, two levels up, with lots of extra trailing slashes.
18973 !! options
18974 subpage title=[[Subpage test/L1/L2/L3]]
18975 !! wikitext
18976 [[../../////]]
18977 !! html
18978 <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>
18979 </p>
18980 !! end
18981
18982 !! article
18983 Subpage test/L1/L2/L3Sibling
18984 !! text
18985 Sibling article
18986 !! endarticle
18987
18988 !! test
18989 Transclusion of a sibling page (one level up)
18990 !! options
18991 subpage title=[[Subpage test/L1/L2/L3]]
18992 !! wikitext
18993 {{../L3Sibling}}
18994 !! html
18995 <p>Sibling article
18996 </p>
18997 !! end
18998
18999 !! test
19000 Transclusion of a child page
19001 !! options
19002 subpage title=[[Subpage test/L1/L2]]
19003 !! wikitext
19004 {{/L3Sibling}}
19005 !! html
19006 <p>Sibling article
19007 </p>
19008 !! end
19009
19010 !! test
19011 Non-transclusion because of too many up levels
19012 !! options
19013 subpage title=[[Subpage test/L1/L2/L3]]
19014 !! wikitext
19015 {{../../../../More than parent}}
19016 !! html
19017 <p>{{../../../../More than parent}}
19018 </p>
19019 !! end
19020
19021 !! test
19022 Definition list code coverage
19023 !! wikitext
19024 ; title : def
19025 ; title : def
19026 ;title: def
19027 !! html/php
19028 <dl><dt> title &#160;</dt>
19029 <dd> def</dd>
19030 <dt> title&#160;</dt>
19031 <dd> def</dd>
19032 <dt>title</dt>
19033 <dd> def</dd></dl>
19034
19035 !! html/parsoid
19036 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19037 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19038 <dt>title</dt><dd> def</dd></dl>
19039 !! end
19040
19041 !! test
19042 Don't fall for the self-closing div
19043 !! wikitext
19044 <div>hello world</div/>
19045 !! html
19046 <div>hello world</div>
19047
19048 !! end
19049
19050 !! test
19051 MSGNW magic word
19052 !! wikitext
19053 {{MSGNW:msg}}
19054 !! html/php
19055 <p>&#91;&#91;:Template:Msg&#93;&#93;
19056 </p>
19057 !! end
19058
19059 !! test
19060 RAW magic word
19061 !! wikitext
19062 {{RAW:QUERTY}}
19063 !! html
19064 <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>
19065 </p>
19066 !! end
19067
19068 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19069 !! test
19070 Always escape literal '>' in output, not just after '<'
19071 !! wikitext
19072 ><>
19073 !! html
19074 <p>&gt;&lt;&gt;
19075 </p>
19076 !! end
19077
19078 !! test
19079 Template caching
19080 !! wikitext
19081 {{Test}}
19082 {{Test}}
19083 !! html
19084 <p>This is a test template
19085 This is a test template
19086 </p>
19087 !! end
19088
19089
19090 !! article
19091 MediaWiki:Fake
19092 !! text
19093 ==header==
19094 !! endarticle
19095
19096 !! test
19097 Inclusion of !userCanEdit() content
19098 !! wikitext
19099 {{MediaWiki:Fake}}
19100 !! html
19101 <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>
19102
19103 !! end
19104
19105
19106 !! test
19107 Out-of-order TOC heading levels
19108 !! wikitext
19109 ==2==
19110 ======6======
19111 ===3===
19112 =1=
19113 =====5=====
19114 ==2==
19115 !! html
19116 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19117 <ul>
19118 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19119 <ul>
19120 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19121 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19122 </ul>
19123 </li>
19124 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19125 <ul>
19126 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19127 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19128 </ul>
19129 </li>
19130 </ul>
19131 </div>
19132
19133 <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>
19134 <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>
19135 <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>
19136 <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>
19137 <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>
19138 <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>
19139
19140 !! end
19141
19142
19143 !! test
19144 ISBN with a dummy number
19145 !! wikitext
19146 ISBN ---
19147 !! html
19148 <p>ISBN ---
19149 </p>
19150 !! end
19151
19152
19153 !! test
19154 ISBN with space-delimited number
19155 !! wikitext
19156 ISBN 92 9017 032 8
19157 !! html
19158 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19159 </p>
19160 !! end
19161
19162
19163 !! test
19164 ISBN with multiple spaces, no number
19165 !! wikitext
19166 ISBN foo
19167 !! html
19168 <p>ISBN foo
19169 </p>
19170 !! end
19171
19172
19173 !! test
19174 ISBN length
19175 !! wikitext
19176 ISBN 123456789
19177
19178 ISBN 1234567890
19179
19180 ISBN 12345678901
19181 !! html
19182 <p>ISBN 123456789
19183 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19184 </p><p>ISBN 12345678901
19185 </p>
19186 !! end
19187
19188
19189 !! test
19190 ISBN with trailing year (bug 8110)
19191 !! wikitext
19192 ISBN 1-234-56789-0 - 2006
19193
19194 ISBN 1 234 56789 0 - 2006
19195 !! html
19196 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19197 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19198 </p>
19199 !! end
19200
19201
19202 !! test
19203 anchorencode
19204 !! wikitext
19205 {{anchorencode:foo bar©#%n}}
19206 !! html
19207 <p>foo_bar.C2.A9.23.25n
19208 </p>
19209 !! end
19210
19211 !! test
19212 anchorencode trims spaces
19213 !! wikitext
19214 {{anchorencode: __pretty__please__}}
19215 !! html
19216 <p>pretty_please
19217 </p>
19218 !! end
19219
19220 !! test
19221 anchorencode deals with links
19222 !! wikitext
19223 {{anchorencode: [[hello|world]] [[hi]]}}
19224 !! html
19225 <p>world_hi
19226 </p>
19227 !! end
19228
19229 !! test
19230 anchorencode deals with templates
19231 !! wikitext
19232 {{anchorencode: {{Foo}} }}
19233 !! html
19234 <p>FOO
19235 </p>
19236 !! end
19237
19238 !! test
19239 anchorencode encodes like the TOC generator: (bug 18431)
19240 !! wikitext
19241 === _ +:.3A%3A&&amp;]] ===
19242 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19243 __NOEDITSECTION__
19244 !! html
19245 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19246 <p>.2B:.3A.253A.26.26.5D.5D
19247 </p>
19248 !! end
19249
19250 !! test
19251 Bug 6200: blockquotes and paragraph formatting
19252 !! wikitext
19253 <blockquote>
19254 foo
19255 </blockquote>
19256
19257 bar
19258
19259 baz
19260 !! html
19261 <blockquote>
19262 <p>foo
19263 </p>
19264 </blockquote>
19265 <p>bar
19266 </p>
19267 <pre>baz
19268 </pre>
19269 !! end
19270
19271 !! test
19272 Bug 8293: Use of center tag ruins paragraph formatting
19273 !! wikitext
19274 <center>
19275 foo
19276 </center>
19277
19278 bar
19279
19280 baz
19281 !! html
19282 <center>
19283 <p>foo
19284 </p>
19285 </center>
19286 <p>bar
19287 </p>
19288 <pre>baz
19289 </pre>
19290 !! end
19291
19292 !!test
19293 Parsing of overlapping (improperly nested) inline html tags
19294 !! wikitext
19295 <span><s>x</span></s>
19296 !! html/php
19297 <p><span><s>x&lt;/span&gt;</s></span>
19298 </p>
19299 !! html/parsoid
19300 <p><span><s>x</s></span>
19301 </p>
19302 !!end
19303
19304 ###
19305 ### Language variants related tests
19306 ###
19307 !! test
19308 Self-link in language variants
19309 !! options
19310 title=[[Dunav]] language=sr
19311 !! wikitext
19312 Both [[Dunav]] and [[Дунав]] are names for this river.
19313 !! html
19314 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19315 </p>
19316 !!end
19317
19318 !! article
19319 Дуна
19320 !! text
19321 content
19322 !! endarticle
19323
19324 !! test
19325 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19326 !! options
19327 title=[[Duna]] language=sr
19328 !! wikitext
19329 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19330 !! html
19331 <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.
19332 </p>
19333 !! end
19334
19335 !! test
19336 Link to a section of a variant of this title shouldn't be parsed as self-link
19337 !! options
19338 title=[[Duna]] language=sr
19339 !! wikitext
19340 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19341 !! html
19342 <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.
19343 </p>
19344 !! end
19345
19346 !! test
19347 Link to pages in language variants
19348 !! options
19349 language=sr
19350 !! wikitext
19351 Main Page can be written as [[Маин Паге]]
19352 !! html
19353 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19354 </p>
19355 !!end
19356
19357
19358 !! test
19359 Multiple links to pages in language variants
19360 !! options
19361 language=sr
19362 !! wikitext
19363 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19364 !! html
19365 <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>.
19366 </p>
19367 !!end
19368
19369
19370 !! test
19371 Simple template in language variants
19372 !! options
19373 language=sr
19374 !! wikitext
19375 {{тест}}
19376 !! html
19377 <p>This is a test template
19378 </p>
19379 !! end
19380
19381
19382 !! test
19383 Template with explicit namespace in language variants
19384 !! options
19385 language=sr
19386 !! wikitext
19387 {{Template:тест}}
19388 !! html
19389 <p>This is a test template
19390 </p>
19391 !! end
19392
19393
19394 !! test
19395 Basic test for template parameter in language variants
19396 !! options
19397 language=sr
19398 !! wikitext
19399 {{парамтест|param=foo}}
19400 !! html
19401 <p>This is a test template with parameter foo
19402 </p>
19403 !! end
19404
19405
19406 !! test
19407 Simple category in language variants
19408 !! options
19409 language=sr cat
19410 !! wikitext
19411 [[Category:МедиаWики Усер'с Гуиде]]
19412 !! html
19413 <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>
19414 !! end
19415
19416
19417 !! article
19418 Category:分类
19419 !! text
19420 blah
19421 !! endarticle
19422
19423 !! article
19424 Category:分類
19425 !! text
19426 blah
19427 !! endarticle
19428
19429 ## We used to, but no longer wt2wt this test since the default serializer
19430 ## will normalize all categories to serialize on their own line.
19431 ## This wikitext usage is going to be fairly uncommon in production and
19432 ## selser will take care of preserving formatting in those scenarios.
19433 !! test
19434 Don't convert blue categorylinks to another variant (bug 33210)
19435 !! options
19436 cat
19437 language=zh
19438 parsoid=wt2html
19439 !! wikitext
19440 [[A]][[Category:分类]]
19441 !! html/php
19442 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19443 !! html/parsoid
19444 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19445 <link rel="mw:PageProp/Category" href="Category:分类"/>
19446 !! end
19447
19448 !! test
19449 Stripping -{}- tags (language variants)
19450 !! options
19451 language=sr
19452 !! wikitext
19453 Latin proverb: -{Ne nuntium necare}-
19454 !! html
19455 <p>Latin proverb: Ne nuntium necare
19456 </p>
19457 !! end
19458
19459
19460 !! test
19461 Prevent conversion with -{}- tags (language variants)
19462 !! options
19463 language=sr variant=sr-ec
19464 !! wikitext
19465 Latinski: -{Ne nuntium necare}-
19466 !! html
19467 <p>Латински: Ne nuntium necare
19468 </p>
19469 !! end
19470
19471
19472 !! test
19473 Prevent conversion of text with -{}- tags (language variants)
19474 !! options
19475 language=sr variant=sr-ec
19476 !! wikitext
19477 Latinski: -{Ne nuntium necare}-
19478 !! html
19479 <p>Латински: Ne nuntium necare
19480 </p>
19481 !! end
19482
19483
19484 !! test
19485 Prevent conversion of links with -{}- tags (language variants)
19486 !! options
19487 language=sr variant=sr-ec
19488 !! wikitext
19489 -{[[Main Page]]}-
19490 !! html
19491 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19492 </p>
19493 !! end
19494
19495
19496 !! test
19497 -{}- tags within headlines (within html for parserConvert())
19498 !! options
19499 language=sr variant=sr-ec
19500 !! wikitext
19501 == -{Naslov}- ==
19502 !! html
19503 <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>
19504
19505 !! end
19506
19507
19508 !! test
19509 Explicit definition of language variant alternatives
19510 !! options
19511 language=zh variant=zh-tw
19512 !! wikitext
19513 -{zh:China;zh-tw:Taiwan}-, not China
19514 !! html
19515 <p>Taiwan, not China
19516 </p>
19517 !! end
19518
19519
19520 !! test
19521 Conversion around HTML tags
19522 !! options
19523 language=sr variant=sr-ec
19524 !! wikitext
19525 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19526 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19527 !! html
19528 <p>
19529 <span title="ЛаCтин">ски</span>
19530 </p>
19531 !! end
19532
19533
19534 !! test
19535 Explicit session-wise language variant mapping (A flag and - flag)
19536 !! options
19537 language=zh variant=zh-tw
19538 !! wikitext
19539 Taiwan is not China.
19540 But -{A|zh:China;zh-tw:Taiwan}- is China,
19541 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19542 and -{China}- is China.
19543 !! html
19544 <p>Taiwan is not China.
19545 But Taiwan is Taiwan,
19546 (This should be stripped!)
19547 and China is China.
19548 </p>
19549 !! end
19550
19551 !! test
19552 Explicit session-wise language variant mapping (H flag for hide)
19553 !! options
19554 language=zh variant=zh-tw
19555 !! wikitext
19556 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19557 Taiwan is China.
19558 !! html
19559 <p>(This should be stripped!)
19560 Taiwan is Taiwan.
19561 </p>
19562 !! end
19563
19564 !! test
19565 Adding explicit conversion rule for title (T flag)
19566 !! options
19567 language=zh variant=zh-tw showtitle
19568 !! wikitext
19569 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19570 !! html
19571 Taiwan
19572 <p>Should be stripped!
19573 </p>
19574 !! end
19575
19576 !! test
19577 Testing that changing the language variant here in the tests actually works
19578 !! options
19579 language=zh variant=zh showtitle
19580 !! wikitext
19581 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19582 !! html
19583 China
19584 <p>Should be stripped!
19585 </p>
19586 !! end
19587
19588 !! test
19589 Recursive conversion of alt and title attrs shouldn't clear converter state
19590 !! options
19591 language=zh variant=zh-cn showtitle
19592 !! wikitext
19593 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19594 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19595 !! html
19596 China
19597 <p>
19598 Should be stripped<span title="Exclamation">!</span>
19599 </p>
19600 !! end
19601
19602 !! test
19603 Bug 24072: more test on conversion rule for title
19604 !! options
19605 language=zh variant=zh-tw showtitle
19606 !! wikitext
19607 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19608 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19609 !! html
19610 Taiwan
19611 <p>This should be stripped!
19612 This won't take interferes with the title rule.
19613 </p>
19614 !! end
19615
19616 !! test
19617 Partly disable title conversion if variant == main language code
19618 !! options
19619 language=zh variant=zh title=[[ZH]] showtitle
19620 !! wikitext
19621 -{T|zh-cn:CN;zh-tw:TW}-
19622 !! html
19623 ZH
19624 <p>
19625 </p>
19626 !! end
19627
19628 !! test
19629 Partly disable title conversion if variant == main language code, more
19630 !! options
19631 language=zh variant=zh title=[[ZH]] showtitle
19632 !! wikitext
19633 -{T|TW}-
19634 !! html
19635 ZH
19636 <p>
19637 </p>
19638 !! end
19639
19640 !! test
19641 Raw output of variant escape tags (R flag)
19642 !! options
19643 language=zh variant=zh-tw
19644 !! wikitext
19645 Raw: -{R|zh:China;zh-tw:Taiwan}-
19646 !! html
19647 <p>Raw: zh:China;zh-tw:Taiwan
19648 </p>
19649 !! end
19650
19651 !! test
19652 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19653 !! options
19654 language=zh variant=zh-cn
19655 !! input
19656 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19657 !! result
19658 <p>0
19659 </p>
19660 !! end
19661
19662 !! test
19663 Conversion rules from [numeric-only string] to [something else] (T48634)
19664 !! options
19665 language=zh variant=zh-cn
19666 !! input
19667 -{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
19668 !! result
19669 <p>D12345EE12345
19670 </p>
19671 !! end
19672
19673 !! test
19674 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19675 !! options
19676 language=zh variant=zh-cn
19677 !! input
19678 -{H|zh-cn:foo;zh-tw:;}-foobar
19679 !! result
19680 <p>foobar
19681 </p>
19682 !! end
19683
19684 !! test
19685 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19686 !! options
19687 language=zh variant=zh-cn
19688 !! input
19689 -{H|=>zh-cn:foo;}-foobar
19690 !! result
19691 <p>foobar
19692 </p>
19693 !! end
19694
19695 !! test
19696 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19697 !! options
19698 language=zh variant=zh-cn
19699 !! input
19700 -{H|}-foobar
19701 !! result
19702 <p>foobar
19703 </p>
19704 !! end
19705
19706 !! test
19707 Nested using of manual convert syntax
19708 !! options
19709 language=zh variant=zh-hk
19710 !! wikitext
19711 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19712 !! html
19713 <p>Nested: Hello Hong Kong!
19714 </p>
19715 !! end
19716
19717 !! test
19718 Proper conversion of text in external links
19719 !! options
19720 language=sr variant=sr-ec
19721 !! wikitext
19722 http://www.google.com
19723 gopher://www.google.com
19724 [http://www.google.com http://www.google.com]
19725 [gopher://www.google.com gopher://www.google.com]
19726 [https://www.google.com irc://www.google.com]
19727 [ftp://www.google.com www.google.com/ftp://dir]
19728 [//www.google.com www.google.com]
19729 !! html
19730 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19731 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19732 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19733 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19734 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19735 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19736 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19737 </p>
19738 !! end
19739
19740 !! test
19741 Do not convert roman numbers to language variants
19742 !! options
19743 language=sr variant=sr-ec
19744 !! wikitext
19745 Fridrih IV je car.
19746 !! html
19747 <p>Фридрих IV је цар.
19748 </p>
19749 !! end
19750
19751 !! test
19752 Unclosed language converter markup "-{"
19753 !! options
19754 language=sr
19755 !! wikitext
19756 -{T|hello
19757 !! html
19758 <p>-{T|hello
19759 </p>
19760 !! end
19761
19762 !! test
19763 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19764 !! options
19765 language=sr
19766 !! wikitext
19767 -{R|=&gt;}-
19768 !! html
19769 <p>=&gt;
19770 </p>
19771 !!end
19772
19773 !! test
19774 Don't break link parsing if language converter markup is in the caption.
19775 !! options
19776 language=sr variant=sr-ec
19777 !! wikitext
19778 [[Main Page|-{R|main page}-]]
19779 !! html
19780 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19781 </p>
19782 !! end
19783
19784 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19785 !! test
19786 Don't break image parsing if language converter markup is in the caption.
19787 !! options
19788 language=sr
19789 !! wikitext
19790 [[File:Foobar.jpg|-{R|caption}-]]
19791 !! html/parsoid
19792 <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>
19793 </p>
19794 !! end
19795
19796 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19797 !! test
19798 Don't break list handling if language converter markup is in the item.
19799 !! options
19800 language=zh variant=zh-cn
19801 !! wikitext
19802 ;-{zh-cn:AAA;zh-tw:BBB}-
19803 !! html/php
19804 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19805
19806 !! html/parsoid
19807 <dl><dt>AAA
19808 </dt></dl>
19809 !! end
19810
19811 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19812 !! test
19813 Don't break table handling if language converter markup is in the cell.
19814 !! options
19815 language=sr variant=sr-ec
19816 !! wikitext
19817 {|
19818 |-
19819 | -{R|B}-
19820 |}
19821 !! html/php
19822 <table>
19823
19824 <tr>
19825 <td>Б}-
19826 </td></tr></table>
19827
19828 !! html/parsoid
19829 <table>
19830
19831 <tr>
19832 <td> B
19833 </td></tr></table>
19834
19835 !! end
19836
19837 !! test
19838 Bug 529: Uncovered bullet
19839 !! wikitext
19840 * Foo {{bullet}}
19841 !! html
19842 <ul><li> Foo </li>
19843 <li> Bar</li></ul>
19844
19845 !! end
19846
19847 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19848 # Templates in Wikipedia rely on this behavior, as tidy has always been
19849 # enabled there. These tests are normally run *without* tidy, so specify the
19850 # full output here.
19851 # To test realistic parsing behavior, apply a tidy-like transformation to both
19852 # the expected output and your parser's output.
19853 !! test
19854 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19855 !! wikitext
19856 ******* Foo {{bullet}}
19857 !! html
19858 <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>
19859 <li> Bar</li></ul>
19860
19861 !! end
19862
19863 !! test
19864 Bug 529: Uncovered table already at line-start
19865 !! wikitext
19866 x
19867
19868 {{table}}
19869 y
19870 !! html
19871 <p>x
19872 </p>
19873 <table>
19874 <tr>
19875 <td> 1 </td>
19876 <td> 2
19877 </td></tr>
19878 <tr>
19879 <td> 3 </td>
19880 <td> 4
19881 </td></tr></table>
19882 <p>y
19883 </p>
19884 !! end
19885
19886 !! test
19887 Bug 529: Uncovered bullet in parser function result
19888 !! wikitext
19889 * Foo {{lc:{{bullet}} }}
19890 !! html
19891 <ul><li> Foo </li>
19892 <li> bar</li></ul>
19893
19894 !! end
19895
19896 !! test
19897 Bug 5678: Double-parsed template argument
19898 !! wikitext
19899 {{lc:{{{1}}}|hello}}
19900 !! html
19901 <p>{{{1}}}
19902 </p>
19903 !! end
19904
19905 !! test
19906 Bug 5678: Double-parsed template invocation
19907 !! wikitext
19908 {{lc:{{paramtest {{!}} param = hello }} }}
19909 !! html
19910 <p>{{paramtest | param = hello }}
19911 </p>
19912 !! end
19913
19914 !! test
19915 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19916 !! options
19917 language=cs
19918 title=[[Main Page]]
19919 !! wikitext
19920 {{PRVNÍVELKÉ:ěščř}}
19921 {{prvnívelké:ěščř}}
19922 {{PRVNÍMALÉ:ěščř}}
19923 {{prvnímalé:ěščř}}
19924 {{MALÁ:ěščř}}
19925 {{malá:ěščř}}
19926 {{VELKÁ:ěščř}}
19927 {{velká:ěščř}}
19928 !! html
19929 <p>Ěščř
19930 Ěščř
19931 ěščř
19932 ěščř
19933 ěščř
19934 ěščř
19935 ĚŠČŘ
19936 ĚŠČŘ
19937 </p>
19938 !! end
19939
19940 !! test
19941 Morwen/13: Unclosed link followed by heading
19942 !! wikitext
19943 [[link
19944 ==heading==
19945 !! html
19946 <p>[[link
19947 </p>
19948 <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>
19949
19950 !! end
19951
19952 !! test
19953 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19954 !! wikitext
19955 {{foo|
19956 =heading=
19957 !! html
19958 <p>{{foo|
19959 </p>
19960 <h1><span class="mw-headline" id="heading">heading</span></h1>
19961
19962 !! end
19963
19964 !! test
19965 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19966 !! wikitext
19967 {{foo|
19968 ==heading==
19969 !! html
19970 <p>{{foo|
19971 </p>
19972 <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>
19973
19974 !! end
19975
19976 !! test
19977 Tildes in comments
19978 !! options
19979 pst
19980 !! wikitext
19981 <!-- ~~~~ -->
19982 !! html/php
19983 <!-- ~~~~ -->
19984 !! end
19985
19986 !! test
19987 Paragraphs inside divs (no extra line breaks)
19988 !! wikitext
19989 <div>Line one
19990
19991 Line two</div>
19992 !! html
19993 <div>Line one
19994 Line two</div>
19995
19996 !! end
19997
19998 !! test
19999 Paragraphs inside divs (extra line break on open)
20000 !! wikitext
20001 <div>
20002 Line one
20003
20004 Line two</div>
20005 !! html
20006 <div>
20007 <p>Line one
20008 </p>
20009 Line two</div>
20010
20011 !! end
20012
20013 !! test
20014 Paragraphs inside divs (extra line break on close)
20015 !! wikitext
20016 <div>Line one
20017
20018 Line two
20019 </div>
20020 !! html
20021 <div>Line one
20022 <p>Line two
20023 </p>
20024 </div>
20025
20026 !! end
20027
20028 !! test
20029 Paragraphs inside divs (extra line break on open and close)
20030 !! wikitext
20031 <div>
20032 Line one
20033
20034 Line two
20035 </div>
20036 !! html
20037 <div>
20038 <p>Line one
20039 </p><p>Line two
20040 </p>
20041 </div>
20042
20043 !! end
20044
20045 !! test
20046 Nesting tags, paragraphs on lines which begin with <div>
20047 !! wikitext
20048 <div></div><strong>A
20049 B</strong>
20050 !! html/php+tidy
20051 <p><strong>A</strong></p>
20052 <p><strong>B</strong></p>
20053 !! html/parsoid
20054 <div></div>
20055 <p><strong>A
20056 B</strong>
20057 </p>
20058 !! end
20059
20060 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20061 !! test
20062 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20063 !! wikitext
20064 <blockquote>Line one
20065
20066 Line two</blockquote>
20067 !! html
20068 <blockquote>Line one
20069 Line two</blockquote>
20070
20071 !! html+tidy
20072 <blockquote>
20073 <p>Line one Line two</p>
20074 </blockquote>
20075 !! end
20076
20077 !! test
20078 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20079 !! wikitext
20080 <blockquote>
20081 Line one
20082
20083 Line two</blockquote>
20084 !! html
20085 <blockquote>
20086 <p>Line one
20087 </p>
20088 Line two</blockquote>
20089
20090 !! html+tidy
20091 <blockquote>
20092 <p>Line one</p>
20093 Line two</blockquote>
20094 !! end
20095
20096 !! test
20097 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20098 !! wikitext
20099 <blockquote>Line one
20100
20101 Line two
20102 </blockquote>
20103 !! html
20104 <blockquote>Line one
20105 <p>Line two
20106 </p>
20107 </blockquote>
20108
20109 !! html+tidy
20110 <blockquote>
20111 <p>Line one</p>
20112 <p>Line two</p>
20113 </blockquote>
20114 !! end
20115
20116 !! test
20117 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20118 !! wikitext
20119 <blockquote>
20120 Line one
20121
20122 Line two
20123 </blockquote>
20124 !! html
20125 <blockquote>
20126 <p>Line one
20127 </p><p>Line two
20128 </p>
20129 </blockquote>
20130
20131 !! html+tidy
20132 <blockquote>
20133 <p>Line one</p>
20134 <p>Line two</p>
20135 </blockquote>
20136 !! end
20137
20138 !! test
20139 Paragraphs inside blockquotes/divs (no extra line breaks)
20140 !! wikitext
20141 <blockquote><div>Line one
20142
20143 Line two</div></blockquote>
20144 !! html
20145 <blockquote><div>Line one
20146 Line two</div></blockquote>
20147
20148 !! end
20149
20150 !! test
20151 Paragraphs inside blockquotes/divs (extra line break on open)
20152 !! wikitext
20153 <blockquote><div>
20154 Line one
20155
20156 Line two</div></blockquote>
20157 !! html
20158 <blockquote><div>
20159 <p>Line one
20160 </p>
20161 Line two</div></blockquote>
20162
20163 !! end
20164
20165 !! test
20166 Paragraphs inside blockquotes/divs (extra line break on close)
20167 !! wikitext
20168 <blockquote><div>Line one
20169
20170 Line two
20171 </div></blockquote>
20172 !! html
20173 <blockquote><div>Line one
20174 <p>Line two
20175 </p>
20176 </div></blockquote>
20177
20178 !! end
20179
20180 !! test
20181 Paragraphs inside blockquotes/divs (extra line break on open and close)
20182 !! wikitext
20183 <blockquote><div>
20184 Line one
20185
20186 Line two
20187 </div></blockquote>
20188 !! html
20189 <blockquote><div>
20190 <p>Line one
20191 </p><p>Line two
20192 </p>
20193 </div></blockquote>
20194
20195 !! end
20196
20197 !! test
20198 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20199 !! options
20200 wgLinkHolderBatchSize=0
20201 !! wikitext
20202 [[meatball:1]]
20203 [[meatball:2]]
20204 [[meatball:3]]
20205 !! html
20206 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20207 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20208 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20209 </p>
20210 !! end
20211
20212 !! test
20213 Free external link invading image caption
20214 !! wikitext
20215 [[Image:Foobar.jpg|thumb|http://x|hello]]
20216 !! html
20217 <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>
20218
20219 !! end
20220
20221 !! test
20222 Bug 15196: localised external link numbers
20223 !! options
20224 language=fa
20225 !! wikitext
20226 [http://en.wikipedia.org/]
20227 !! html/php
20228 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20229 </p>
20230 !! html/parsoid
20231 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20232 !! end
20233
20234 !! test
20235 Multibyte character in padleft
20236 !! wikitext
20237 {{padleft:-Hello|7|Æ}}
20238 !! html
20239 <p>Æ-Hello
20240 </p>
20241 !! end
20242
20243 !! test
20244 Multibyte character in padright
20245 !! wikitext
20246 {{padright:Hello-|7|Æ}}
20247 !! html
20248 <p>Hello-Æ
20249 </p>
20250 !! end
20251
20252 !!test
20253 formatdate parser function
20254 !! wikitext
20255 {{#formatdate:2009-03-24}}
20256 !! html
20257 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20258 </p>
20259 !! end
20260
20261 !!test
20262 formatdate parser function, with default format
20263 !! wikitext
20264 {{#formatdate:2009-03-24|mdy}}
20265 !! html
20266 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20267 </p>
20268 !! end
20269
20270 !! test
20271 Spacing of numbers in formatted dates
20272 !! wikitext
20273 {{#formatdate:January 15}}
20274 !! html
20275 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20276 </p>
20277 !! end
20278
20279 !! test
20280 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
20281 !! options
20282 language=nl title=[[MediaWiki:Common.css]]
20283 !! wikitext
20284 {{#formatdate:2009-03-24|dmy}}
20285 !! html
20286 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20287 </p>
20288 !! end
20289
20290 #
20291 #
20292 #
20293
20294 #
20295 # Edit comments
20296 #
20297
20298 !! test
20299 Edit comment with link
20300 !! options
20301 comment
20302 !! wikitext
20303 I like the [[Main Page]] a lot
20304 !! html/php
20305 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20306 !!end
20307
20308 !! test
20309 Edit comment with link and link text
20310 !! options
20311 comment
20312 !! wikitext
20313 I like the [[Main Page|best pages]] a lot
20314 !! html/php
20315 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20316 !!end
20317
20318 !! test
20319 Edit comment with link and link text with suffix
20320 !! options
20321 comment
20322 !! wikitext
20323 I like the [[Main Page|best page]]s a lot
20324 !! html/php
20325 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20326 !!end
20327
20328 !! test
20329 Edit comment with section link (non-local, eg in history list)
20330 !! options
20331 comment title=[[Main Page]]
20332 !! wikitext
20333 /* External links */ removed bogus entries
20334 !! html/php
20335 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20336 !!end
20337
20338 !! test
20339 Edit comment with section link and text before it (non-local, eg in history list)
20340 !! options
20341 comment title=[[Main Page]]
20342 !! wikitext
20343 pre-comment text /* External links */ removed bogus entries
20344 !! html/php
20345 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>
20346 !!end
20347
20348 !! test
20349 Edit comment with section link (local, eg in diff view)
20350 !! options
20351 comment local title=[[Main Page]]
20352 !! wikitext
20353 /* External links */ removed bogus entries
20354 !! html/php
20355 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20356 !!end
20357
20358 !! test
20359 Edit comment with subpage link (bug 14080)
20360 !! options
20361 comment
20362 subpage
20363 title=[[Subpage test]]
20364 !! wikitext
20365 Poked at a [[/subpage]] here...
20366 !! html/php
20367 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20368 !!end
20369
20370 !! test
20371 Edit comment with subpage link and link text (bug 14080)
20372 !! options
20373 comment
20374 subpage
20375 title=[[Subpage test]]
20376 !! wikitext
20377 Poked at a [[/subpage|neat little page]] here...
20378 !! html/php
20379 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20380 !!end
20381
20382 !! test
20383 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20384 !! options
20385 comment
20386 title=[[Subpage test]]
20387 !! wikitext
20388 Poked at a [[/subpage]] here...
20389 !! html/php
20390 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...
20391 !!end
20392
20393 !! test
20394 Edit comment with bare anchor link (local, as on diff)
20395 !! options
20396 comment
20397 local
20398 title=[[Main Page]]
20399 !! wikitext
20400 [[#section]]
20401 !! html/php
20402 <a href="#section">#section</a>
20403 !! end
20404
20405 !! test
20406 Edit comment with bare anchor link (non-local, as on history)
20407 !! options
20408 comment
20409 title=[[Main Page]]
20410 !! wikitext
20411 [[#section]]
20412 !! html/php
20413 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20414 !! end
20415
20416 !! test
20417 Anchor starting with underscore
20418 !! options
20419 title=[[Foo]]
20420 !! wikitext
20421 [[#_ref|One]]
20422 !! html/php
20423 <p><a href="#_ref">One</a>
20424 </p>
20425 !! html/parsoid
20426 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20427 !! end
20428
20429 !! test
20430 Id starting with underscore
20431 !! wikitext
20432 <div id="_ref"></div>
20433 !! html/*
20434 <div id="_ref"></div>
20435
20436 !! end
20437
20438 !! test
20439 Space normalisation on autocomment (bug 22784)
20440 !! options
20441 comment
20442 title=[[Main Page]]
20443 !! wikitext
20444 /* __hello__world__ */
20445 !! html/php
20446 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20447 !! end
20448
20449 !! test
20450 percent-encoding and + signs in comments (Bug 26410)
20451 !! options
20452 comment
20453 !! wikitext
20454 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20455 !! html/php
20456 <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>
20457 !! end
20458
20459 # Parsoid doesn't support this yet: see bug 73581
20460 # but it *should* omit the 'src' attribute if the image is bad.
20461 # PHP side of tests was disabled in
20462 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20463 # because of issues in the PHP parserTests infrastructure
20464 # (but the output below is indeed what the PHP side emits)
20465 !! test
20466 Bad images - basic functionality
20467 !! wikitext
20468 [[File:Bad.jpg]]
20469 !! DISABLED/html/php
20470 !! html/parsoid
20471 <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>
20472 !! end
20473
20474 !! test
20475 Bad images - bug 16039: text after bad image disappears
20476 !! wikitext
20477 Foo bar
20478 [[File:Bad.jpg]]
20479 Bar foo
20480 !! DISABLED/html/php
20481 <p>Foo bar
20482 </p><p>Bar foo
20483 </p>
20484 !! html/parsoid
20485 <p>Foo bar
20486 <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>
20487 Bar foo</p>
20488 !! end
20489
20490 !! test
20491 Verify that displaytitle works (bug #22501) no displaytitle
20492 !! options
20493 showtitle
20494 !! config
20495 wgAllowDisplayTitle=true
20496 wgRestrictDisplayTitle=false
20497 !! wikitext
20498 this is not the the title
20499 !! html/php
20500 Parser test
20501 <p>this is not the the title
20502 </p>
20503 !! end
20504
20505 !! test
20506 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20507 !! options
20508 showtitle
20509 title=[[Screen]]
20510 !! config
20511 wgAllowDisplayTitle=true
20512 wgRestrictDisplayTitle=false
20513 !! wikitext
20514 this is not the the title
20515 {{DISPLAYTITLE:whatever}}
20516 !! html/php
20517 whatever
20518 <p>this is not the the title
20519 </p>
20520 !! end
20521
20522 !! test
20523 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20524 !! options
20525 showtitle
20526 title=[[Screen]]
20527 !! config
20528 wgAllowDisplayTitle=true
20529 wgRestrictDisplayTitle=true
20530 !! wikitext
20531 this is not the the title
20532 {{DISPLAYTITLE:whatever}}
20533 !! html/php
20534 Screen
20535 <p>this is not the the title
20536 </p>
20537 !! end
20538
20539 !! test
20540 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20541 !! options
20542 showtitle
20543 title=[[Screen]]
20544 !! config
20545 wgAllowDisplayTitle=true
20546 wgRestrictDisplayTitle=true
20547 !! wikitext
20548 this is not the the title
20549 {{DISPLAYTITLE:screen}}
20550 !! html/php
20551 screen
20552 <p>this is not the the title
20553 </p>
20554 !! end
20555
20556 !! test
20557 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20558 !! options
20559 showtitle
20560 title=[[Screen]]
20561 !! config
20562 wgAllowDisplayTitle=false
20563 !! wikitext
20564 this is not the the title
20565 {{DISPLAYTITLE:screen}}
20566 !! html/php
20567 Screen
20568 <p>this is not the the title
20569 <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>
20570 </p>
20571 !! end
20572
20573 !! test
20574 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20575 !! options
20576 showtitle
20577 title=[[Screen]]
20578 !! config
20579 wgAllowDisplayTitle=false
20580 !! wikitext
20581 this is not the the title
20582 !! html/php
20583 Screen
20584 <p>this is not the the title
20585 </p>
20586 !! end
20587
20588 !! test
20589 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20590 !! options
20591 showtitle
20592 title=[[Screen]]
20593 !! config
20594 wgAllowDisplayTitle=true
20595 wgRestrictDisplayTitle=true
20596 !! wikitext
20597 this is not the the title
20598 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20599 !! html/php
20600 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20601 <p>this is not the the title
20602 </p>
20603 !! end
20604
20605 !! test
20606 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20607 !! options
20608 showtitle
20609 title=[[Screen]]
20610 !! config
20611 wgAllowDisplayTitle=true
20612 wgRestrictDisplayTitle=true
20613 !! wikitext
20614 this is not the the title
20615 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20616 !! html/php
20617 <span style="color: red;">s</span>creen
20618 <p>this is not the the title
20619 </p>
20620 !! end
20621
20622 !! test
20623 Page status indicators: Empty name is invalid
20624 !! options
20625 showindicators
20626 !! wikitext
20627 <indicator name=" "></indicator>
20628 <indicator></indicator>
20629 !! html
20630 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20631 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20632 </p>
20633 !! end
20634
20635 !! test
20636 Page status indicators: Weird syntaxes that are okay
20637 !! options
20638 showindicators
20639 !! wikitext
20640 <indicator name="empty" />
20641 <indicator name="name"></indicator>
20642 !! html
20643 empty=
20644 name=
20645 <p><br />
20646 </p>
20647 !! end
20648
20649 !! test
20650 Page status indicators: Torture test
20651 !! options
20652 showindicators
20653 !! wikitext
20654 <indicator name="01">hello world</indicator>
20655 <indicator name="02">[[Main Page]]</indicator>
20656 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20657 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20658 <indicator name="05">* foo
20659 * bar</indicator>
20660 <indicator name="06"><nowiki>foo</nowiki></indicator>
20661 <indicator name="07"> Preformatted</indicator>
20662 <indicator name="08"><div>Broken tag</indicator>
20663 <indicator name="09">{| class=wikitable
20664 | cell
20665 |}</indicator>
20666 <indicator name="10">Two
20667
20668 paragraphs</indicator>
20669 !! html
20670 01=hello world
20671 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20672 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" />
20673 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>
20674 05=<ul><li> foo</li>
20675 <li> bar</li></ul>
20676
20677 06=foo
20678 07=<pre>Preformatted
20679 </pre>
20680 08=<div>Broken tag</div>
20681
20682 09=<table class="wikitable">
20683 <tr>
20684 <td> cell
20685 </td></tr></table>
20686
20687 10=<p>Two
20688 </p><p>paragraphs
20689 </p>
20690 <p><br />
20691 </p><p><br />
20692 </p><p><br />
20693 </p><p><br />
20694 </p><p><br />
20695 </p>
20696 !! end
20697
20698 !! test
20699 preload: check <noinclude> and <includeonly>
20700 !! options
20701 preload
20702 !! wikitext
20703 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20704 !! html/php
20705 Hello kind world.
20706 !! end
20707
20708 !! test
20709 preload: check <onlyinclude>
20710 !! options
20711 preload
20712 !! wikitext
20713 Goodbye <onlyinclude>Hello world</onlyinclude>
20714 !! html/php
20715 Hello world
20716 !! end
20717
20718 !! test
20719 preload: can pass tags through if we want to
20720 !! options
20721 preload
20722 !! wikitext
20723 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20724 !! html/php
20725 <includeonly>Hello world</includeonly>
20726 !! end
20727
20728 !! test
20729 preload: check that it doesn't try to do tricks
20730 !! options
20731 preload
20732 !! wikitext
20733 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20734 !! html/php
20735 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20736 !! end
20737
20738 !! test
20739 Play a bit with r67090 and bug 3158
20740 !! wikitext
20741 <div style="width:50% !important">&nbsp;</div>
20742 <div style="width:50%&nbsp;!important">&nbsp;</div>
20743 <div style="width:50%&#160;!important">&nbsp;</div>
20744 <div style="border : solid;">&nbsp;</div>
20745 !! html/php
20746 <div style="width:50% !important">&#160;</div>
20747 <div style="width:50% !important">&#160;</div>
20748 <div style="width:50% !important">&#160;</div>
20749 <div style="border&#160;: solid;">&#160;</div>
20750
20751 !! html/parsoid
20752 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20753 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;nbsp;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20754 <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>
20755 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20756
20757 !! end
20758
20759 !! test
20760 HTML5 data attributes
20761 !! wikitext
20762 <span data-foo="bar">Baz</span>
20763 <p data-abc-def_hij="">Quuz</p>
20764 !! html/php
20765 <p><span data-foo="bar">Baz</span>
20766 </p>
20767 <p data-abc-def_hij="">Quuz</p>
20768
20769 !! html/parsoid
20770 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20771 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20772 !! end
20773
20774 !! test
20775 Strip reserved data attributes
20776 !! wikitext
20777 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20778 !! html/php
20779 <div data-ok="fred">d</div>
20780
20781 !! html/parsoid
20782 <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>
20783 !! end
20784
20785 !! test
20786 percent-encoding and + signs in internal links (Bug 26410)
20787 !! wikitext
20788 [[User:+%]] [[Page+title%]]
20789 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20790 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20791 [[%33%45]] [[%33%45+]]
20792 !! html/php
20793 <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>
20794 <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>
20795 <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>
20796 <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>
20797 </p>
20798 !! html/parsoid
20799 <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>
20800 <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>
20801 <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>
20802 <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>
20803 !! end
20804
20805 !! test
20806 Special characters in embedded file links (bug 27679)
20807 !! wikitext
20808 [[File:Contains & ampersand.jpg]]
20809 [[File:Does not exist.jpg|Title with & ampersand]]
20810 !! html/php
20811 <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>
20812 <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>
20813 </p>
20814 !! html/parsoid
20815 <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>
20816 <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>
20817 !! end
20818
20819 !! test
20820 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20821 !! wikitext
20822 Text&apos;s been normalized?
20823 !! html
20824 <p>Text&#39;s been normalized?
20825 </p>
20826 !! end
20827
20828 !! test
20829 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20830 !! wikitext
20831 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20832 !! html
20833 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20834 </p>
20835 !! end
20836
20837 !! test
20838 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20839 !! wikitext
20840 [http://www.example.org/ ideograms]
20841 !! html
20842 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20843 </p>
20844 !! end
20845
20846 !! test
20847 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20848 !! wikitext
20849 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20850 !! html
20851 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20852 </p>
20853 !! end
20854
20855 !! article
20856 Mediawiki:loop1
20857 !! text
20858 {{Identical|A}}
20859 !! endarticle
20860
20861 !! article
20862 Mediawiki:loop2
20863 !! text
20864 {{Identical|B}}
20865 !! endarticle
20866
20867 !! article
20868 Template:Identical
20869 !! text
20870 {{int:loop1}}
20871 {{int:loop2}}
20872 !! endarticle
20873
20874 !! test
20875 Bug 31098 Template which includes system messages which includes the template
20876 !! wikitext
20877 {{Identical}}
20878 !! html
20879 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20880 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20881 </p>
20882 !! end
20883
20884 !! test
20885 Bug31490 Turkish: ucfirst 'blah'
20886 !! options
20887 language=tr
20888 !! wikitext
20889 {{ucfirst:blah}}
20890 !! html
20891 <p>Blah
20892 </p>
20893 !! end
20894
20895 !! test
20896 Bug31490 Turkish: ucfirst 'ix'
20897 !! options
20898 language=tr
20899 !! wikitext
20900 {{ucfirst:ix}}
20901 !! html
20902 <p>İx
20903 </p>
20904 !! end
20905
20906 !! test
20907 Bug31490 Turkish: lcfirst 'BLAH'
20908 !! options
20909 language=tr
20910 !! wikitext
20911 {{lcfirst:BLAH}}
20912 !! html
20913 <p>bLAH
20914 </p>
20915 !! end
20916
20917 !! test
20918 Bug31490 Turkish: ucfırst (with a dotless i)
20919 !! options
20920 language=tr
20921 !! wikitext
20922 {{ucfırst:blah}}
20923 !! html
20924 <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>
20925 </p>
20926 !! end
20927
20928 !! test
20929 Bug31490 ucfırst (with a dotless i) with English language
20930 !! options
20931 language=en
20932 !! wikitext
20933 {{ucfırst:blah}}
20934 !! html
20935 <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>
20936 </p>
20937 !! end
20938
20939 !! test
20940 Bug 26375: TOC with italics
20941 !! options
20942 title=[[Main Page]]
20943 !! wikitext
20944 __TOC__
20945 == ''Lost'' episodes ==
20946 !! html
20947 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20948 <ul>
20949 <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>
20950 </ul>
20951 </div>
20952
20953 <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>
20954
20955 !! end
20956
20957 !! test
20958 Bug 26375: TOC with bold
20959 !! options
20960 title=[[Main Page]]
20961 !! wikitext
20962 __TOC__
20963 == '''should be bold''' then normal text ==
20964 !! html
20965 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20966 <ul>
20967 <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>
20968 </ul>
20969 </div>
20970
20971 <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>
20972
20973 !! end
20974
20975 !! test
20976 Bug 33845: Headings become cursive in TOC when they contain an image
20977 !! options
20978 title=[[Main Page]]
20979 !! wikitext
20980 __TOC__
20981 == Image [[Image:foobar.jpg]] ==
20982 !! html
20983 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20984 <ul>
20985 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20986 </ul>
20987 </div>
20988
20989 <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>
20990
20991 !! end
20992
20993 !! test
20994 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20995 !! options
20996 title=[[Main Page]]
20997 !! wikitext
20998 __TOC__
20999 == <blockquote>Quote</blockquote> ==
21000 !! html
21001 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21002 <ul>
21003 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21004 </ul>
21005 </div>
21006
21007 <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>
21008
21009 !! html+tidy
21010 <p></p>
21011 <div id="toc" class="toc">
21012 <div id="toctitle">
21013 <h2>Contents</h2>
21014 </div>
21015 <ul>
21016 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21017 </ul>
21018 </div>
21019 <p></p>
21020 <h2><span class="mw-headline" id="Quote"></span></h2>
21021 <blockquote>
21022 <p><span class="mw-headline" id="Quote">Quote</span></p>
21023 </blockquote>
21024 <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>
21025 !! end
21026
21027 !! test
21028 Unclosed tags in TOC
21029 !! options
21030 title=[[Main Page]]
21031 !! wikitext
21032 __TOC__
21033 == Proof: 2 < 3 ==
21034 <small>Hanc marginis exiguitas non caperet.</small>
21035 QED
21036 !! html
21037 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21038 <ul>
21039 <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>
21040 </ul>
21041 </div>
21042
21043 <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>
21044 <p><small>Hanc marginis exiguitas non caperet.</small>
21045 QED
21046 </p>
21047 !! end
21048
21049 !! test
21050 Multiple tags in TOC
21051 !! wikitext
21052 __TOC__
21053 == <i>Foo</i> <b>Bar</b> ==
21054
21055 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21056 !! html
21057 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></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
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> <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>
21066
21067 !! html+tidy
21068 <p></p>
21069 <div id="toc" class="toc">
21070 <div id="toctitle">
21071 <h2>Contents</h2>
21072 </div>
21073 <ul>
21074 <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>
21075 <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>
21076 </ul>
21077 </div>
21078 <p></p>
21079 <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>
21080 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21081 <blockquote>
21082 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21083 </blockquote>
21084 <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>
21085 !! end
21086
21087 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21088 # html5 tag parsing.
21089 !! test
21090 Tags with parameters in TOC
21091 !! options
21092 parsoid=wt2html
21093 !! wikitext
21094 __TOC__
21095 == <sup class="in-h2">Hello</sup> ==
21096
21097 == <sup class="a > b">Evilbye</sup> ==
21098 !! html/php
21099 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21100 <ul>
21101 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21102 <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>
21103 </ul>
21104 </div>
21105
21106 <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>
21107 <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>
21108
21109 !! html/parsoid
21110 <meta property="mw:PageProp/toc" />
21111 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21112
21113 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21114 !! end
21115
21116 !! test
21117 span tags with directionality in TOC
21118 !! wikitext
21119 __TOC__
21120 == <span dir="ltr">C++</span> ==
21121
21122 == <span dir="rtl">זבנג!</span> ==
21123
21124 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21125
21126 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21127
21128 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21129 !! html
21130 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21131 <ul>
21132 <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>
21133 <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>
21134 <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>
21135 <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>
21136 <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>
21137 </ul>
21138 </div>
21139
21140 <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>
21141 <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>
21142 <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>
21143 <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>
21144 <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>
21145
21146 !! end
21147
21148 !! test
21149 Bug 72884: bdi element in ToC
21150 !! wikitext
21151 __TOC__
21152 == <bdi>test</bdi> ==
21153 !! html
21154 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21155 <ul>
21156 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21157 </ul>
21158 </div>
21159
21160 <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>
21161
21162 !! end
21163
21164 # Note that the html output does not have the <p></p>, but the
21165 # html+tidy output *does*. This is because the empty <p></p> is
21166 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21167 !! test
21168 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21169 !! wikitext
21170 __TOC__
21171 == x ==
21172 !! html
21173 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21174 <ul>
21175 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21176 </ul>
21177 </div>
21178
21179 <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>
21180
21181 !! html+tidy
21182 <p></p>
21183 <div id="toc" class="toc">
21184 <div id="toctitle">
21185 <h2>Contents</h2>
21186 </div>
21187 <ul>
21188 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21189 </ul>
21190 </div>
21191 <p></p>
21192 <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>
21193 !! end
21194
21195 !! article
21196 MediaWiki:Bug32057
21197 !! text
21198 == {{int:headline_sample}} ==
21199 !! endarticle
21200
21201 !! test
21202 Bug 32057: Title needed when expanding <h> nodes.
21203 !! options
21204 title=[[Main Page]]
21205 !! wikitext
21206 {{int:Bug32057}}
21207 !! html
21208 <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>
21209
21210 !! end
21211
21212 !! test
21213 Strip marker in urlencode
21214 !! wikitext
21215 {{urlencode:x<nowiki/>y}}
21216 {{urlencode:x<nowiki/>y|wiki}}
21217 {{urlencode:x<nowiki/>y|path}}
21218 {{urlencode:x<pre id="one">two</pre>y}}
21219 !! html
21220 <p>xy
21221 xy
21222 xy
21223 xy
21224 </p>
21225 !! end
21226
21227 !! test
21228 Strip marker in lc
21229 !! wikitext
21230 {{lc:x<nowiki/>y}}
21231 !! html
21232 <p>xy
21233 </p>
21234 !! end
21235
21236 !! test
21237 Strip marker in uc
21238 !! wikitext
21239 {{uc:x<nowiki/>y}}
21240 !! html
21241 <p>XY
21242 </p>
21243 !! end
21244
21245 !! test
21246 Strip marker in formatNum
21247 !! wikitext
21248 {{formatnum:1<nowiki/>2}}
21249 {{formatnum:1<nowiki/>2|R}}
21250 !! html
21251 <p>12
21252 12
21253 </p>
21254 !! end
21255
21256 !! test
21257 Check noCommafy in formatNum
21258 !! options
21259 language=be-tarask
21260 !! wikitext
21261 {{formatnum:123456.78}}
21262 {{formatnum:123456.78|NOSEP}}
21263 !! html
21264 <p>123 456,78
21265 123456.78
21266 </p>
21267 !! end
21268
21269 !! test
21270 Wrong option for formatNum (bug 56199)
21271 !! wikitext
21272 {{formatnum:1,234.56|Random}}
21273 {{formatnum:1,234.56|EVERYTHING}}
21274 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21275 !! html
21276 <p>1,234.56
21277 1,234.56
21278 1,234.56
21279 </p>
21280 !! end
21281
21282 !! test
21283 Strip marker in grammar
21284 !! options
21285 language=fi
21286 !! wikitext
21287 {{grammar:elative|foo<nowiki/>bar}}
21288 !! html
21289 <p>foobarista
21290 </p>
21291 !! end
21292
21293 !! test
21294 Strip marker in padleft
21295 !! wikitext
21296 {{padleft:|2|x<nowiki/>y}}
21297 !! html
21298 <p>xy
21299 </p>
21300 !! end
21301
21302 !! test
21303 Strip marker in padright
21304 !! wikitext
21305 {{padright:|2|x<nowiki/>y}}
21306 !! html
21307 <p>xy
21308 </p>
21309 !! end
21310
21311 !! test
21312 Strip marker in anchorencode
21313 !! wikitext
21314 {{anchorencode:x<nowiki/>y}}
21315 !! html
21316 <p>xy
21317 </p>
21318 !! end
21319
21320 !! test
21321 nowiki inside link inside heading (bug 18295)
21322 !! wikitext
21323 ==[[foo|x<nowiki>y</nowiki>z]]==
21324 !! html
21325 <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>
21326
21327 !! end
21328
21329 !! test
21330 new support for bdi element (bug 31817)
21331 !! wikitext
21332 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21333 !! html
21334 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21335
21336 !!end
21337
21338 !! test
21339 Ignore pipe between table row attributes
21340 !! wikitext
21341 {|
21342 | quux
21343 |- id=foo | style='color: red'
21344 | bar
21345 |}
21346 !! html
21347 <table>
21348 <tr>
21349 <td> quux
21350 </td></tr>
21351 <tr id="foo" style="color: red">
21352 <td> bar
21353 </td></tr></table>
21354
21355 !! end
21356
21357 !!test
21358 Gallery override link with WikiLink (bug 34852)
21359 !! wikitext
21360 <gallery>
21361 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21362 </gallery>
21363 !! html
21364 <ul class="gallery mw-gallery-traditional">
21365 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21366 <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>
21367 <div class="gallerytext">
21368 <p>caption
21369 </p>
21370 </div>
21371 </div></li>
21372 </ul>
21373
21374 !! end
21375
21376 !!test
21377 Gallery override link with absolute external link (bug 34852)
21378 !! wikitext
21379 <gallery>
21380 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21381 </gallery>
21382 !! html
21383 <ul class="gallery mw-gallery-traditional">
21384 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21385 <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>
21386 <div class="gallerytext">
21387 <p>caption
21388 </p>
21389 </div>
21390 </div></li>
21391 </ul>
21392
21393 !! end
21394
21395 !!test
21396 Gallery override link with malicious javascript (bug 34852)
21397 !! wikitext
21398 <gallery>
21399 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21400 </gallery>
21401 !! html
21402 <ul class="gallery mw-gallery-traditional">
21403 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21404 <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>
21405 <div class="gallerytext">
21406 <p>caption
21407 </p>
21408 </div>
21409 </div></li>
21410 </ul>
21411
21412 !! end
21413
21414 !!test
21415 Gallery with invalid title as link (bug 43964)
21416 !! wikitext
21417 <gallery>
21418 File:foobar.jpg|link=<
21419 </gallery>
21420 !! html
21421 <ul class="gallery mw-gallery-traditional">
21422 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21423 <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>
21424 <div class="gallerytext">
21425 </div>
21426 </div></li>
21427 </ul>
21428
21429 !! end
21430
21431 !!test
21432 Language parser function
21433 !! wikitext
21434 {{#language:ar}}
21435 !! html
21436 <p>العربية
21437 </p>
21438 !! end
21439
21440 !!test
21441 Padleft and padright as substr
21442 !! wikitext
21443 {{padleft:|3|abcde}}
21444 {{padright:|3|abcde}}
21445 !! html
21446 <p>abc
21447 abc
21448 </p>
21449 !! end
21450
21451 !!test
21452 Special parser function
21453 !! wikitext
21454 {{#special:RandomPage}}
21455 {{#special:BaDtItLe}}
21456 {{#special:Foobar}}
21457 !! html
21458 <p>Special:Random
21459 Special:Badtitle
21460 Special:Foobar
21461 </p>
21462 !! end
21463
21464 !!test
21465 Bug 34939 - Case insensitive link parsing ([HttP://])
21466 !! wikitext
21467 [HttP://MediaWiki.Org/]
21468 !! html/php
21469 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21470 </p>
21471 !! html/parsoid
21472 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21473 !! end
21474
21475 !!test
21476 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21477 !! wikitext
21478 [HttP://MediaWiki.Org/ MediaWiki]
21479 !! html
21480 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21481 </p>
21482 !! end
21483
21484 !!test
21485 Bug 34939 - Case insensitive link parsing (HttP://)
21486 !! wikitext
21487 HttP://MediaWiki.Org/
21488 !! html/php
21489 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21490 </p>
21491 !! html/parsoid
21492 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21493 !! end
21494
21495 !!test
21496 Disable TOC
21497 !! options
21498 notoc
21499 !! wikitext
21500 Lead
21501 == Section 1 ==
21502 == Section 2 ==
21503 == Section 3 ==
21504 == Section 4 ==
21505 == Section 5 ==
21506 !! html
21507 <p>Lead
21508 </p>
21509
21510 <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>
21511 <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>
21512 <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>
21513 <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>
21514 <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>
21515
21516 !! end
21517
21518
21519 ###
21520 ### Parsoid-specific tests
21521 ### Parsoid-PHP parser incompatibilities
21522 ###
21523 !!test
21524 1. SOL-sensitive wikitext tokens as template-args
21525 !!options
21526 parsoid=wt2html,wt2wt
21527 !! wikitext
21528 {{echo|*a}}
21529 {{echo|#a}}
21530 {{echo|:a}}
21531 !! html
21532 <span about="#mwt1" typeof="mw:Transclusion">
21533 </span><ul about="#mwt1"><li>a</li>
21534 </ul>
21535 <span about="#mwt2" typeof="mw:Transclusion">
21536 </span><ol about="#mwt2"><li>a</li>
21537 </ol>
21538 <span about="#mwt3" typeof="mw:Transclusion">
21539 </span><dl about="#mwt3"><dd>a</dd>
21540 </dl>
21541 !!end
21542
21543 #### -----------------------------------------------------------------
21544 #### Parsoid-specific functionality tests
21545 #### -----------------------------------------------------------------
21546
21547 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21548 # We know wt2wt will fail, but we expect selser to pass.
21549 # Due to the nature of our testing, wt2wt and selser tests will enter the
21550 # blacklist and we'll catch selser regressions based on changes to the
21551 # blacklist entries for selser tests.
21552 !! test
21553 1. Bad treebuilder fixup of formatting elt is cleaned up
21554 !! options
21555 parsoid=wt2html,wt2wt
21556 !! wikitext
21557 {|
21558 |
21559 <small>
21560 [[Image:Foobar.jpg|right|Test]]
21561 </small>
21562 |}
21563 !! html/parsoid
21564 <table>
21565 <tbody><tr><td>
21566 <small>
21567 <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>
21568 </small>
21569 </td></tr>
21570 </tbody></table>
21571 !! end
21572
21573 !! test
21574 2. Bad treebuilder fixup of formatting elt is cleaned up
21575 !! options
21576 parsoid=wt2html,wt2wt
21577 !! wikitext
21578 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21579
21580 <small>[[Image:Foobar.jpg|right|300px]]</small>
21581 !! html/parsoid
21582
21583 <p><b>foo</b></p>
21584 <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>
21585 <p><b>bar</b></p>
21586 <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>
21587 !! end
21588
21589 !! test
21590 3. Bad treebuilder fixup of formatting elt is cleaned up
21591 !! options
21592 parsoid=wt2html,wt2wt
21593 !! wikitext
21594 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21595 !! html/parsoid
21596 <p><small><b>foo</b></small></p>
21597 <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>
21598 <p><small><b>bar</b></small></p>
21599 !! end
21600
21601 !! test
21602 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21603 !! options
21604 parsoid=wt2html,wt2wt
21605 !! wikitext
21606 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21607 !! html/parsoid
21608 <p><b><small></small></b></p>
21609 <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>
21610 <p></p>
21611 !! end
21612
21613 #### ----------------------------------------------------------------
21614 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21615 #### tags. Parsoid's output for these tags differs from that of the
21616 #### PHP parser.
21617 #### ----------------------------------------------------------------
21618
21619 !!test
21620 Ref: 1. ref-location should be replaced with an index span
21621 !! wikitext
21622 A <ref>foo</ref>
21623 B <ref name="x">foo</ref>
21624 C <ref name="y" />
21625 <references />
21626 !! html/parsoid
21627 <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>
21628 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>
21629 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>
21630 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21631 <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>
21632 <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>
21633 <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>
21634 </ol>
21635 !!end
21636
21637 !!test
21638 Ref: 2. ref-tags with identical names should all get the same index
21639 !! wikitext
21640 A <ref name="x">foo</ref>
21641 B <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></p>
21646 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21647 <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>
21648 </ol>
21649 !!end
21650
21651 !!test
21652 Ref: 3. spaces in ref-names should be ignored
21653 !! wikitext
21654 A <ref name="x">foo</ref>
21655 B <ref name=" x " />
21656 C <ref name= x />
21657 <references />
21658 !! html/parsoid
21659 <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>
21660 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>
21661 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>
21662 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21663 <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>
21664 </ol>
21665 !!end
21666
21667 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21668 !!test
21669 Ref: 4. 'constructor' should be accepted as a valid ref-name
21670 !! wikitext
21671 A <ref name="constructor">foo</ref>
21672 <references />
21673 !! html/parsoid
21674 <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>
21675 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21676 <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>
21677 </ol>
21678 !!end
21679
21680 !!test
21681 Ref: 5. body should accept generic wikitext
21682 !! wikitext
21683 A <ref>
21684 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21685 </ref>
21686
21687 <references />
21688 !! html/parsoid
21689 <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>
21690
21691 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21692 <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>
21693 </span></li>
21694 </ol>
21695 !!end
21696
21697 !!test
21698 Ref: 6. indent-pres should not be output in ref-body
21699 !! wikitext
21700 A <ref>
21701 foo
21702 bar
21703 baz
21704 </ref>
21705
21706 <references />
21707 !! html/parsoid
21708 <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>
21709
21710 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21711 <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
21712 bar
21713 baz
21714 </span></li>
21715 </ol>
21716 !!end
21717
21718 !!test
21719 Ref: 7. No p-wrapping in ref-body
21720 !! wikitext
21721 A <ref>
21722 foo
21723
21724 bar
21725
21726
21727 baz
21728
21729
21730
21731 booz
21732 </ref>
21733
21734 <references />
21735 !! html/parsoid
21736 <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>
21737
21738 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21739 <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
21740
21741 bar
21742
21743
21744 baz
21745
21746
21747
21748 booz
21749 </span></li>
21750 </ol>
21751 !!end
21752
21753 !!test
21754 Ref: 8. transclusion wikitext has lower precedence
21755 !! wikitext
21756 A <ref> foo {{echo|</ref> B C}}
21757
21758 <references />
21759 !! html/parsoid
21760 <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>
21761 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21762 <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>
21763 </ol>
21764 !!end
21765
21766 !!test
21767 Ref: 9. unclosed comments should not leak out of ref-body
21768 !! wikitext
21769 A <ref> foo <!--</ref> B C
21770 <references />
21771 !! html/parsoid
21772 <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>
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">foo <!----></span></li>
21775 </ol>
21776 !!end
21777
21778 !!test
21779 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21780 !! wikitext
21781 A <ref> <b> foo </ref> B C
21782
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 C</p>
21786
21787
21788 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21789 <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>
21790 </ol>
21791 !!end
21792
21793 !!test
21794 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21795 !! wikitext
21796 A <ref>foo</ref> B
21797 C <ref>bar</ref> D
21798 <references />
21799 !! html/parsoid
21800 <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
21801 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>
21802 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21803 <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>
21804 <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>
21805 </ol>
21806 !!end
21807
21808 !!test
21809 Ref: 12. ref-tags act as trailing newline migration barrier
21810 !! wikitext
21811 <!--the newline at the end of this line moves out of the p tag-->a
21812
21813 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21814 <ref />
21815
21816 c
21817 <references />
21818 !! html/parsoid
21819 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21820
21821
21822 <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>
21823 <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>
21824
21825 <p>c</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"></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"></span></li></ol>
21829 !!end
21830
21831 !!test
21832 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21833 !! wikitext
21834 <ref>foo</ref> A
21835 <ref>bar
21836 </ref> B
21837 <references />
21838 !! html/parsoid
21839 <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
21840 <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>
21841 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21842 <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>
21843 <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
21844 </span></li>
21845 </ol>
21846 !!end
21847
21848 !!test
21849 Ref: 14. A nested ref-tag should be emitted as plain text
21850 !! wikitext
21851 <ref>foo <ref>bar</ref> baz</ref>
21852
21853 <references />
21854 !! html/parsoid
21855 <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>
21856 </p>
21857 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21858 <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>
21859 </ol>
21860 !!end
21861
21862 !!test
21863 Ref: 15. ref-tags with identical names should get identical indexes
21864 !! wikitext
21865 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21866 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21867
21868 <references />
21869 !! html/parsoid
21870 <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>
21871 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>
21872
21873 <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>
21874 </ol>
21875 !!end
21876
21877 ## We don't bother wt2wt-ing non-standard whitespace
21878 !!test
21879 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21880 !!options
21881 parsoid=wt2html
21882 !! wikitext
21883 A <ref >foo</ref >
21884
21885 <references />
21886 !! html/parsoid
21887 <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>
21888 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21889 <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>
21890 !!end
21891
21892 !!test
21893 Ref: 17. Generate valid HTML5 id/about attributes
21894 !!wikitext
21895 <ref name="a b">foo</ref>
21896
21897 <references />
21898 !!html/parsoid
21899 <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>
21900 </p>
21901
21902 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21903 <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>
21904 </ol>
21905 !!end
21906
21907 !!test
21908 Ref: 18. T58916: Extension attributes should be parsed as plain text
21909 !!wikitext
21910 <ref name="{{echo|a}}">foo</ref>
21911
21912 <references />
21913 !!html/parsoid
21914 <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>
21915 </p>
21916
21917 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21918 <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>
21919 </ol>
21920 !!end
21921
21922 !!test
21923 Ref: 19. ref-tags with identical name encodings should get identical indexes
21924 !! wikitext
21925 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21926
21927 <references />
21928 !! html/parsoid
21929 <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>
21930 </p>
21931 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21932 <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>
21933 </ol>
21934 !!end
21935
21936 !!test
21937 Ref: 20. ref-tags with identical names but different content should keep it
21938 !! wikitext
21939 A <ref name="foo">Foo one</ref>
21940 B <ref name="foo">Foo two</ref>
21941 C <ref name="foo" />
21942
21943 <references />
21944 !! html/parsoid
21945 <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>
21946 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>
21947 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>
21948
21949 <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>
21950 </ol>
21951 !!end
21952
21953 !!test
21954 References: 1. references tag without any refs should be handled properly
21955 !! wikitext
21956 <references />
21957 !! html/parsoid
21958 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21959 !!end
21960
21961 !!test
21962 References: 2. references tag with group only outputs references from that group
21963 !! wikitext
21964 A <ref group="a">foo</ref>
21965 B <ref group="b">bar</ref>
21966 C <ref>baz</ref>
21967
21968 <references group="a" />
21969 <references />
21970 <references group="b" />
21971 !! html/parsoid
21972 <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>
21973 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>
21974 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>
21975
21976 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21977 <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>
21978 </ol>
21979 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21980 <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>
21981 </ol>
21982 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21983 <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>
21984 </ol>
21985 !!end
21986
21987 !!test
21988 References: 3. ref list should be cleared after processing references
21989 !! wikitext
21990 A <ref>foo</ref>
21991
21992 <references />
21993
21994 B <ref>bar</ref>
21995
21996 <references />
21997 !! html/parsoid
21998 <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>
21999
22000 <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>
22001 </ol>
22002
22003 <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>
22004
22005 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22006 <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>
22007 </ol>
22008 !!end
22009
22010 !!test
22011 References: 4. only referenced group should be cleared after processing references
22012 !! wikitext
22013 A <ref group="a">afoo</ref>
22014 B <ref>bfoo</ref>
22015
22016 <references group="a" />
22017
22018 C <ref>cfoo</ref>
22019
22020 <references />
22021 !! html/parsoid
22022 <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>
22023 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>
22024
22025 <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>
22026 </ol>
22027
22028 <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>
22029
22030 <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>
22031 </ol>
22032 !!end
22033
22034 !!test
22035 References: 5. ref tags in references should be processed while ignoring all other content
22036 !! wikitext
22037 A <ref name="a" />
22038 B <ref name="b">bar</ref>
22039
22040 <references>
22041 <ref name="a">foo</ref>
22042 This should just get lost.
22043 </references>
22044 !! html/parsoid
22045 <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>
22046 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>
22047
22048
22049 <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>
22050 </ol>
22051 !!end
22052
22053 !!test
22054 References: 6. <references /> from a transclusion
22055 !! wikitext
22056 <ref>Foo</ref> {{echo|<references />}}
22057 !! html/parsoid
22058 <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>
22059 </ol>
22060 !!end
22061
22062 !! test
22063 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22064 !! wikitext
22065 A <ref>foo bar for a</ref>
22066 B <ref group="X" name="b" />
22067
22068 <references />
22069
22070 <references group="X">
22071 <ref name="b">foo</ref>
22072 </references>
22073 !! html/parsoid
22074 <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>
22075 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>
22076 </p>
22077
22078 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22079 <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>
22080 </ol>
22081
22082 <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"}}'>
22083 <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>
22084 </ol>
22085 !! end
22086
22087 !! test
22088 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22089 !! wikitext
22090 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22091 <references />
22092 !! html/parsoid
22093 <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>
22094 <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>
22095 </ol>
22096 !!end
22097
22098 # This test only works in wt2html now as the <references /> are always generated
22099 # unless selser is active. Once T72722 is fixed, we should add a changes test
22100 # here to ensure that unrelated changes don't add the new <references /> in
22101 # wt2wt.
22102 !! test
22103 References: 9. Generate missing references list at the end
22104 !! wikitext
22105 A <ref>foo</ref>
22106 B <ref group="inexistent">bar</ref>
22107 !! html/parsoid
22108 <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>
22109 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22110 <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>
22111 </ol>
22112 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22113 <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>
22114 </ol>
22115 !! end
22116
22117 !! test
22118 References: 10. New <references/> shouldn't be added for unrelated edits.
22119 !! options
22120 parsoid={
22121 "modes": ["selser"],
22122 "changes": [["#x", "remove"]],
22123 "selser": "noauto"
22124 }
22125 !! wikitext
22126 Unrelated text<span id="x"> that's going to disappear</span>.
22127 A <ref>foo</ref>
22128 !! wikitext/edited
22129 Unrelated text.
22130 A <ref>foo</ref>
22131 !!end
22132
22133 !! test
22134 Entities in ref name
22135 !! wikitext
22136 <ref name="test &amp; me">hi</ref>
22137 <references />
22138 !! html/parsoid
22139 <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>
22140 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22141 <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>
22142 </ol>
22143 !! end
22144
22145 # This test is wt2html only because we're permitting the serializer to produce
22146 # dirty diffs, normalizing the unclosed references to the self-closed version.
22147 !! test
22148 Generate references for unclosed references tag
22149 !! options
22150 parsoid=wt2html
22151 !! wikitext
22152 a<ref>foo</ref>
22153
22154 <references>
22155 !! html/parsoid
22156 <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>
22157 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22158 <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>
22159 !! end
22160
22161 !! test
22162 New reference serializes on its own line
22163 !! options
22164 parsoid=wt2wt,html2wt
22165 !! wikitext
22166 foo
22167 <references />
22168 !! html/parsoid
22169 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22170 !! end
22171
22172 #### ----------------------------------------------------------------
22173 #### Parsoid-only testing of Parsoid's impl of LST
22174 #### Not implemented yet, see
22175 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22176 #### ----------------------------------------------------------------
22177
22178 !! test
22179 LST Sections: 1. Simple section start and end
22180 !! options
22181 parsoid={ "suppressErrors": true }
22182 !! wikitext
22183 <section begin="2011-05-16" />
22184 <section end="2014-04-10 (MW 1.23wmf22)" />
22185 !! html/parsoid
22186 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22187 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22188 !! end
22189
22190 #--------- Test stripping of empty nodes in template content ----------
22191 !!test
22192 Empty LI and TR nodes should be stripped from template content
22193 !!wikitext
22194 {{EmptyLITest}}
22195 {{EmptyTRTest}}
22196 !!html/parsoid
22197 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22198 <li>a</li>
22199 <li>b</li>
22200 </ul>
22201 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22202 <tbody>
22203 <tr>
22204 <td>foo</td>
22205 </tr>
22206 <tr>
22207 <td>bar</td>
22208 </tr>
22209 </tbody>
22210 </table>
22211 !!end
22212
22213 !!test
22214 Empty LI and TR nodes should not be stripped from top-level content
22215 !!wikitext
22216 * a
22217 *
22218 * b
22219 {|
22220 |-
22221 |-
22222 |foo
22223 |}
22224 !!html/parsoid
22225 <ul>
22226 <li> a</li>
22227 <li></li>
22228 <li> b</li>
22229 </ul>
22230 <table>
22231 <tbody>
22232 <tr></tr>
22233 <tr>
22234 <td>foo</td>
22235 </tr>
22236 </tbody>
22237 </table>
22238 !!end
22239
22240 !!test
22241 Empty TR nodes should not be stripped if they have any attributes set
22242 !!wikitext
22243 {{EmptyTRWithHTMLAttrTest}}
22244 !!html/parsoid
22245 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22246 <tr align="center"></tr>
22247 <tr><td>foo</td></tr>
22248 <tr align="center"></tr>
22249 <tr><td>bar</td></tr>
22250 </table>
22251 !!end
22252
22253 #### ----------------------------------------------------------------
22254 #### The following section of tests are primarily to test
22255 #### wikitext escaping capabilities of Parsoid. Given that
22256 #### escaping can be done any number of ways, the wikitext (input)
22257 #### is always adjusted to reflect how Parsoid adds nowiki
22258 #### escape tags.
22259 ####
22260 #### We are marking several tests as parsoid-only since the
22261 #### HTML in the result section is different from what the
22262 #### PHP parser generates for it.
22263 #### ----------------------------------------------------------------
22264
22265
22266 #### --------------- Headings ---------------
22267 #### 0. Unnested
22268 #### 1. Nested inside html <h1>=foo=</h1>
22269 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22270 #### 3. Nested inside html with wikitext split by html tags
22271 #### 4. No escape needed
22272 #### 5. Empty headings <h1></h1>
22273 #### 6. Heading chars in SOL context
22274 #### ----------------------------------------
22275 !! test
22276 Headings: 0. Unnested
22277 !! options
22278 parsoid=html2wt
22279 !! html/parsoid
22280 <p>=foo=</p>
22281
22282 <p> =foo=
22283 <!--cmt-->
22284 =foo=</p>
22285
22286 <p>=foo<i>a</i>=</p>
22287 !! wikitext
22288 <nowiki>=foo=</nowiki>
22289
22290 <nowiki> </nowiki>=foo=
22291 <!--cmt-->
22292 <nowiki>=foo=</nowiki>
22293
22294 =foo''a''<nowiki>=</nowiki>
22295 !!end
22296
22297 # New headings and existing headings are handled differently
22298 !! test
22299 Headings: 1. Nested inside html
22300 !! options
22301 parsoid=html2wt
22302 !! html/parsoid
22303 <h1>=foo=</h1>
22304 <h2>=foo=</h2>
22305 <h3>=foo=</h3>
22306
22307 <h1 data-parsoid=''>=foo=</h1>
22308 <h2 data-parsoid=''>=foo=</h2>
22309 <h3 data-parsoid=''>=foo=</h3>
22310 <h4 data-parsoid=''>=foo=</h4>
22311 <h5 data-parsoid=''>=foo=</h5>
22312 <h6 data-parsoid=''>=foo=</h6>
22313 !! wikitext
22314 = =foo= =
22315
22316 == =foo= ==
22317
22318 === =foo= ===
22319
22320 =<nowiki>=foo=</nowiki>=
22321 ==<nowiki>=foo=</nowiki>==
22322 ===<nowiki>=foo=</nowiki>===
22323 ====<nowiki>=foo=</nowiki>====
22324 =====<nowiki>=foo=</nowiki>=====
22325 ======<nowiki>=foo=</nowiki>======
22326
22327 !!end
22328
22329 !! test
22330 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22331 !! options
22332 parsoid=html2wt
22333 !! html/parsoid
22334 <h1>foo</h1>*bar
22335 <h1>foo</h1>=bar
22336 <h1>foo</h1>=bar=
22337 !! wikitext
22338 = foo =
22339 <nowiki>*</nowiki>bar
22340
22341 = foo =
22342 =bar
22343
22344 = foo =
22345 <nowiki>=bar=</nowiki>
22346 !!end
22347
22348 !! test
22349 Headings: 3. Nested inside html with wikitext split by html tags
22350 !! options
22351 parsoid=html2wt
22352 !! html/parsoid
22353 <h1>=<b>bold</b>foo=</h1>
22354 !! wikitext
22355 = ='''bold'''<nowiki>foo=</nowiki> =
22356 !!end
22357
22358 !! test
22359 Headings: 4a. No escaping needed (testing just h1 and h2)
22360 !! options
22361 parsoid=html2wt
22362 !! html/parsoid
22363 <h1>=foo</h1>
22364 <h1>foo=</h1>
22365 <h1> =foo= </h1>
22366 <h1>=foo= bar</h1>
22367 <h2>=foo</h2>
22368 <h2>foo=</h2>
22369 <h1>=</h1>
22370 <h1><i>=</i>foo=</h1>
22371 !! wikitext
22372 = =foo =
22373
22374 = foo= =
22375
22376 = =foo= =
22377
22378 = =foo= bar =
22379
22380 == =foo ==
22381
22382 == foo= ==
22383
22384 = = =
22385
22386 = ''=''foo= =
22387 !!end
22388
22389 !! test
22390 Headings: 4b. No escaping needed (inside p-tags)
22391 !! options
22392 parsoid=html2wt
22393 !! html/parsoid
22394 <p>===
22395 =foo= x
22396 =foo= <s></s>
22397 </p>
22398 !! wikitext
22399 ===
22400 =foo= x
22401 =foo= <s></s>
22402 !!end
22403
22404 !! test
22405 Headings: 5. Empty headings
22406 !! options
22407 parsoid=html2wt
22408 !! html/parsoid
22409 <h1 data-parsoid='{}'></h1>
22410
22411 <h2 data-parsoid='{}'></h2>
22412
22413 <h3 data-parsoid='{}'></h3>
22414
22415 <h4 data-parsoid='{}'></h4>
22416
22417 <h5 data-parsoid='{}'></h5>
22418
22419 <h6 data-parsoid='{}'></h6>
22420 !! wikitext
22421 =<nowiki/>=
22422
22423 ==<nowiki/>==
22424
22425 ===<nowiki/>===
22426
22427 ====<nowiki/>====
22428
22429 =====<nowiki/>=====
22430
22431 ======<nowiki/>======
22432 !!end
22433
22434 !! test
22435 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22436 !! options
22437 parsoid=html2wt
22438 !! html/parsoid
22439 <p>=a=</p>
22440
22441 <p>=a=</p>
22442
22443 <p>=a=</p>
22444 !! wikitext
22445 <nowiki>=a=</nowiki>
22446
22447 <nowiki>=a=</nowiki>
22448
22449 <nowiki>=a=</nowiki>
22450 !!end
22451
22452 !! test
22453 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22454 !! options
22455 parsoid=html2wt
22456 !! html/parsoid
22457 <p>=a=
22458 b</p>
22459
22460 <p>=a=
22461 b</p>
22462
22463 <p>=a=
22464 b</p>
22465 !! wikitext
22466 <nowiki>=a=</nowiki>
22467 b
22468
22469 <nowiki>=a=</nowiki>
22470 b
22471
22472 <nowiki>=a=</nowiki>
22473 b
22474 !!end
22475
22476 !! test
22477 Headings: 6c. Heading chars in SOL context (leading newline break)
22478 !! options
22479 parsoid=html2wt
22480 !! html/parsoid
22481 <p>a
22482 =b=</p>
22483 !! wikitext
22484 a
22485 <nowiki>=b=</nowiki>
22486 !!end
22487
22488 !! test
22489 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22490 !! options
22491 parsoid=html2wt
22492 !! html/parsoid
22493 <!--c0--><p>=a=</p>
22494
22495 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22496 !! wikitext
22497 <!--c0--><nowiki>=a=</nowiki>
22498
22499 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22500 !!end
22501
22502 !! test
22503 Headings: 6d. Heading chars in SOL context (No escaping needed)
22504 !! options
22505 parsoid=html2wt
22506 !! html/parsoid
22507 =a=<div>b</div>
22508 !! wikitext
22509 =a=<div>b</div>
22510 !!end
22511
22512 !! test
22513 Headings: 7. Insert a newline between new content and headings
22514 !! options
22515 parsoid=html2wt
22516 !! html/parsoid
22517 <h2>NEW</h2>
22518 <p>new</p>
22519 <h2 data-parsoid='{}'>A</h2>
22520 <p data-parsoid='{}'>a</p>
22521 !! wikitext
22522 == NEW ==
22523 new
22524
22525 ==A==
22526 a
22527
22528 !! end
22529
22530 #### --------------- Lists ---------------
22531 #### 0. Outside nests (*foo, etc.)
22532 #### 1. Nested inside html <ul><li>*foo</li></ul>
22533 #### 2. Inside definition lists
22534 #### 3. Only bullets at start should be escaped
22535 #### 4. No escapes needed
22536 #### 5. No unnecessary escapes
22537 #### 6. Escape bullets in SOL position
22538 #### 7. Escape bullets in a multi-line context
22539 #### ----------------------------------------
22540
22541 !! test
22542 Lists: 0. Outside nests
22543 !! options
22544 parsoid=html2wt
22545 !! html/parsoid
22546 <p>*foo</p>
22547
22548 <p>#foo</p>
22549
22550 <p>;Foo:bar</p>
22551 !! wikitext
22552 <nowiki>*</nowiki>foo
22553
22554 <nowiki>#</nowiki>foo
22555
22556 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22557 !!end
22558
22559 !! test
22560 Lists: 1. Nested inside html
22561 !! options
22562 parsoid=html2wt
22563 !! html/parsoid
22564 <ul><li>*foo</li></ul>
22565 <ul><li>#foo</li></ul>
22566 <ul><li>:foo</li></ul>
22567 <ul><li>;foo</li></ul>
22568 <ol><li>*foo</li></ol>
22569 <ol><li>#foo</li></ol>
22570 <ol><li>:foo</li></ol>
22571 <ol><li>;foo</li></ol>
22572
22573 !! wikitext
22574 *<nowiki>*foo</nowiki>
22575
22576 *<nowiki>#foo</nowiki>
22577
22578 *<nowiki>:foo</nowiki>
22579
22580 *<nowiki>;foo</nowiki>
22581
22582 #<nowiki>*foo</nowiki>
22583
22584 #<nowiki>#foo</nowiki>
22585
22586 #<nowiki>:foo</nowiki>
22587
22588 #<nowiki>;foo</nowiki>
22589 !!end
22590
22591 !! test
22592 Lists: 2. Inside definition lists
22593 !! options
22594 parsoid=html2wt
22595 !! html/parsoid
22596 <dl><dt>;foo</dt></dl>
22597 <dl><dt>:foo</dt></dl>
22598 <dl><dt>:foo</dt>
22599 <dd>bar</dd></dl>
22600 <dl><dd>:foo</dd></dl>
22601
22602 !! wikitext
22603 ;<nowiki>;foo</nowiki>
22604
22605 ;<nowiki>:foo</nowiki>
22606
22607 ;<nowiki>:foo</nowiki>
22608 :bar
22609
22610 :<nowiki>:foo</nowiki>
22611 !!end
22612
22613 !! test
22614 Lists: 3. Only bullets at start of text should be escaped
22615 !! options
22616 parsoid=html2wt
22617 !! html/parsoid
22618 <ul><li>*foo*bar</li></ul>
22619 <ul><li>*foo<i>it</i>*bar</li></ul>
22620
22621 !! wikitext
22622 *<nowiki>*foo*bar</nowiki>
22623
22624 *<nowiki>*foo</nowiki>''it''*bar
22625 !!end
22626
22627 !! test
22628 Lists: 4. No escapes needed
22629 !! options
22630 parsoid=html2wt
22631 !! html/parsoid
22632 <ul>
22633 <li>foo*bar
22634 </li>
22635 </ul>
22636 <ul>
22637 <li><i>foo</i>*bar
22638 </li>
22639 </ul>
22640 <ul>
22641 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22642 </li>
22643 </ul>
22644 <ul>
22645 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22646 </li>
22647 </ul>
22648 !! wikitext
22649 *foo*bar
22650
22651 *''foo''*bar
22652
22653 *[[Foo]]: bar
22654
22655 *[[Foo]]*bar
22656 !!end
22657
22658 !! test
22659 Lists: 5. No unnecessary escapes
22660 !! options
22661 parsoid=html2wt
22662 !! html/parsoid
22663 <ul><li> bar <span>[[foo]]</span></li></ul>
22664 <ul><li> =bar <span>[[foo]]</span></li></ul>
22665 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22666 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22667 <ul><li> =bar <span>foo]]</span>=</li></ul>
22668 <ul><li> <s></s>: a</li></ul>
22669 <ul><li> <i>* foo</i></li></ul>
22670
22671 !! wikitext
22672 * bar <span><nowiki>[[foo]]</nowiki></span>
22673
22674 * =bar <span><nowiki>[[foo]]</nowiki></span>
22675
22676 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22677
22678 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22679
22680 * =bar <span>foo]]</span>=
22681
22682 * <s></s>: a
22683
22684 * ''* foo''
22685 !!end
22686
22687 !! test
22688 Lists: 6. Escape bullets in SOL position
22689 !! options
22690 parsoid=html2wt
22691 !! html/parsoid
22692 <p><!--cmt-->*foo</p>
22693 !! wikitext
22694 <!--cmt--><nowiki>*</nowiki>foo
22695 !!end
22696
22697 !! test
22698 Lists: 7. Escape bullets in a multi-line context
22699 !! options
22700 parsoid=html2wt
22701 !! html/parsoid
22702 <p>a
22703 *b
22704 </p>
22705 !! wikitext
22706 a
22707 <nowiki>*</nowiki>b
22708 !!end
22709
22710 !! test
22711 Lists: 8. Escape colons only if not present in tags
22712 !! options
22713 parsoid=html2wt
22714 !! html/parsoid
22715 <dl><dt>a:b<i>c:d</i></dt></dl>
22716 !! wikitext
22717 ; <nowiki>a:b</nowiki>''c:d''
22718 !! end
22719
22720 #### --------------- HRs ---------------
22721 #### 1. Single line
22722 #### -----------------------------------
22723
22724 !! test
22725 HRs: 1. Single line
22726 !! options
22727 parsoid=html2wt
22728 !! html/parsoid
22729 <hr />----
22730 <hr />=foo=
22731 <hr />*foo
22732 !! wikitext
22733 ----<nowiki>----</nowiki>
22734 ----=foo=
22735 ----*foo
22736 !! end
22737
22738 #### --------------- Tables ---------------
22739 #### 1a. Simple example
22740 #### 1b. No escaping needed (!foo)
22741 #### 1c. No escaping needed (|foo)
22742 #### 1d. No escaping needed (|}foo)
22743 ####
22744 #### 2a. Nested in td (<td>foo|bar</td>)
22745 #### 2b. Nested in td (<td>foo||bar</td>)
22746 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22747 ####
22748 #### 3a. Nested in th (<th>foo!bar</th>)
22749 #### 3b. Nested in th (<th>foo!!bar</th>)
22750 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22751 ####
22752 #### 4a. Escape -
22753 #### 4b. Escape +
22754 #### 4c. No escaping needed
22755 #### --------------------------------------
22756
22757 !! test
22758 Tables: 1a. Simple example
22759 !! options
22760 parsoid=html2wt
22761 !! html/parsoid
22762 <p>{|
22763 |}
22764 </p>
22765 !! wikitext
22766 <nowiki>{|</nowiki>
22767 |}
22768 !! end
22769
22770 !! test
22771 Tables: 1b. No escaping needed
22772 !! options
22773 parsoid=html2wt
22774 !! html/parsoid
22775 <p>!foo
22776 </p>
22777 !! wikitext
22778 !foo
22779 !! end
22780
22781 !! test
22782 Tables: 1c. No escaping needed
22783 !! options
22784 parsoid=html2wt
22785 !! html/parsoid
22786 <p>|foo
22787 </p>
22788 !! wikitext
22789 |foo
22790 !! end
22791
22792 !! test
22793 Tables: 1d. No escaping needed
22794 !! options
22795 parsoid=html2wt
22796 !! html/parsoid
22797 <p>|}foo
22798 </p>
22799 !! wikitext
22800 |}foo
22801 !! end
22802
22803 !! test
22804 Tables: 2a. Nested in td
22805 !! options
22806 parsoid=html2wt
22807 !! html/parsoid
22808 <table><tbody><tr>
22809 <td>foo|bar</td></tr>
22810 <tr><td>x<div>a|b</div></td>
22811 </tbody></table>
22812 !! wikitext
22813 {|
22814 |<nowiki>foo|bar</nowiki>
22815 |-
22816 |x<div><nowiki>a|b</nowiki></div>
22817 |}
22818 !! html/php+tidy
22819 <table>
22820 <tr>
22821 <td>foo|bar</td>
22822 </tr>
22823 <tr>
22824 <td>x
22825 <div>a|b</div>
22826 </td>
22827 </tr>
22828 </table>
22829 !! end
22830
22831 !! test
22832 Tables: 2b. Nested in td
22833 !! options
22834 parsoid=html2wt
22835 !! html/parsoid
22836 <table><tbody><tr>
22837 <td>foo||bar</td>
22838 <td>a<i>b||c</i></td>
22839 <td>a<i><div>b||c</div></i></td>
22840 </tr></tbody></table>
22841 !! wikitext
22842 {|
22843 |<nowiki>foo||bar</nowiki>
22844 |a''<nowiki>b||c</nowiki>''
22845 |a''<div><nowiki>b||c</nowiki></div>''
22846 |}
22847 !! html/php
22848 <table>
22849 <tr>
22850 <td>foo||bar
22851 </td>
22852 <td>a<i>b||c</i>
22853 </td>
22854 <td>a<i><div>b||c</div></i>
22855 </td></tr></table>
22856
22857 !! end
22858
22859 !! test
22860 Tables: 2c. Nested in td -- no escaping needed
22861 !! options
22862 parsoid=html2wt
22863 !! html/*
22864 <table>
22865
22866 <tr>
22867 <td>foo!!bar
22868 </td></tr></table>
22869
22870 !! wikitext
22871 {|
22872
22873 |foo!!bar
22874 |}
22875 !! end
22876
22877 !! test
22878 Tables: 3a. Nested in th
22879 !! options
22880 parsoid=html2wt
22881 !! html/*
22882 <table>
22883
22884 <tr>
22885 <th>foo!bar
22886 </th></tr></table>
22887
22888 !! wikitext
22889 {|
22890
22891 !foo!bar
22892 |}
22893 !! end
22894
22895 !! test
22896 Tables: 3b. Nested in th
22897 !! options
22898 parsoid=html2wt
22899 !! html/parsoid
22900 <table><tbody>
22901 <tr><th>foo!!bar</th>
22902 <th><i>foo|bar</i></th>
22903 <th><i>foo!!bar</i></th>
22904 <th><i><span>foo!!bar</span></i></th>
22905 </tr></tbody></table>
22906 !! wikitext
22907 {|
22908 !<nowiki>foo!!bar</nowiki>
22909 !''<nowiki>foo|bar</nowiki>''
22910 !''<nowiki>foo!!bar</nowiki>''
22911 !''<span><nowiki>foo!!bar</nowiki></span>''
22912 |}
22913 !! html/php
22914 <table>
22915 <tr>
22916 <th>foo!!bar
22917 </th>
22918 <th><i>foo|bar</i>
22919 </th>
22920 <th><i>foo!!bar</i>
22921 </th>
22922 <th><i><span>foo!!bar</span></i>
22923 </th></tr></table>
22924
22925 !! end
22926
22927 !! test
22928 Tables: 3c. Nested in th
22929 !! options
22930 parsoid=html2wt
22931 !! html/parsoid
22932 <table><tbody>
22933 <tr><th>foo||bar</th>
22934 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22935 </tr></tbody></table>
22936 !! wikitext
22937 {|
22938 !<nowiki>foo||bar</nowiki>
22939 !<nowiki>foo||bar</nowiki>
22940 |}
22941 !! html/php
22942 <table>
22943 <tr>
22944 <th>foo||bar
22945 </th>
22946 <th>foo||bar
22947 </th></tr></table>
22948
22949 !! end
22950
22951 !! test
22952 Tables: 4a. Escape -
22953 !! options
22954 parsoid=html2wt
22955 !! html/*
22956 <table>
22957
22958 <tr>
22959 <th>-bar
22960 </th></tr>
22961 <tr>
22962 <td>-bar
22963 </td></tr></table>
22964
22965 !! wikitext
22966 {|
22967
22968 !-bar
22969
22970 |-
22971 |<nowiki>-bar</nowiki>
22972 |}
22973 !! end
22974
22975 !! test
22976 Tables: 4b. Escape +
22977 !! options
22978 parsoid=html2wt
22979 !! html/*
22980 <table>
22981
22982 <tr>
22983 <th>+bar
22984 </th></tr>
22985 <tr>
22986 <td>+bar
22987 </td></tr></table>
22988
22989 !! wikitext
22990 {|
22991
22992 !+bar
22993
22994 |-
22995 |<nowiki>+bar</nowiki>
22996 |}
22997 !! end
22998
22999 !! test
23000 Tables: 4c. No escaping needed
23001 !! options
23002 parsoid=html2wt
23003 !! html/parsoid
23004 <table><tbody>
23005 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23006 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23007 <tr><td>foo
23008 <p>bar|baz
23009 +bar
23010 -bar</p></td></tr>
23011 <tr><td>x
23012 <div>a|b</div></td>
23013 </tbody></table>
23014 !! wikitext
23015 {|
23016 |foo-bar
23017 |foo+bar
23018 |-
23019 |''foo''-bar
23020 |''foo''+bar
23021 |-
23022 |foo
23023 bar|baz
23024 +bar
23025 -bar
23026 |-
23027 |x
23028 <div>a|b</div>
23029 |}
23030 !! html/php
23031 <table>
23032 <tr>
23033 <td>foo-bar
23034 </td>
23035 <td>foo+bar
23036 </td></tr>
23037 <tr>
23038 <td><i>foo</i>-bar
23039 </td>
23040 <td><i>foo</i>+bar
23041 </td></tr>
23042 <tr>
23043 <td>foo
23044 <p>bar|baz
23045 +bar
23046 -bar
23047 </p>
23048 </td></tr>
23049 <tr>
23050 <td>x
23051 <div>a|b</div>
23052 </td></tr></table>
23053
23054 !! end
23055
23056 !! test
23057 Tables: 4d. No escaping needed
23058 !! options
23059 parsoid=html2wt
23060 !! html/parsoid
23061 <table>
23062 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23063 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23064 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23065 </tbody></table>
23066 !! wikitext
23067 {|
23068 |[[Foo]]-bar
23069 ||+1
23070 ||-2
23071 |}
23072 !! html/php
23073 <table>
23074 <tr>
23075 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23076 </td>
23077 <td>+1
23078 </td>
23079 <td>-2
23080 </td></tr></table>
23081
23082 !! end
23083
23084 !! test
23085 T97430: Don't emit empty nowiki pairs around marker meta tags
23086 !! options
23087 parsoid=html2wt
23088 !! html/parsoid
23089 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23090 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23091 !! wikitext
23092 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23093 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23094 !! end
23095
23096 !! test
23097 Unclosed xmlish element in table line shouldn't eat end delimiters
23098 !! options
23099 parsoid=html2wt
23100 !! html/parsoid
23101 <table>
23102 <tbody><tr><td> &lt;foo</td>
23103 <td> bar></td></tr>
23104 </tbody></table>
23105 !! wikitext
23106 {|
23107 | <foo
23108 | bar>
23109 |}
23110 !! html/php
23111 <table>
23112 <tr>
23113 <td> &lt;foo
23114 </td>
23115 <td> bar&gt;
23116 </td></tr></table>
23117
23118 !! end
23119
23120 #### --------------- Links ----------------
23121 #### 1. Quote marks in link text
23122 #### 2. Wikilinks: Escapes needed
23123 #### 3. Wikilinks: No escapes needed
23124 #### 4. Extlinks: Escapes needed
23125 #### 5. Extlinks: No escapes needed
23126 #### --------------------------------------
23127 !! test
23128 Links 1. WikiLinks: No escapes needed
23129 !! options
23130 parsoid=html2wt
23131 !! html/parsoid
23132 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23133 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23134 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23135 !! wikitext
23136 [[Foo|Foo''boo'']]
23137 [[Foo|[Foobar]]]
23138 [[Foo|x [Foobar] x]]
23139 !! html/php
23140 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23141 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23142 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23143 </p>
23144 !! end
23145
23146 !! test
23147 Links 2. WikiLinks: Escapes needed
23148 !! options
23149 parsoid=html2wt
23150 !! html/parsoid
23151 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23152 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23153 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23154 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23155 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23156 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23157 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23158 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23159 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23160 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23161 !! wikitext
23162 [[Foo|<nowiki>Foobar]</nowiki>]]
23163 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23164 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23165 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23166 [[Foo|<nowiki>|Bar</nowiki>]]
23167 [[Foo|<nowiki>]]bar</nowiki>]]
23168 [[Foo|<nowiki>[[bar</nowiki>]]
23169 [[Foo|<nowiki>x [[ y</nowiki>]]
23170 [[Foo|<nowiki>x ]] y</nowiki>]]
23171 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23172 !! html/php
23173 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23174 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23175 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23176 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23177 <a href="/wiki/Foo" title="Foo">|Bar</a>
23178 <a href="/wiki/Foo" title="Foo">]]bar</a>
23179 <a href="/wiki/Foo" title="Foo">[[bar</a>
23180 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23181 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23182 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23183 </p>
23184 !! end
23185
23186 !! test
23187 Links 3. WikiLinks: No escapes needed
23188 !! options
23189 parsoid=html2wt
23190 !! html/parsoid
23191 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23192 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23193 !! wikitext
23194 [[Foo|[Foobar]]
23195 [[Foo|foo|bar]]
23196 !! html/php
23197 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23198 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23199 </p>
23200 !! end
23201
23202 !! test
23203 Links 4. ExtLinks: Escapes needed
23204 !! options
23205 parsoid=html2wt
23206 !! html/parsoid
23207 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23208 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23209 <p>[http://google.com]</p>
23210 <p>[http://google.com google]</p>
23211 !! wikitext
23212 [http://google.com <nowiki>[google]</nowiki>]
23213 [http://google.com <nowiki>google]</nowiki>]
23214
23215 <nowiki>[http://google.com]</nowiki>
23216
23217 <nowiki>[http://google.com google]</nowiki>
23218
23219 !! html/php
23220 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23221 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23222 </p><p>[http://google.com]
23223 </p><p>[http://google.com google]
23224 </p>
23225 !! end
23226
23227 !! test
23228 Links 5. ExtLinks: No escapes needed
23229 !! options
23230 parsoid=html2wt
23231 !! html/parsoid
23232 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23233 !! wikitext
23234 [http://google.com [google]
23235 !! html/php
23236 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23237 </p>
23238 !! end
23239
23240 !! test
23241 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23242 !! options
23243 parsoid=html2wt
23244 !! html/parsoid
23245 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23246 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23247 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23248 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23249 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23250 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23251 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23252 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23253 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23254 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23255 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23256 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23257 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23258 </p>
23259 !! wikitext
23260 x<nowiki/>http://example.com<nowiki/>y
23261 http://example.com<nowiki/>?x
23262 http://example.com<nowiki/>&x
23263 http://example.com<nowiki/>'x
23264 http://example.com<nowiki/>,x
23265 http://example.com<nowiki/>.x
23266 http://example.com<nowiki/>;x
23267 http://example.com<nowiki/>:x
23268 http://example.com<nowiki/>;x
23269 http://example.com<nowiki/>!x
23270 http://example.com<nowiki/>=x
23271 http://example.com<nowiki/>(x)
23272 http://example.com(x<nowiki/>)
23273 !! end
23274
23275 !! test
23276 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23277 !! options
23278 parsoid=html2wt
23279 !! html/parsoid
23280 <p>x
23281 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23282 y
23283 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23284 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23285 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23286 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23287 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23288 </p>
23289 !! wikitext
23290 x
23291 http://example.com
23292 y
23293 "http://example.com"
23294 (http://example.com)
23295 (http://example.com) foo
23296 http://example.com,
23297 http://example.com, foo
23298 !! html/php
23299 <p>x
23300 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23301 y
23302 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23303 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23304 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23305 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23306 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23307 </p>
23308 !! end
23309
23310 !! test
23311 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23312 !! options
23313 parsoid=html2wt
23314 !! html/parsoid
23315 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23316 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23317 !! wikitext
23318 http://example.com.,;:!?\
23319 -http://example.com:
23320 !! html/php
23321 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23322 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23323 </p>
23324 !! end
23325
23326 !! test
23327 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23328 !! options
23329 parsoid=html2wt
23330 !! html/parsoid
23331 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23332 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23333 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23334 !! wikitext
23335 RFC 123<nowiki/>4
23336 RFC 123<nowiki/>y
23337 X<nowiki/>RFC 123<nowiki/>y
23338 !! end
23339
23340 !! test
23341 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23342 !! options
23343 parsoid=html2wt
23344 !! html/parsoid
23345 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23346 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23347 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23348 </p>
23349 !! wikitext
23350 RFC 123?foo
23351 RFC 123&foo
23352 -RFC 123-
23353 !! html/php
23354 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23355 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23356 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23357 </p>
23358 !! end
23359
23360 !! test
23361 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23362 !! options
23363 parsoid=html2wt
23364 !! html/parsoid
23365 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23366 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23367 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23368 !! wikitext
23369 PMID 123<nowiki/>4
23370 PMID 123<nowiki/>y
23371 X<nowiki/>PMID 123<nowiki/>y
23372 !! end
23373
23374 !! test
23375 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23376 !! options
23377 parsoid=html2wt
23378 !! html/parsoid
23379 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23380 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23381 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23382 </p>
23383 !! wikitext
23384 PMID 123?foo
23385 PMID 123&foo
23386 -PMID 123-
23387 !! html/php
23388 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23389 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23390 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23391 </p>
23392 !! end
23393
23394 !! test
23395 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (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>1
23400 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23401 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23402 </p>
23403 !! wikitext
23404 ISBN 1234567890<nowiki/>1
23405 ISBN 1234567890<nowiki/>x
23406 a<nowiki/>ISBN 1234567890<nowiki/>b
23407 !! end
23408
23409 !! test
23410 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23411 !! options
23412 parsoid=html2wt
23413 !! html/parsoid
23414 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23415 !! wikitext
23416 -ISBN 1234567890's
23417 !! html/php
23418 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23419 </p>
23420 !! end
23421
23422 !! test
23423 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23424 !! options
23425 parsoid=html2wt
23426 !! html/*
23427 <p>this is not a link: http://example.com
23428 </p>
23429 !! wikitext
23430 this is not a link: <nowiki>http://example.com</nowiki>
23431 !! end
23432
23433 !! test
23434 Links 15. Link trails can't become link prefixes.
23435 !! options
23436 language=is
23437 parsoid=html2wt
23438 !! html/parsoid
23439 <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>
23440 !! wikitext
23441 [[Söfnuður]]-[[00]]
23442 !! html/php
23443 <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>
23444 </p>
23445 !! end
23446
23447 #### --------------- Quotes ---------------
23448 #### 1. Quotes inside <b> and <i>
23449 #### 2. Link fragments separated by <i> and <b> tags
23450 #### 3. Link fragments inside <i> and <b>
23451 #### 4. No escaping needed
23452 #### --------------------------------------
23453 !! test
23454 1a. Quotes inside <b> and <i>
23455 !! options
23456 parsoid=html2wt
23457 !! html/*
23458 <p><i>'foo'</i>
23459 <i>''foo''</i>
23460 <i>'''foo'''</i>
23461 <i>foo</i>'s
23462 <b>'foo'</b>
23463 <b>''foo''</b>
23464 <b>'''foo'''</b>
23465 <b>foo'<i>bar'</i>baz</b>
23466 <b>foo</b>'s
23467 '<i>foo</i>
23468 <i>foo</i>'
23469 <i>foo'</i>'
23470 '<i>foo</i>'
23471 '<b>foo</b>
23472 <b>foo</b>'
23473 '<b>foo</b>'
23474 <i>fools'<span> errand</span></i>
23475 <i><span>fool</span>'s errand</i>
23476 '<i>foo</i> bar '<i>baz</i>
23477 a|!*#-:;+-~[]{}b'<i>x</i>
23478 </p>
23479 !! wikitext
23480 ''<nowiki/>'foo'''
23481 ''<nowiki>''foo''</nowiki>''
23482 ''<nowiki>'''foo'''</nowiki>''
23483 ''foo''<nowiki/>'s
23484 '''<nowiki/>'foo''''
23485 '''<nowiki>''foo''</nowiki>'''
23486 '''<nowiki>'''foo'''</nowiki>'''
23487 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23488 '''foo'''<nowiki/>'s
23489 '''foo''
23490 ''foo''<nowiki/>'
23491 ''foo'''<nowiki/>'
23492 '''foo''<nowiki/>'
23493 ''''foo'''
23494 '''foo'''<nowiki/>'
23495 ''''foo'''<nowiki/>'
23496 ''fools'<span> errand</span>''
23497 ''<span>fool</span>'s errand''
23498 '<nowiki/>''foo'' bar '''baz''
23499 a|!*#-:;+-~[]{}b'''x''
23500 !! end
23501
23502 !! test
23503 1b. Quotes inside <b> and <i> with other tags on same line
23504 !! options
23505 parsoid=html2wt
23506 !! html/parsoid
23507 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23508 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23509 <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>
23510 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23511 '<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>
23512 '<i>foo</i> <div title="name">test</div>
23513 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23514 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23515 <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>
23516 </ol>
23517 !! wikitext
23518 '''a'' foo ''[[bar]]''
23519 ''a''' foo ''[[bar]]''
23520 ''a''' foo '''{{echo|[[bar]]}}'''
23521 [[foo]] x'''[[bar]]''
23522 '''foo'' <ref>test</ref>
23523 '''foo'' <div title="name">test</div>
23524 '''foo'' and <br> bar
23525 <references />
23526 !! end
23527
23528 !! test
23529 2. Link fragments separated by <i> and <b> tags
23530 !! options
23531 parsoid=html2wt
23532 !! html/parsoid
23533 <p>[[<i>foo</i>hello]]</p>
23534 <p>[[<b>foo</b>hello]]</p>
23535 !! wikitext
23536 [[''foo''<nowiki>hello]]</nowiki>
23537
23538 [['''foo'''<nowiki>hello]]</nowiki>
23539 !! end
23540
23541 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23542 # this is one of the shortcomings of this format
23543 !! test
23544 3. Link fragments inside <i> and <b>
23545 !! options
23546 parsoid=html2wt
23547 !! html/parsoid
23548 <p><i>[[foo</i>]]</p>
23549 <p><b>[[foo</b>]]</p>
23550 !! wikitext
23551 ''[[foo''<nowiki>]]</nowiki>
23552
23553 '''[[foo'''<nowiki>]]</nowiki>
23554 !! end
23555
23556 !! test
23557 4. No escaping needed
23558 !! options
23559 options=html2wt
23560 !! html/parsoid
23561 <p>'<span><i>bar</i></span>'
23562 '<span><b>bar</b></span>'
23563 'a:b'foo
23564 </p>
23565 !! wikitext
23566 '<span>''bar''</span>'
23567 '<span>'''bar'''</span>'
23568 'a:b'foo
23569 !! end
23570
23571 #### ----------- Paragraphs ---------------
23572 #### 1. No unnecessary escapes
23573 #### --------------------------------------
23574
23575 !! test
23576 1. No unnecessary escapes
23577 !! options
23578 parsoid=html2wt
23579 !! html/parsoid
23580 <p>bar <span>[[foo]]</span>
23581 </p><p>=bar <span>[[foo]]</span>
23582 </p><p>[[bar <span>[[foo]]</span>
23583 </p><p>]]bar <span>[[foo]]</span>
23584 </p><p>=bar <span>foo]]</span>=
23585 </p>
23586 !! wikitext
23587 bar <span><nowiki>[[foo]]</nowiki></span>
23588
23589 =bar <span><nowiki>[[foo]]</nowiki></span>
23590
23591 [[bar <span><nowiki>[[foo]]</nowiki></span>
23592
23593 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23594
23595 =bar <span>foo]]</span><nowiki>=</nowiki>
23596 !!end
23597
23598 #### ----------------------- PRE --------------------------
23599 #### 1. Leading whitespace in SOL context should be escaped
23600 #### ------------------------------------------------------
23601 !! test
23602 1. Leading whitespace in SOL context should be escaped
23603 !! options
23604 parsoid=html2wt
23605 !! html/parsoid
23606 <p> a</p>
23607
23608 <p> a</p>
23609
23610 <p> a(tab)</p>
23611
23612 <p> a
23613 <!--cmt-->
23614 a</p>
23615
23616 <p>a
23617 b</p>
23618
23619 <p>a
23620 b</p>
23621
23622 <p>a
23623 b</p>
23624 !! wikitext
23625 <nowiki> </nowiki>a
23626
23627 <nowiki> </nowiki> a
23628
23629 a(tab)
23630
23631 <nowiki> </nowiki> a
23632 <!--cmt-->
23633 <nowiki> </nowiki>a
23634
23635 a
23636 <nowiki> </nowiki>b
23637
23638 a
23639 b
23640
23641 a
23642 b
23643 !! html/php
23644 <p> a
23645 </p><p> a
23646 </p><p> a(tab)
23647 </p><p> a
23648 a
23649 </p><p>a
23650 b
23651 </p><p>a
23652 b
23653 </p><p>a
23654 b
23655 </p>
23656 !! end
23657
23658 !! test
23659 2. Leading whitespace in non-indent-pre contexts should not be escaped
23660 !! options
23661 parsoid=htm2wt
23662 !! html/parsoid
23663 <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>
23664 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23665 <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>
23666 b</span></li>
23667 </ol>
23668 !! wikitext
23669 foo <ref>''a''
23670 b</ref>
23671 <references />
23672 !! end
23673
23674 !! test
23675 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23676 !! options
23677 parsoid=html2wt
23678 !! html/parsoid
23679 <blockquote>
23680 <p>
23681 a
23682 <span>b</span>
23683 c</p>
23684 </blockquote>
23685 !! wikitext
23686 <blockquote>
23687 a
23688 <span>b</span>
23689 c
23690 </blockquote>
23691 !! end
23692
23693 !! test
23694 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23695 !! options
23696 options=html2wt
23697 !! html/parsoid
23698 <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>
23699 !! wikitext
23700 [[File:Foobar.jpg|thumb|caption]]
23701 !! end
23702
23703 !! test
23704 5. Nowiki escaping should account for indent-pres
23705 !! options
23706 parsoid=html2wt
23707 !! html/parsoid
23708 <pre>==foo==</pre>
23709 !! wikitext
23710 ==foo==
23711 !! end
23712
23713 !!test
23714 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23715 !! options
23716 parsoid=html2wt
23717 !! html/parsoid
23718 <pre>
23719 * foo
23720 * bar
23721 </pre>
23722 !! wikitext
23723 * foo
23724 * bar
23725 !! end
23726
23727 #### --------------- Behavior Switches --------------------
23728
23729 !! test
23730 1. Valid behavior switches should be escaped
23731 !! options
23732 parsoid=html2wt
23733 !! html/parsoid
23734 __TOC__
23735 <i>__TOC__</i>
23736 !! wikitext
23737 <nowiki>__TOC__</nowiki>
23738 ''<nowiki>__TOC__</nowiki>''
23739 !! end
23740
23741 !! test
23742 2. Invalid behavior switches should not be escaped
23743 !! options
23744 parsoid=html2wt
23745 !! html/parsoid
23746 __TOO__
23747 __|__
23748 !! wikitext
23749 __TOO__
23750 __|__
23751 !! end
23752
23753 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23754 !! test
23755 Behavior switches should be SOL-transparent
23756 !! options
23757 parsoid=html2wt
23758 !! html/parsoid
23759 <meta property="mw:PageProp/toc" />
23760
23761 <!-- this one's bogus -->
23762 <pre>__TOO__</pre>
23763
23764 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23765
23766 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23767 !! wikitext
23768 __TOC__
23769
23770 <!-- this one's bogus -->
23771 __TOO__
23772
23773 __TOC__ foo
23774
23775 __TOC__
23776 bar
23777 !! end
23778
23779 #### --------------- HTML tags ---------------
23780 #### 1. a tags
23781 #### 2. other tags
23782 #### 3. multi-line html tag
23783 #### 4. extension tags
23784 #### -----------------------------------------
23785 !! test
23786 1. a tags
23787 !! options
23788 parsoid=html2wt
23789 !! html/parsoid
23790 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23791 !! wikitext
23792 <a href="http://google.com">google</a>
23793 !! end
23794
23795 !! test
23796 2. other tags
23797 !! options
23798 parsoid=html2wt
23799 !! html/parsoid
23800 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23801 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23802 <li> &lt;td&gt;</li></ul>
23803
23804 !! wikitext
23805 * <nowiki><div>foo</div></nowiki>
23806 * <nowiki><div style="color:red">foo</div></nowiki>
23807 * <nowiki><td></nowiki>
23808 !! end
23809
23810 !! test
23811 3. multi-line html tag
23812 !! options
23813 parsoid=html2wt
23814 !! html/parsoid
23815 <p>&lt;div
23816 &gt;foo&lt;/div
23817 &gt;
23818 </p>
23819 !! wikitext
23820 <nowiki><div
23821 >foo</div
23822 ></nowiki>
23823 !! end
23824
23825 !! test
23826 4. extension tags
23827 !! options
23828 parsoid=html2wt
23829 !! html/parsoid
23830 <p>&lt;ref&gt;foo&lt;/ref&gt;
23831 </p><p>&lt;ref&gt;bar
23832 </p><p>baz&lt;/ref&gt;
23833 </p>
23834 !! wikitext
23835 <nowiki><ref>foo</ref></nowiki>
23836
23837 <nowiki><ref>bar</nowiki>
23838
23839 baz<nowiki></ref></nowiki>
23840 !! end
23841
23842 #### --------------- Others ---------------
23843 !! test
23844 Escaping nowikis
23845 !! options
23846 parsoid=html2wt
23847 !! html/parsoid
23848 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23849 </p>
23850 !! wikitext
23851 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23852 !! end
23853
23854 ## The quote-char in the input is necessary for triggering the bug
23855 !! test
23856 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23857 !! options
23858 parsoid=html2wt
23859 !! html/parsoid
23860 <p>foo's bar :</p>
23861 !! wikitext
23862 foo's bar :
23863 !! end
23864
23865 #----------- End of wikitext escaping tests --------------
23866
23867 !! test
23868
23869 Tag-like HTML structures are passed through as text
23870 !! wikitext
23871 <x y>
23872
23873 <x.y>
23874
23875 <x-y>
23876
23877 1>2
23878
23879 x<y
23880
23881 a>b
23882
23883 1<d e>f
23884 !! html
23885 <p>&lt;x y&gt;
23886 </p><p>&lt;x.y&gt;
23887 </p><p>&lt;x-y&gt;
23888 </p><p>1&gt;2
23889 </p><p>x&lt;y
23890 </p><p>a&gt;b
23891 </p><p>1&lt;d e&gt;f
23892 </p>
23893 !! end
23894
23895 !! test
23896 HTML tag with necessary entities in attributes
23897 !! wikitext
23898 <span title="&amp;amp;">foo</span>
23899 !! html
23900 <p><span title="&amp;amp;">foo</span>
23901 </p>
23902 !! end
23903
23904 !! test
23905 HTML tag with 'unnecessary' entity encoding in attributes
23906 !! wikitext
23907 <span title="&amp;">foo</span>
23908 !! html
23909 <p><span title="&amp;">foo</span>
23910 </p>
23911 !! end
23912
23913 !! test
23914 HTML tag with broken attribute value quoting
23915 !! options
23916 parsoid=wt2html,html2html
23917 !! wikitext
23918 <span title="Hello world>Foo</span>
23919 !! html/php
23920 <p><span title="Hello world">Foo</span>
23921 </p>
23922 !! html/parsoid
23923 <p><span title="Hello world">Foo</span></p>
23924 !! end
23925
23926 !! test
23927 Self-closed tag with broken attribute value quoting
23928 !! options
23929 parsoid=wt2html,html2html
23930 !! wikitext
23931 <div title="Hello world />Foo
23932 !! html/php+tidy
23933 <div title="Hello world"></div>
23934 <p>Foo</p>
23935 !! html/parsoid
23936 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
23937 !! end
23938
23939 !! test
23940 Table with broken attribute value quoting
23941 !! options
23942 parsoid=wt2html,html2html
23943 !! wikitext
23944 {|
23945 | title="Hello world|Foo
23946 |}
23947 !! html/php
23948 <table>
23949 <tr>
23950 <td title="Hello world">Foo
23951 </td></tr></table>
23952
23953 !! html/parsoid
23954 <table>
23955 <tr>
23956 <td title="Hello world">Foo
23957 </td></tr></table>
23958
23959 !! end
23960
23961 !! test
23962 Table with broken attribute value quoting on consecutive lines
23963 !! options
23964 parsoid=wt2html,html2html
23965 !! wikitext
23966 {|
23967 | title="Hello world|Foo
23968 | style="color:red|Bar
23969 |}
23970 !! html/php
23971 <table>
23972 <tr>
23973 <td title="Hello world">Foo
23974 </td>
23975 <td style="color:red">Bar
23976 </td></tr></table>
23977
23978 !! html/parsoid
23979 <table><tbody>
23980 <tr>
23981 <td title="Hello world">Foo
23982 </td><td style="color: red">Bar
23983 </td></tr></tbody></table>
23984
23985 !! end
23986
23987 !! test
23988 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23989 !! options
23990 parsoid
23991 !! wikitext
23992 {{}}
23993 !! html
23994 {{}}
23995 !! end
23996
23997 !! test
23998 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23999 !! options
24000 parsoid
24001 !! wikitext
24002 }}{{
24003 !! html
24004 }}{{
24005 !! end
24006
24007 !!test
24008 Accept empty td cell attribute
24009 !! wikitext
24010 {|
24011 | align="center" | foo || |
24012 |}
24013 !! html
24014 <table>
24015 <tr>
24016 <td align="center"> foo </td>
24017 <td>
24018 </td></tr></table>
24019
24020 !!end
24021
24022 !!test
24023 Non-empty attributes in th-cells
24024 !! wikitext
24025 {|
24026 ! Foo !! style="color: red" | Bar
24027 |}
24028 !! html
24029 <table>
24030 <tr>
24031 <th> Foo </th>
24032 <th style="color: red"> Bar
24033 </th></tr></table>
24034
24035 !!end
24036
24037 !!test
24038 Accept empty attributes in th-cells
24039 !! wikitext
24040 {|
24041 !| foo !!| bar
24042 |}
24043 !! html
24044 <table>
24045 <tr>
24046 <th> foo </th>
24047 <th> bar
24048 </th></tr></table>
24049
24050 !!end
24051
24052 !!test
24053 Empty table rows go away
24054 !! wikitext
24055 {|
24056 | Hello
24057 | there
24058 |- class="foo"
24059 |-
24060 |}
24061 !! html
24062 <table>
24063 <tr>
24064 <td> Hello
24065 </td>
24066 <td> there
24067 </td></tr>
24068
24069 </table>
24070
24071 !! end
24072
24073 ###
24074 ### Parsoid-centric tests for testing RTing of inter-element separators
24075 ### Edge cases not tested by existing parser tests and specific to
24076 ### Parsoid-specific serialization strategies.
24077 ###
24078
24079 !!test
24080 RT-ed inter-element separators should be valid separators
24081 !! wikitext
24082 {|
24083 |- [[foo]]
24084 |}
24085 !! html/php
24086 <table>
24087
24088 </table>
24089
24090 !! html/parsoid
24091 <table>
24092 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24093 </tbody></table>
24094 !!end
24095
24096 # Parsoid-only since PHP parser relies on Tidy for correct output
24097 !!test
24098 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24099 !!options
24100 parsoid
24101 !! wikitext
24102 {|
24103 |<small>foo
24104 bar
24105 |}
24106
24107 {|
24108 |<small>foo<small>
24109 |}
24110 !! html
24111 <table>
24112 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24113 <p>bar</p></small></td></tr>
24114 </tbody></table>
24115
24116 <table>
24117 <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>
24118 </tbody></table>
24119 !!end
24120
24121 # Note that the "style" attribute is really a template parameter here.
24122 # The = would have to be {{=}} if you wanted the literal.
24123 !!test
24124 Empty TD followed by TD with tpl-generated attribute
24125 !! wikitext
24126 {|
24127 |-
24128 |
24129 |{{echo|style='color:red'}}|foo
24130 |}
24131 !! html
24132 <table>
24133
24134 <tr>
24135 <td>
24136 </td>
24137 <td>foo
24138 </td></tr></table>
24139
24140 !!end
24141
24142 !!test
24143 Indented table with an empty td
24144 !! wikitext
24145 {|
24146 |-
24147 |
24148 |foo
24149 |}
24150 !! html
24151 <table>
24152
24153 <tr>
24154 <td>
24155 </td>
24156 <td>foo
24157 </td></tr></table>
24158
24159 !!end
24160
24161 ## We have some newline diffs RT-ing this edge case
24162 ## and it is not important enough -- we seem to be emitting
24163 ## at most 2 newlines after a </tr> and this is unrelated to
24164 ## the issue from T85627 that this is testing.
24165 !!test
24166 Indented table with blank lines in between (T85627)
24167 !! options
24168 parsoid=wt2html
24169 !! wikitext
24170 {|
24171 |foo
24172
24173
24174 |}
24175 !! html
24176 <table>
24177
24178 <tr>
24179 <td>foo
24180 </td></tr></table>
24181
24182 !!end
24183
24184 !!test
24185 Indented block & table
24186 !! wikitext
24187 <div>foo</div>
24188 {|
24189 |foo
24190 |}
24191 !! html/php
24192 <div>foo</div>
24193 <table>
24194 <tr>
24195 <td>foo
24196 </td></tr></table>
24197
24198 !! html/parsoid
24199 <div data-parsoid='{"stx":"html"}'>foo</div>
24200 <table><tbody>
24201 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24202 </tbody></table>
24203 !!end
24204
24205 !! test
24206 Indent and comment before table row
24207 !! wikitext
24208 {|
24209 <!--hi-->|-
24210 | there
24211 |}
24212 !! html/php
24213 <table>
24214
24215 <tr>
24216 <td> there
24217 </td></tr></table>
24218
24219 !! html/parsoid
24220 <table>
24221 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24222 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24223 </tbody></table>
24224 !! end
24225
24226 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24227 !!test
24228 Empty TR followed by a template-generated TR
24229 !!options
24230 parsoid
24231 !! wikitext
24232 {|
24233 |-
24234 {{echo|<tr><td>foo</td></tr>}}
24235 |}
24236 !! html
24237 <table>
24238 <tbody>
24239 <tr></tr>
24240 <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}}]}'>
24241 <td>foo</td></tr>
24242 </tbody></table>
24243 !!end
24244
24245 ## PHP and parsoid output differ for this, and since this is primarily
24246 ## for testing Parsoid's serializer, marking this Parsoid only
24247 !!test
24248 Empty TR followed by mixed-ws-comment line should RT correctly
24249 !!options
24250 parsoid
24251 !! wikitext
24252 {|
24253 |-
24254 <!--c-->
24255 |-
24256 <!--c--> <!--d-->
24257 |}
24258 !! html
24259 <table>
24260 <tbody>
24261 <tr></tr>
24262 <!--c-->
24263 <tr>
24264 <!--c--> </tr><!--d-->
24265 </tbody></table>
24266
24267 !!end
24268
24269 !!test
24270 Multi-line image caption generated by templates with/without trailing newlines
24271 !! wikitext
24272 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24273 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24274 !! html/parsoid
24275 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#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>
24276 <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>
24277 !!end
24278
24279 !! test
24280 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24281 !! options
24282 parsoid=html2wt
24283 !! html/parsoid
24284 <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>
24285
24286 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24287 !! wikitext
24288 <includeonly>foo</includeonly>
24289 new para
24290
24291 [[Category:Foo]]
24292
24293 = new heading =
24294 !! end
24295
24296 ## PHP emits broken html for this, and since this is primarily
24297 ## a Parsoid serializer test, marking this Parsoid only
24298 !!test
24299 Improperly nested inline or quotes tags with whitespace in between
24300 !! wikitext
24301 <span> <s>x</span> </s>
24302 ''' ''x''' ''
24303 !! html/parsoid
24304 <p><span> <s>x</s></span><s> </s>
24305 <b> <i>x</i></b><i> </i>
24306 </p>
24307 !!end
24308
24309 !!test
24310 Encapsulate protected attributes from wt
24311 !! wikitext
24312 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24313 !! html/parsoid
24314 <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>
24315 </body>
24316 !!end
24317
24318 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24319 ## Having nested or stray pre tags results in the attempt to add duplicates,
24320 ## causing an assertion fail. This test tries to prevent that situation.
24321 !!test
24322 Ensure ParagraphWrapper can deal with stray closing pre tags
24323 !!options
24324 parsoid=wt2html
24325 !! wikitext
24326 plain text</pre>
24327 !! html/parsoid
24328 plain text
24329 !!end
24330
24331 !!test
24332 1. Ensure fostered text content is wrapped in element nodes
24333 !!options
24334 parsoid=wt2html
24335 !! wikitext
24336 <table>hi</table><table>ho</table>
24337 !! html/parsoid
24338 <p>hi</p>
24339 <table></table>
24340 <p>ho</p>
24341 <table></table>
24342 !!end
24343
24344 !!test
24345 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24346 !!options
24347 parsoid=wt2html,wt2wt
24348 !! wikitext
24349 <table>
24350 <tr> || ||
24351 <td> a
24352 </table>
24353 !! html/parsoid
24354 <p> || ||
24355 </p><table>
24356 <tbody><tr><td> a</td></tr>
24357 </tbody></table>
24358 !!end
24359
24360 !!test
24361 Encapsulation properly handles null DSR information from foster box
24362 !!options
24363 parsoid=wt2html,wt2wt
24364 !! wikitext
24365 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24366 !! html/parsoid
24367 <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>
24368 !!end
24369
24370 !!test
24371 1. Encapsulate foster-parented transclusion content
24372 !!options
24373 parsoid=wt2wt,wt2html
24374 !! wikitext
24375 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24376 !! html/parsoid
24377 <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>
24378 <tbody>
24379 <tr>
24380 <td>bar</td>
24381 </tr>
24382 </tbody>
24383 </table>
24384 !!end
24385
24386 !!test
24387 2. Encapsulate foster-parented transclusion content
24388 !!options
24389 parsoid=wt2wt,wt2html
24390 !! wikitext
24391 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24392 !! html/parsoid
24393 <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>
24394 <table>
24395 <tbody>
24396 <tr>
24397 <td>bar</td>
24398 </tr>
24399 </tbody>
24400 </table>
24401 !!end
24402
24403 !!test
24404 3. Encapsulate foster-parented transclusion content
24405 !!options
24406 parsoid=wt2wt,wt2html
24407 !! wikitext
24408 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24409 !! html/parsoid
24410 <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;]}">
24411 <p>foo</p>
24412 </div>
24413 <table>
24414 <tbody>
24415 <tr>
24416 <td>bar</td>
24417 </tr>
24418 </tbody>
24419 </table>
24420 !!end
24421
24422 !!test
24423 4. Encapsulate foster-parented transclusion content
24424 !!options
24425 parsoid=wt2wt,wt2html
24426 !! wikitext
24427 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24428 !! html/parsoid
24429 <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;]}">
24430 <p>foo</p>
24431 </div>
24432 <table>
24433 <tbody>
24434 <tr>
24435 <td>bar</td>
24436 </tr>
24437 </tbody>
24438 </table>
24439 !!end
24440
24441 !!test
24442 5. Encapsulate foster-parented transclusion content
24443 !!options
24444 parsoid=wt2wt,wt2html
24445 !! wikitext
24446 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24447 !! html/parsoid
24448 <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>
24449 <table>
24450 <tbody>
24451 <tr>
24452 <td>
24453 <div>
24454 <p>foo</p>
24455 </div>
24456 </td>
24457 </tr>
24458 </tbody>
24459 </table>
24460 !!end
24461
24462 !!test
24463 6. Encapsulate foster-parented transclusion content
24464 !!options
24465 parsoid=wt2wt,wt2html
24466 !! wikitext
24467 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24468 !! html/parsoid
24469 <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>
24470 <table>
24471 <tbody>
24472 <tr>
24473 <td>
24474 <div>
24475 <p>foo</p>
24476 </div>
24477 </td>
24478 </tr>
24479 </tbody>
24480 </table>
24481 <p>ok</p>
24482 !!end
24483
24484 !!test
24485 7. Encapsulate foster-parented transclusion content
24486 !!options
24487 parsoid=wt2wt,wt2html
24488 !! wikitext
24489 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24490 !! html/parsoid
24491 <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>
24492 <table>
24493 <tbody>
24494 <tr>
24495 <td>bar</td>
24496 </tr>
24497 </tbody>
24498 </table>
24499 !!end
24500
24501 # Note that the wt is broken on purpose: the = should be {{=}} if you
24502 # don't want it to be a template parameter key.
24503 !!test
24504 8. Encapsulate foster-parented transclusion content
24505 !!options
24506 parsoid=wt2wt,wt2html
24507 !! wikitext
24508 {{echo|a
24509 }}{|{{echo|style='color:red'}}
24510 |-
24511 |b
24512 |}
24513 !! html/parsoid
24514 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24515 <span> </span>
24516 <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>
24517 <table>
24518 <tbody>
24519 <tr>
24520 <td>b</td>
24521 </tr>
24522 </tbody>
24523 </table>
24524 !!end
24525
24526 !!test
24527 9. Encapsulate foster-parented transclusion content
24528 !!options
24529 parsoid=wt2wt,wt2html
24530 !! wikitext
24531 <table>{{echo|hi</table>hello}}
24532 !! html/parsoid
24533 <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>
24534 !!end
24535
24536 !!test
24537 Table in fosterable position
24538 !!options
24539 parsoid=wt2html,wt2wt
24540 !! wikitext
24541 {{OpenTable}}
24542 <div>
24543 {|
24544 |}
24545 </div>
24546 |}
24547 !! html/parsoid
24548 <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">
24549 </span>
24550 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24551
24552 <table>
24553 </table>
24554 !!end
24555
24556 # Parsoid only for bug 64747
24557 !! test
24558 Properly encapsulate empty-content transclusions in fosterable positions
24559 !! wikitext
24560 <table>
24561 {{#if:|
24562 <td>foo</td>
24563 }}
24564 </table>
24565 !! html/parsoid
24566 <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":["","","",""]}]]}'>
24567
24568 </table>
24569 !! end
24570
24571 !! test
24572 Always encapsulate foster box when template range is expanded to table
24573 !! options
24574 parsoid=wt2wt
24575 !! wikitext
24576 {|
24577 hello
24578 {{OpenTable}}
24579 |}
24580 !! html/parsoid
24581
24582 !! end
24583
24584 !!test
24585 Support <object> element with .data attribute
24586 !!options
24587 parsoid=html2wt
24588 !! html/parsoid
24589 <object data="test.swf"></object>
24590 !! wikitext
24591 <object data="test.swf"></object>
24592 !!end
24593
24594 !! test
24595 Don't block XML namespace declaration
24596 !! wikitext
24597 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24598 !! html/php
24599 <p><span>MediaWiki</span>
24600 </p>
24601 !! html/parsoid
24602 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24603 !! end
24604
24605 # -----------------------------------------------------------------
24606 # The following section of tests are primarily to spec requirements
24607 # around serialization of new/edited content.
24608 #
24609 # All these tests are marked Parsoid html2wt and html2html only
24610 # ----------------------------------------------------------------
24611
24612 # 'mi' is a localinterwiki prefix as well as a language
24613 !! test
24614 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24615 !! options
24616 parsoid=html2wt
24617 !! html/parsoid
24618 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24619 !! wikitext
24620 [[Foo]]
24621 !! end
24622
24623 # See T93839
24624 !! test
24625 New wikilinks should be serialized properly
24626 !! options
24627 parsoid=html2wt
24628 !! html/parsoid
24629 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24630 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24631 !! wikitext
24632 [[Foo]]
24633 [[Foo]]
24634 !! end
24635
24636 !! test
24637 New wiki links (href variations)
24638 !! options
24639 parsoid=html2wt
24640 !! html/parsoid
24641 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24642 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24643 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24644 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24645 !! wikitext
24646 [[Foo_bar]]
24647 [[Foo_bar]]
24648 [[Foo_bar]]
24649 [[Toxine bactérienne]]
24650 !! end
24651
24652 !! test
24653 New wiki links (content string variations)
24654 !! options
24655 parsoid=html2wt
24656 !! html/parsoid
24657 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24658 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24659 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24660 !! wikitext
24661 [[Foo_bar]]
24662 [[Foo bar]]
24663 [[Foo_bar|./Foo_bar]]
24664 !! end
24665
24666 !! test
24667 New category links (href variations)
24668 !! options
24669 parsoid=html2wt
24670 !! html/parsoid
24671 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24672 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24673 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24674 !! wikitext
24675 [[Category:Toxine bactérienne]]
24676 [[Category:Toxine bactérienne]]
24677 [[Category:Toxine bactérienne]]
24678 !! end
24679
24680 !! test
24681 New sol transparent links don't need indent-pre nowiki protection
24682 !! options
24683 parsoid=html2wt
24684 language=de
24685 !! html/parsoid
24686 <link rel="mw:PageProp/redirect" href="./Main_Page">
24687 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24688 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24689 !! wikitext
24690 #WEITERLEITUNG [[Main Page]]
24691 <!-- this is good --> [[Category:Good]]
24692 <!-- this is great --> [[Kategorie:Great]]
24693 !! end
24694
24695 !! test
24696 New interlanguage links (href variations)
24697 !! options
24698 parsoid=html2wt
24699 !! html/parsoid
24700 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24701 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24702 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24703 !! wikitext
24704 [[es:Toxine bactérienne]]
24705 [[es:Toxine_bactérienne]]
24706 [[es:Toxine_bactérienne]]
24707 !! end
24708
24709 !! test
24710 Image: Modifying size of an image (1)
24711 !! options
24712 parsoid={
24713 "modes": ["wt2wt"],
24714 "changes": [
24715 ["img[height]", "attr", "height", "22"],
24716 ["img[width]", "attr", "width", "200"]
24717 ]
24718 }
24719 !! wikitext
24720 [[Image:Foobar.jpg|230x230px]]
24721 !! wikitext/edited
24722 [[Image:Foobar.jpg|200x200px]]
24723 !!end
24724
24725 !! test
24726 Image: Modifying size of an image (2)
24727 !! options
24728 parsoid={
24729 "modes": ["wt2wt"],
24730 "changes": [
24731 ["img[height]", "attr", "height", "100"],
24732 ["img[width]", "attr", "width", "500"]
24733 ]
24734 }
24735 !! wikitext
24736 [[Image:Foobar.jpg|230x230px]]
24737 !! wikitext/edited
24738 [[Image:Foobar.jpg|500x500px]]
24739 !!end
24740
24741 # Change in size is ignored so long as class='mw-default-size'
24742 !! test
24743 Image: Modifying size of an image (3)
24744 !! options
24745 parsoid={
24746 "modes": ["wt2wt"],
24747 "changes": [
24748 ["figure[class]", "removeClass", "mw-default-size"],
24749 ["figure img", "attr", "height", "19"],
24750 ["figure img", "attr", "width", "170"]
24751 ]
24752 }
24753 !! wikitext
24754 [[Image:Foobar.jpg|thumb]]
24755 !! wikitext/edited
24756 [[Image:Foobar.jpg|thumb|170x170px]]
24757 !!end
24758
24759 !! test
24760 Image: Modifying alignment of an image (bug 48665)
24761 !! options
24762 parsoid={
24763 "modes": ["wt2wt"],
24764 "changes": [
24765 ["figure[class]", "removeClass", "mw-halign-right"],
24766 ["figure[class]", "addClass", "mw-halign-left"]
24767 ]
24768 }
24769 !! wikitext
24770 [[Image:Foobar.jpg|thumb|caption|right]]
24771 !! wikitext/edited
24772 [[Image:Foobar.jpg|thumb|caption|left]]
24773 !! end
24774
24775 !! test
24776 Image: Modifying mw-default-size of an frameless image (bug 62805)
24777 !! options
24778 parsoid={
24779 "modes": ["wt2wt"],
24780 "changes": [
24781 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24782 ]
24783 }
24784 !! wikitext
24785 [[Image:Foobar.jpg|frameless|right]]
24786 !! wikitext/edited
24787 [[Image:Foobar.jpg|frameless|right|220x220px]]
24788 !! end
24789
24790 !! test
24791 Image: Modifying valign of an image (bug 49221)
24792 !! options
24793 parsoid={
24794 "modes": ["wt2wt"],
24795 "changes": [
24796 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24797 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24798 ]
24799 }
24800 !! wikitext
24801 [[File:Foobar.jpg|20px|middle]]
24802 !! wikitext/edited
24803 [[File:Foobar.jpg|20px|text-top]]
24804 !! end
24805
24806 !! test
24807 Image: Modifying alt attribute of an image (bug 56400)
24808 !! options
24809 parsoid={
24810 "modes": ["wt2wt"],
24811 "changes": [
24812 ["img[alt]", "attr", "alt", "some alternate edited text"]
24813 ]
24814 }
24815 !! wikitext
24816 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24817 !! wikitext/edited
24818 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24819 !!end
24820
24821 !! test
24822 Image: Modifying caption of an image
24823 !! options
24824 parsoid={
24825 "modes": ["wt2wt"],
24826 "changes": [
24827 ["figcaption", "text", "new caption"]
24828 ]
24829 }
24830 !! wikitext
24831 [[Image:Foobar.jpg|thumb|original caption]]
24832 !! wikitext/edited
24833 [[Image:Foobar.jpg|thumb|new caption]]
24834 !!end
24835
24836 !! test
24837 Image: empty alt attribute (bug 48924)
24838 !! options
24839 parsoid
24840 !! wikitext
24841 [[File:Foobar.jpg|thumb|alt=|bar]]
24842 !! html
24843 <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>
24844 !! end
24845
24846 !! test
24847 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24848 !! options
24849 parsoid=html2wt
24850 language=ar
24851 disabled
24852 !! html/parsoid
24853 <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>
24854 !! wikitext
24855 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24856 !! end
24857
24858 !! test
24859 Image: Block level image should have \n before and after
24860 !! wikitext
24861 123
24862 [[File:Foobar.jpg|right|thumb|150x150px]]
24863 456
24864 !! html/parsoid
24865 <p>123</p>
24866 <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>
24867 <p>456</p>
24868 !!end
24869
24870 !! test
24871 Image: New block level image should have \n before and after (existing content)
24872 !! wikitext
24873 123
24874 [[File:Foobar.jpg|right|thumb|150x150px]]
24875 456
24876 !! html/parsoid
24877 <p>123</p>
24878 <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>
24879 <p>456</p>
24880 !!end
24881
24882 !! test
24883 Image: upright option (parsoid)
24884 !! wikitext
24885 [[File:Foobar.jpg|thumb|upright|caption]]
24886 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24887 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24888 !! html/parsoid
24889 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/170px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="19" width="170"/></a><figcaption>caption</figcaption></figure>
24890 <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>
24891 <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>
24892 !!end
24893
24894 !! test
24895 Image: upright option is ignored on inline and frame images (parsoid)
24896 !! wikitext
24897 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24898 !! html/parsoid
24899 <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>
24900 !!end
24901
24902 !! test
24903 Image: from basic HTML (1)
24904 !! options
24905 parsoid=html2wt
24906 !! html/parsoid
24907 <span typeof="mw:Image">
24908 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24909 </span>
24910 !! wikitext
24911 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24912 !! end
24913
24914 !! test
24915 Image: from basic HTML (2)
24916 !! options
24917 parsoid=html2wt
24918 !! html/parsoid
24919 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24920 !! wikitext
24921 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24922 !! end
24923
24924 !! test
24925 Image: from basic HTML (3)
24926 !! options
24927 parsoid=html2wt
24928 !! html/parsoid
24929 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24930 !! wikitext
24931 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24932 !! end
24933
24934 !! test
24935 Image: from basic HTML (4)
24936 !! options
24937 parsoid=html2wt
24938 !! html/parsoid
24939 <img src="./File:Foobar.jpg">
24940 !! wikitext
24941 [[File:Foobar.jpg|link=]]
24942 !! end
24943
24944 !! test
24945 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24946 !! options
24947 parsoid=html2wt
24948 !! html/parsoid
24949 <ul>
24950 <li><p>foo</p></li>
24951 </ul>
24952 !! wikitext
24953 * foo
24954 !! end
24955
24956 !! test
24957 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24958 !! options
24959 parsoid=html2wt
24960 !! html/parsoid
24961 <ul> <li>foo</li></ul>
24962 !! wikitext
24963 * foo
24964 !! end
24965
24966 !! test
24967 Don't strip leading whitespace when handling indent-pre suppressing tags
24968 !! options
24969 parsoid=html2wt
24970 !! html/parsoid
24971 <table>
24972 <tr><td> indented row</td></tr>
24973 </table>
24974 <blockquote><p>
24975 <b>This is very bold of you!</b>
24976 </p>
24977 <table><tr><td>
24978 indented cell (no pre-wrapping!)
24979 </td></tr></table>
24980 </blockquote>
24981 <p>foo</p>
24982 <div>bar</div>
24983 !! wikitext
24984 {|
24985 | indented row
24986 |}
24987 <blockquote>
24988 '''This is very bold of you!'''
24989
24990 {|
24991 |
24992 indented cell (no pre-wrapping!)
24993 |}
24994 </blockquote>
24995 foo
24996 <div>bar</div>
24997 !! end
24998
24999 !! test
25000 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25001 !! options
25002 parsoid=html2wt
25003 !! html/parsoid
25004 <p>foo</p>
25005 <span>bar</span>
25006
25007 <span>foo2
25008 </span>bar2
25009
25010 <div>foo</div>
25011 <span>bar</span>
25012
25013 <div>
25014 <span>foo</span>
25015 </div>
25016 !! wikitext
25017 foo
25018
25019 <span>bar</span>
25020
25021 <span>foo2
25022 <nowiki> </nowiki></span>bar2
25023
25024 <div>foo</div>
25025 <nowiki> </nowiki><span>bar</span>
25026
25027 <div>
25028 <nowiki> </nowiki><span>foo</span>
25029 </div>
25030 !! end
25031
25032 !! test
25033 Lists: Dont insert newlines in a serialized list item.
25034 !! options
25035 parsoid=html2wt
25036 !! html/parsoid
25037 <ul><li>a<br>b</li><li>c</li></ul>
25038 !! wikitext
25039 * a<br>b
25040 * c
25041 !! end
25042
25043 !! test
25044 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25045 !! options
25046 parsoid={
25047 "modes": ["html2wt"],
25048 "scrubWikitext": false
25049 }
25050 !! html/parsoid
25051 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25052 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25053
25054 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25055 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25056
25057 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25058
25059 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25060 !! wikitext
25061 == hello there [[Category:A1]] ==
25062
25063 == [[Category:A2]] hi pal ==
25064
25065 == <!--foo--> [[Category:A3]] how goes it ==
25066
25067 == it goes well [[Category:A4]] <!--bar--> ==
25068
25069 ==howdy [[Category:A5]]==
25070
25071 == __TOC__ ok ==
25072 !! end
25073
25074 !! test
25075 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25076 !! options
25077 parsoid={
25078 "modes": ["html2wt"],
25079 "scrubWikitext": true
25080 }
25081 !! html/parsoid
25082 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25083 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25084
25085 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25086 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25087
25088 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25089 !! wikitext
25090 == hello there ==
25091 [[Category:A1]]
25092 [[Category:A2]]
25093
25094 == hi pal ==
25095
25096 <!--foo--> [[Category:A3]]
25097
25098 == how goes it ==
25099
25100 == it goes well ==
25101 [[Category:A4]] <!--bar-->
25102
25103 __TOC__
25104
25105 == ok ==
25106 !! end
25107
25108 !! test
25109 Headings: Don't hoist metas that come from templates
25110 !! options
25111 parsoid={
25112 "modes": ["html2wt"],
25113 "scrubWikitext": true
25114 }
25115 !! html/parsoid
25116 <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>
25117 !! wikitext
25118 == {{echo|foo [[Category:Foo]]}} ==
25119 !! end
25120
25121 !! test
25122 Headings: Category in ref isn't hoisted
25123 !! options
25124 parsoid={
25125 "modes": ["html2wt"],
25126 "scrubWikitext": true
25127 }
25128 !! html/parsoid
25129 <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>
25130
25131 <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>
25132 !! wikitext
25133 == foo <ref>bar
25134 [[Category:Baz]] </ref> ==
25135
25136 <references />
25137 !! end
25138
25139 !! test
25140 Parsoid: Serialize positional parameters with = in them as named parameter
25141 !! options
25142 parsoid=html2wt
25143 !! html/parsoid
25144 <p about="#mwt1" typeof="mw:Transclusion"
25145 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25146
25147 <p about="#mwt1" typeof="mw:Transclusion"
25148 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25149
25150 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25151 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25152 <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>
25153 !! wikitext
25154 {{echo|1 = f=oo}}
25155
25156 {{echo|1 = f=oo|2 = bar}}
25157
25158 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25159 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25160 {{echo|<nowiki>f=oo</nowiki>|bar}}
25161 !! end
25162
25163 !! test
25164 Parsoid: Serialize positional parameters with = in extlink as named parameter
25165 !! options
25166 parsoid=html2wt
25167 !! html/parsoid
25168 <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>
25169 !! wikitext
25170 {{echo|1 = http://stuff?is=ok}}
25171 !! end
25172
25173 !! test
25174 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25175 !! options
25176 parsoid=html2wt
25177 !! html/parsoid
25178 <div>a<p>b</p></div>
25179 <div>a
25180 <p>b</p></div>
25181 <div>
25182 a
25183 <p>b</p></div>
25184 !! wikitext
25185 <div>a
25186 b
25187 </div>
25188 <div>a
25189 b
25190 </div>
25191 <div>
25192 a
25193
25194 b
25195 </div>
25196 !! end
25197
25198 !! test
25199 Substrings resembling wikitext in hrefs should not get nowiki escapes
25200 !! options
25201 parsoid=html2wt
25202 !! html/parsoid
25203 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25204 !! wikitext
25205 [[Foo''bar''baz]]
25206 !! end
25207
25208 !! test
25209 Enforce single-line context in the serializer
25210 !! options
25211 parsoid=html2wt
25212 !! html/parsoid
25213 <h2>testing
25214 123</h2>
25215
25216 <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">
25217 </span><span about="#mwt1">you</span> </h2>
25218
25219 <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>
25220
25221 <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
25222 there</span></li></ol>
25223
25224 <ul><li>asd
25225 sdf</li></ul>
25226
25227 <ul><li>foo
25228 bar
25229 baz</li>
25230 <li>foo <b>bar</b>
25231 baz</li></ul>
25232
25233 <dl><dt>hi
25234 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25235 ho</dd></dl>
25236
25237 <dl><dd> <table>
25238 <tbody><tr><td> ha
25239 ha
25240 ha</td></tr>
25241 </tbody></table></dd></dl>
25242 !! wikitext
25243 == testing 123 ==
25244
25245 == hi {{bogus|there
25246 you}} ==
25247
25248 == foo <ref>hello
25249 there</ref> ==
25250
25251 <references />
25252
25253 * asd sdf
25254
25255 * foo bar baz
25256 * foo '''bar''' baz
25257
25258 ; hi ho : hi ho
25259
25260 : {|
25261 | ha
25262 ha
25263 ha
25264 |}
25265 !! end
25266
25267 !! test
25268 Serialize new placeholder space without spans
25269 !! options
25270 parsoid=html2wt
25271 !! html/parsoid
25272 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25273
25274 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25275
25276 <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>
25277 !! wikitext
25278 foo : bar
25279
25280 foo : bar
25281
25282 <ref>foo : bar</ref>ok
25283 !! end
25284
25285
25286 #-----------------------
25287 # Tag minimization tests
25288 #-----------------------
25289
25290 !! test
25291 1. I/B quote minimization: wikitext-only tags should be combined
25292 !! options
25293 parsoid=html2wt
25294 !! html/parsoid
25295 <p><i>A</i><i>B</i></p>
25296 <p><b>A</b><b>B</b></p>
25297 <p><i>A</i><b><i>B</i></b></p>
25298 <p><b>A</b><i><b>B</b></i></p>
25299 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25300 <p><i><b>A</b></i><i><b>B</b></i></p>
25301 <p><i><b>A</b></i><b><i>B</i></b></p>
25302 <p><b><i>A</i></b><i><b>B</b></i></p>
25303 !! wikitext
25304 ''AB''
25305
25306 '''AB'''
25307
25308 ''A'''B'''''
25309
25310 '''A''B'''''
25311
25312 '''A''BC''D'''
25313
25314 '''''AB'''''
25315
25316 '''''AB'''''
25317
25318 '''''AB'''''
25319 !! end
25320
25321 !! test
25322 2. I/B quote minimization: wikitext and html tags should not be combined
25323 !! options
25324 parsoid=html2wt
25325 !! html/parsoid
25326 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25327 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25328 !! wikitext
25329 ''A''<i>B</i>
25330
25331 ''A''<nowiki/>'''<i>B</i>'''
25332 !! end
25333
25334 !! test
25335 3. I/B quote minimization: templated content stops minimization
25336 !! options
25337 parsoid=html2wt
25338 !! html/parsoid
25339 <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>
25340 <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>
25341 !! wikitext
25342 ''A''{{echo|''B''}}
25343
25344 ''A''{{echo|'''''B'''''}}
25345 !! end
25346
25347 !! test
25348 4. I/B quote minimization: new content should be mimimized with adjacent old content
25349 !! options
25350 parsoid=html2wt
25351 !! html/parsoid
25352 <p><i>A</i><i>B</i></p>
25353 <p><b>A</b><b>B</b></p>
25354 <p><i>A</i><b><i>B</i></b></p>
25355 !! wikitext
25356 ''AB''
25357
25358 '''AB'''
25359
25360 ''A'''B'''''
25361 !! end
25362
25363 !! test
25364 5a. Merge adjacent quote nodes if they've been edited
25365 !! options
25366 parsoid={
25367 "modes": ["wt2wt", "selser"],
25368 "changes": [
25369 ["p", "contents", "remove", ":contains('b')"]
25370 ]
25371 }
25372 !! wikitext
25373 ''a''b''c''
25374 !! wikitext/edited
25375 ''ac''
25376 !! end
25377
25378 !! test
25379 5b. Merge adjacent quote nodes if they've been edited
25380 !! options
25381 parsoid={
25382 "modes": ["wt2wt", "selser"],
25383 "changes": [
25384 ["#x", "remove"]
25385 ]
25386 }
25387 !! wikitext
25388 ''a''<span id="x">b</span>''c''
25389 !! wikitext/edited
25390 ''ac''
25391 !! end
25392
25393 !! test
25394 1. Merge adjacent link nodes as long as at least one element is new
25395 !! options
25396 parsoid={
25397 "modes": ["html2wt"],
25398 "scrubWikitext": true
25399 }
25400 !! html/parsoid
25401 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25402 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25403 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25404 !! wikitext
25405 [[Football]]
25406 [[Football]]
25407 [[Football|Foot]][[Football|ball]]
25408 !! end
25409
25410 !! test
25411 2. Merge adjacent link nodes and enable additional normalizations
25412 !! options
25413 parsoid={
25414 "modes": ["html2wt"],
25415 "scrubWikitext": true
25416 }
25417 !! html/parsoid
25418 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25419 !! wikitext
25420 [[Football|''Football'']]
25421 !! end
25422
25423 !! test
25424 3. Don't merge adjacent link nodes if scrubWikitext is false
25425 !! options
25426 parsoid={
25427 "modes": ["html2wt"],
25428 "scrubWikitext": false
25429 }
25430 !! html/parsoid
25431 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25432 !! wikitext
25433 [[Football|Foot]][[Football|ball]]
25434 !! end
25435
25436 #------------------------------
25437 # End of tag minimization tests
25438 #------------------------------
25439
25440 !!test
25441 Bug 54262: New entities
25442 !! options
25443 parsoid=html2wt
25444 !! html/parsoid
25445 <span typeof="mw:Entity">&nbsp;</span>
25446 !! wikitext
25447 &nbsp;
25448 !! end
25449
25450 ## Note that there is no wikitext output for 'unknownproperty' ##
25451 ## Unknown magic words are silently dropped ##
25452
25453 !! test
25454 Magic words
25455 !! options
25456 parsoid=html2wt
25457 !! html/parsoid
25458 <meta property='mw:PageProp/toc' />
25459 <meta property='mw:PageProp/notoc' />
25460 <meta property='mw:PageProp/forcetoc' />
25461 <meta property='mw:PageProp/index' />
25462 <meta property='mw:PageProp/noindex' />
25463 <meta property='mw:PageProp/nogallery' />
25464 <meta property='mw:PageProp/noeditsection' />
25465 <meta property='mw:PageProp/notitleconvert' />
25466 <meta property='mw:PageProp/nocontentconvert' />
25467 <meta property='mw:PageProp/unknownproperty' />
25468 !! wikitext
25469 __TOC__
25470 __NOTOC__
25471 __FORCETOC__
25472 __INDEX__
25473 __NOINDEX__
25474 __NOGALLERY__
25475 __NOEDITSECTION__
25476 __NOTITLECONVERT__
25477 __NOCONTENTCONVERT__
25478 !! end
25479
25480 !! test
25481 Consecutive <pre>s should not get merged
25482 !! options
25483 parsoid=html2wt,html2html
25484 !! html/parsoid
25485 <pre>a</pre><pre>b</pre>
25486
25487 <pre>c
25488 </pre><pre>
25489 d</pre>
25490
25491 <pre>e
25492
25493 </pre><pre>
25494
25495 f</pre>
25496 !! wikitext
25497 a
25498
25499 b
25500
25501 c
25502
25503 d
25504
25505 e
25506
25507
25508
25509 f
25510 !! end
25511
25512 !! test
25513 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25514 !! options
25515 parsoid=html2wt
25516 !! html/parsoid
25517 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25518 !! wikitext
25519 [[Special:BookSources/1234567890|ISBN 1234567895]]
25520 !! end
25521
25522 !! test
25523 Edited RFC links not serializable as RFC links should serialize as extlinks
25524 !! options
25525 parsoid=html2wt
25526 !! html/parsoid
25527 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25528 !! wikitext
25529 [//tools.ietf.org/html/rfc123 New RFC]
25530 !! end
25531
25532 !! test
25533 Edited PMID links not serializable as PMID links should serialize as extlinks
25534 !! options
25535 parsoid=html2wt
25536 !! html/parsoid
25537 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25538 !! wikitext
25539 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25540 !! end
25541
25542 !! test
25543 WTS of autolinks with trailing/surrounding context
25544 !! options
25545 parsoid=html2wt
25546 !! html/parsoid
25547 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25548 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25549 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25550 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25551 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25552 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25553 !! wikitext
25554 http://cscott.net'''foo'''
25555
25556 http://cscott.net<b>foo</b>
25557
25558 '''http://cscott.net'''
25559
25560 '''http://cscott.net '''
25561
25562 '''http://cscott.net<nowiki/>x'''
25563
25564 http://cscott.net<nowiki/>x
25565 !! end
25566
25567 !! test
25568 WTS of autolinks with nowikis (round-trip)
25569 !! wikitext
25570 x<nowiki/>http://cscott.net<nowiki/>x
25571 !! html/parsoid
25572 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25573 !! end
25574
25575 # this is the "easy" test because it leaves in place all the
25576 # data-parsoid information indicating this is an autolink
25577 !! test
25578 WTS of autolinks with escapes (editing)
25579 !! options
25580 parsoid={
25581 "modes": ["wt2wt"],
25582 "changes": [
25583 [ "meta", "remove" ]
25584 ]
25585 }
25586 !! wikitext
25587 x<nowiki/>http://cscott.net<nowiki/>x
25588 !! wikitext/edited
25589 x<nowiki/>http://cscott.net<nowiki/>x
25590 !! end
25591
25592 !! test
25593 WTS of edited autolink-like text (T103364)
25594 !! options
25595 parsoid={
25596 "modes": ["wt2wt"],
25597 "changes": [
25598 [ "span[typeof]", "removeAttr", "typeof" ]
25599 ]
25600 }
25601 !! wikitext
25602 Not a link: <nowiki>http://example.com</nowiki>.
25603 !! wikitext/edited
25604 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25605 !! end
25606
25607 !! test
25608 WTS of newly-authored autolink-like text (T103364)
25609 !! options
25610 parsoid=html2wt
25611 !! html/parsoid
25612 <p>http://example.com is not a link.</p>
25613 !! wikitext
25614 <nowiki>http://example.com</nowiki> is not a link.
25615 !! end
25616
25617 !! test
25618 WTS of autolink-like text after an autolink (T108563)
25619 !! options
25620 parsoid=html2wt
25621 !! html/parsoid
25622 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25623 !! wikitext
25624 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25625 !! end
25626
25627 !! test
25628 Magic links inside links (not autolinked)
25629 !! wikitext
25630 [[Foo|http://example.com]]
25631 [[Foo|RFC 1234]]
25632 [[Foo|PMID 1234]]
25633 [[Foo|ISBN 123456789x]]
25634
25635 [http://foo.com http://example.com]
25636 [http://foo.com RFC 1234]
25637 [http://foo.com PMID 1234]
25638 [http://foo.com ISBN 123456789x]
25639 !! html+tidy
25640 <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>
25641 <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>
25642 !! html/parsoid
25643 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25644 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25645 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25646 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25647
25648 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25649 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25650 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25651 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25652 !! end
25653
25654 !! test
25655 Magic links inside image captions (autolinked)
25656 !! wikitext
25657 [[File:Foobar.jpg|thumb|http://example.com]]
25658 [[File:Foobar.jpg|thumb|RFC 1234]]
25659 [[File:Foobar.jpg|thumb|PMID 1234]]
25660 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25661 !! html+tidy
25662 <div class="thumb tright">
25663 <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>
25664 <div class="thumbcaption">
25665 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25666 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25667 </div>
25668 </div>
25669 <div class="thumb tright">
25670 <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>
25671 <div class="thumbcaption">
25672 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25673 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25674 </div>
25675 </div>
25676 <div class="thumb tright">
25677 <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>
25678 <div class="thumbcaption">
25679 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25680 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25681 </div>
25682 </div>
25683 <div class="thumb tright">
25684 <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>
25685 <div class="thumbcaption">
25686 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25687 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25688 </div>
25689 </div>
25690 !! html/parsoid
25691 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
25692 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
25693 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></figcaption></figure>
25694 <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>
25695 !! end
25696
25697 !! test
25698 WTS of magic word text (T109371)
25699 !! options
25700 parsoid=html2wt
25701 !! html/parsoid
25702 <p>RFC 1234</p>
25703 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25704 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25705 !! wikitext
25706 <nowiki>RFC 1234</nowiki>
25707
25708 [http://foo.com RFC 1234]
25709
25710 [[Foo|RFC 1234]]
25711 !! end
25712
25713 !! test
25714 Edited Redirect link should emit a non-piped wikitext link
25715 !! options
25716 parsoid=html2wt
25717 !! html/parsoid
25718 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25719 !! wikitext
25720 #REDIRECT [[Bar]]
25721 !! end
25722
25723 !! test
25724 T75121: Infer extension name from typeOf if data-mw is not present
25725 !! options
25726 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25727 !! html/parsoid
25728 <div typeOf="mw:Extension/foo"></div>
25729 !! wikitext
25730 <foo />
25731 !! end
25732
25733 # Note that the <p> wrapping isn't present in PHP parser output
25734 # The important thing for this test is that P-wrapping doesn't
25735 # interfere with the <nowiki> protection for leading - in <td>
25736 # (which isn't necessary for <th>).
25737 !! test
25738 T88318: p-wrapped dash in table.
25739 !! options
25740 parsoid=html2wt,wt2wt
25741 !! html/parsoid
25742 <table><tbody>
25743 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25744 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25745 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25746 </tbody></table>
25747 !! wikitext
25748 {|
25749 !-
25750 !-
25751 |-
25752 |<nowiki>-</nowiki>
25753 |<nowiki>- </nowiki>
25754 |-
25755 |<small>-</small>
25756 |<br>
25757 -
25758 |<br>
25759 -
25760 |}
25761 !! html/php+tidy
25762 <table>
25763 <tr>
25764 <th>-</th>
25765 <th>-</th>
25766 </tr>
25767 <tr>
25768 <td>-</td>
25769 <td>-</td>
25770 </tr>
25771 <tr>
25772 <td><small>-</small></td>
25773 <td><br />
25774 <p>-</p>
25775 </td>
25776 <td><br />
25777 <p>-</p>
25778 </td>
25779 </tr>
25780 </table>
25781 !! end
25782
25783 !! test
25784 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25785 !! options
25786 parsoid=html2wt
25787 !! html/parsoid
25788 <table id='mwAb'>
25789 <td id='mwAc'>foo</td>
25790 <td id='serialize-this'>bar</td>
25791 </table>
25792 !! wikitext
25793 {|
25794 |foo
25795 | id="serialize-this" |bar
25796 |}
25797 !! end
25798
25799 !! test
25800 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25801 !! options
25802 parsoid=html2wt
25803 !! html/parsoid
25804 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25805 !! wikitext
25806 <div id="hello">ok</div>
25807 !! end
25808
25809 !! test
25810 WTS change modes
25811 !! options
25812 parsoid={
25813 "modes": ["wt2wt"],
25814 "changes": [
25815 [ "#xyz", "before", "<b>before</b> stuff " ],
25816 [ "#xyz", "after", " stuff <i>after</i>" ],
25817 [ "#xyz", "html", "x <b>y</b> z" ]
25818 ]
25819 }
25820 !! wikitext
25821 <span id="xyz">hello</span>
25822 !! wikitext/edited
25823 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25824 !! end
25825
25826 !! test
25827 Never serialize a-tag as html, regardless of what data-parsoid has to say
25828 !! options
25829 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25830 !! html/parsoid
25831 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25832 !! wikitext
25833 [[Foo]]
25834 !! end
25835
25836 ## SSS FIXME: This is broken output nevertheless.
25837 ## What might be a reasonable non-broken output for this?
25838 ## This is an edge case unlikely to be seen in production
25839 ## that I am not wasting more time on this right now.
25840 !! test
25841 Never serialize a-tag as html, no matter what attributes it has
25842 !! options
25843 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25844 !! html/parsoid
25845 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25846 !! wikitext
25847 [http://boo.org http://boohoo.org]
25848 !! end
25849
25850 # Misnested is an indication that selser can reuse the source but these have
25851 # shown to sneak through on occasion. See T101768.
25852 # The original wikitext here is: [http://test.com [[one]] two three]
25853 !! test
25854 Strip span tags added to mark misnested links
25855 !! options
25856 parsoid=html2wt
25857 !! html/parsoid
25858 <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>
25859 !! wikitext
25860 [http://test.com][[one]] two three
25861 !! end
25862
25863 !! test
25864 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25865 !! options
25866 parsoid=html2wt
25867 !! html/parsoid
25868 <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|}"]}'>
25869 <tbody><tr><td>d
25870 </td></tr>
25871 </tbody></table>
25872 !! wikitext
25873 {{echo|a}}
25874 {|{{echo|c
25875 {{!}}d
25876 }}
25877 |}
25878 !! end
25879
25880 ## This test verifies the presence and computation of this attribute indirectly
25881 ## by making an edit and ensuring that the serialization is correct (which it would be
25882 ## only if firstWikitextNode is properly set).
25883 !! test
25884 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25885 !! options
25886 parsoid= {
25887 "modes": ["wt2wt"],
25888 "changes": [
25889 [ "div#x", "remove" ],
25890 [ "div", "before", "<div>new</div>" ]
25891 ]
25892 }
25893 !! wikitext
25894 <div id="x">foo</div>
25895 {|
25896 {{echo|<div>boo</div>
25897 {{!}}b}}
25898 |c
25899 |}
25900 !! wikitext/edited
25901
25902 <div>new</div>
25903 {|
25904 {{echo|<div>boo</div>
25905 {{!}}b}}
25906 |c
25907 |}
25908 !! end
25909
25910 # --------------------------------------------
25911 # Tests spec'ing wikitext serialization norms |
25912 # --------------------------------------------
25913
25914 !! test
25915 1. Categories should always be serialized on their own line
25916 !! options
25917 parsoid=html2wt
25918 !! html/parsoid
25919 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
25920 !! wikitext
25921 foo
25922 [[Category:Foo]]
25923 bar
25924 !! end
25925
25926 !! test
25927 2. Categories that are part of templates should not introduce a line break
25928 !! wikitext
25929 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
25930 !! html/parsoid
25931 <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>
25932 !! end
25933
25934 # Careful while editing these next 2 tests. There are \u200f characters
25935 # before and after the <link> tags in the HTML and following some
25936 # of the categories in wikitext
25937 # Do not remove these characters in edits.
25938 #
25939 # As part of the serialization, these bidi characters will get stripped.
25940 !! test
25941 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
25942 !! options
25943 parsoid={
25944 "modes": ["html2wt"],
25945 "scrubWikitext": true
25946 }
25947 !! html/parsoid
25948 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
25949 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
25950 !! wikitext
25951 [[קטגוריה:טקסים]]
25952 [[קטגוריה: שיטות משפט]]
25953 !! end
25954
25955 !! test
25956 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
25957 !! options
25958 parsoid={
25959 "modes": ["html2wt"],
25960 "scrubWikitext": true
25961 }
25962 !! html/parsoid
25963 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
25964 !! wikitext
25965 [[קטגוריה:טקסים]]
25966 ‏y
25967 !! end
25968
25969 !! test
25970 Lists: Add space after bullets
25971 !! options
25972 parsoid=html2wt
25973 !! html/parsoid
25974 <ul>
25975 <li>foo</li>
25976 <li> bar</li>
25977 <li><span> baz</span></li>
25978 </ul>
25979 !! wikitext
25980 * foo
25981 * bar
25982 * <span> baz</span>
25983 !! end
25984
25985 !! test
25986 1. Headings: Add space before/after == (T53744)
25987 !! options
25988 parsoid=html2wt
25989 !! html/parsoid
25990 <h2>foo</h2>
25991 <h2> bar</h2>
25992 <h2>baz </h2>
25993 <h2><span> baz</span></h2>
25994 !! wikitext
25995 == foo ==
25996
25997 == bar ==
25998
25999 == baz ==
26000
26001 == <span> baz</span> ==
26002 !! end
26003
26004 !! test
26005 2. Headings: Add space before/after == even after hoisted content
26006 !! options
26007 parsoid={
26008 "modes": ["html2wt"],
26009 "scrubWikitext": true
26010 }
26011 !! html/parsoid
26012 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26013 !! wikitext
26014 [[Category:A2]]
26015
26016 == ok ==
26017 !! end
26018
26019 !! test
26020 1. Headings: suppress newly created empty headings
26021 !! options
26022 parsoid={
26023 "modes": ["html2wt"],
26024 "scrubWikitext": true
26025 }
26026 !! html/parsoid
26027 <h2></h2>
26028 !! wikitext
26029 !! end
26030
26031 !! test
26032 2. Headings: don't suppress empty headings if scrubWikitext is false
26033 !! options
26034 parsoid=html2wt
26035 !! html/parsoid
26036 <h2></h2>
26037 !! wikitext
26038 ==<nowiki/>==
26039 !! end
26040
26041 !! test
26042 3. Headings: suppress empty headings on edits
26043 !! options
26044 parsoid={
26045 "modes": ["selser"],
26046 "scrubWikitext": true,
26047 "changes": [
26048 [ "#x", "remove"]
26049 ]
26050 }
26051 !! wikitext
26052 ==<span id="x">foo</span>==
26053 !! wikitext/edited
26054 !! end
26055
26056 !! test
26057 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26058 !! options
26059 parsoid={
26060 "modes": ["html2wt"],
26061 "scrubWikitext": true
26062 }
26063 !! html/parsoid
26064 <h2>foo<br/>bar</h2>
26065 <h2>foo <span><br/>bar</span> baz</h2>
26066 !! wikitext
26067 == foo bar ==
26068
26069 == foo <span> bar</span> baz ==
26070 !! end
26071
26072 !! test
26073 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26074 !! options
26075 parsoid={
26076 "modes": ["html2wt"],
26077 "scrubWikitext": false
26078 }
26079 !! html/parsoid
26080 <h2>foo<br/>bar</h2>
26081 !! wikitext
26082 == foo<br> bar ==
26083 !! end
26084
26085 !! test
26086 1. WT Quote Tags: suppress newly created empty style tags
26087 !! options
26088 parsoid={
26089 "modes": ["html2wt"],
26090 "scrubWikitext": true
26091 }
26092 !! html/parsoid
26093 <i></i><b></b>
26094 !! wikitext
26095 !! end
26096
26097 !! test
26098 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26099 !! options
26100 parsoid=html2wt
26101 !! html/parsoid
26102 <i></i><b></b>
26103 !! wikitext
26104 ''<nowiki/>'''''<nowiki/>'''
26105 !! end
26106
26107 !! test
26108 3. WT Quote Tags: suppress empty style tags on edits
26109 !! options
26110 parsoid={
26111 "modes": ["selser"],
26112 "scrubWikitext": true,
26113 "changes": [
26114 [ "#x", "remove"]
26115 ]
26116 }
26117 !! wikitext
26118 '''<span id="x">foo</span>'''
26119 !! wikitext/edited
26120 !! end
26121
26122 !! test
26123 1. Anchors: suppress newly created empty anchors
26124 !! options
26125 parsoid={
26126 "modes": ["html2wt"],
26127 "scrubWikitext": true
26128 }
26129 !! html/parsoid
26130 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26131 !! wikitext
26132 !! end
26133
26134 !! test
26135 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26136 !! options
26137 parsoid={
26138 "modes": ["html2wt"],
26139 "scrubWikitext": false
26140 }
26141 !! html/parsoid
26142 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26143 !! wikitext
26144 [[Test|<nowiki/>]]
26145 !! end
26146
26147 !! test
26148 3. Anchors: suppress empty anchors on edits
26149 !! options
26150 parsoid={
26151 "modes": ["selser"],
26152 "scrubWikitext": true,
26153 "changes": [
26154 [ "#x", "remove"]
26155 ]
26156 }
26157 !! wikitext
26158 [[Test|<span id="x">foo</span>]]
26159 !! wikitext/edited
26160 !! end
26161
26162 !! test
26163 3a. Anchors: do not suppress numbered extlinks
26164 !! options
26165 parsoid={
26166 "modes": ["wt2wt"],
26167 "scrubWikitext": true
26168 }
26169 !! wikitext
26170 [http://foo.com]
26171 !! html/parsoid
26172 <a rel="mw:ExtLink" href="http://foo.com"></a>
26173 !! end
26174
26175 !! test
26176 3b. Anchors: do not suppress numbered extlinks
26177 !! options
26178 parsoid={
26179 "modes": ["wt2wt"],
26180 "scrubWikitext": true,
26181 "changes": [
26182 [ "#x", "remove"]
26183 ]
26184 }
26185 !! wikitext
26186 [http://foo.com <span id="x">foo</span>]
26187 !! wikitext/edited
26188 [http://foo.com]
26189 !! end
26190
26191 !!test
26192 Normalizations should be restricted to edited content
26193 !!options
26194 parsoid={
26195 "modes": ["selser"],
26196 "scrubWikitext": true,
26197 "changes": [
26198 [ "h1", "before", "<i></i>"]
26199 ]
26200 }
26201 !!wikitext
26202 a
26203 = =
26204 b
26205 !!wikitext/edited
26206 a
26207 = =
26208 b
26209 !!end
26210
26211 !! test
26212 1. Multiple normalizations (html2wt)
26213 !! options
26214 parsoid={
26215 "modes": ["html2wt"],
26216 "scrubWikitext": true
26217 }
26218 !! html
26219 <h2><i></i></h2>
26220 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26221 </a><b><i></i></b>x</p>
26222 !! wikitext
26223
26224 [[foo]]
26225 x
26226
26227 !! end
26228
26229 !! test
26230 2. Multiple normalizations (selser)
26231 !! options
26232 parsoid={
26233 "modes": ["selser"],
26234 "scrubWikitext": true,
26235 "changes": [
26236 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26237 ]
26238 }
26239 !! wikitext
26240 <span id="x">foo</span>
26241 !! wikitext/edited
26242 <span id="x">foo</span>
26243
26244 x
26245 !! end
26246
26247 !! test
26248 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26249 !! options
26250 parsoid={
26251 "modes": ["html2wt"],
26252 "scrubWikitext": true
26253 }
26254 !! html/parsoid
26255 <p> hi</p>
26256 <p> hello</p>
26257 !! wikitext
26258 hi
26259
26260 hello
26261 !! end
26262
26263 !! test
26264 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26265 !! options
26266 parsoid=html2wt
26267 !! html/parsoid
26268 <p> hi</p>
26269 <p> hello</p>
26270 !! wikitext
26271 <nowiki> </nowiki>hi
26272
26273 <nowiki> </nowiki> hello
26274 !! end
26275
26276 !! test
26277 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26278 !! options
26279 parsoid={
26280 "modes": ["html2wt"],
26281 "scrubWikitext": true
26282 }
26283 !! html/parsoid
26284 <p>Foo
26285 bar
26286 baz</p>
26287
26288 <table><tr><td>Foo
26289 bar
26290 baz bang</td></tr></table>
26291
26292 <p><!--boo--> foo
26293 bar</p>
26294
26295 <p> foo
26296 bar<span>boo</span></p>
26297 !! wikitext
26298 Foo
26299 bar
26300 baz
26301
26302 {|
26303 |Foo
26304 bar
26305 baz bang
26306 |}
26307
26308 <!--boo-->foo
26309 bar
26310
26311 foo
26312 bar<span>boo</span>
26313 !! end
26314
26315 !! test
26316 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26317 !! options
26318 parsoid={
26319 "modes": ["selser"],
26320 "scrubWikitext": true,
26321 "changes": [
26322 [ "p", "html", " a\n b" ]
26323 ]
26324 }
26325 !! wikitext
26326 xyz
26327 !! wikitext/edited
26328 a
26329 b
26330 !! end
26331
26332 !! test
26333 1. New links that end in spaces
26334 !! options
26335 parsoid={
26336 "modes": ["html2wt"],
26337 "scrubWikitext": false
26338 }
26339 !! html/parsoid
26340 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26341 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26342 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26343 !! wikitext
26344 [[Berlin ]]<nowiki/>is the capital of Germany.
26345
26346 [[Foo ]]'''bar'''
26347
26348 [[Boston ]] is a city.
26349 !! end
26350
26351 !! test
26352 2. New links that end in spaces
26353 !! options
26354 parsoid={
26355 "modes": ["html2wt"],
26356 "scrubWikitext": true
26357 }
26358 !! html/parsoid
26359 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26360 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26361 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26362 !! wikitext
26363 [[Berlin]] is the capital of Germany.
26364
26365 [[Foo]] '''bar'''
26366
26367 [[Boston]] is a city.
26368 !! end
26369
26370 !! test
26371 1. Table cells with escapable prefixes
26372 !! options
26373 parsoid={
26374 "modes": ["html2wt"],
26375 "scrubWikitext": false
26376 }
26377 !! html
26378 <table>
26379 <tr><td>a</td></tr>
26380 <tr><td>-</td></tr>
26381 <tr><td>+</td></tr>
26382 </table>
26383 !! wikitext
26384 {|
26385 |a
26386 |-
26387 |<nowiki>-</nowiki>
26388 |-
26389 |<nowiki>+</nowiki>
26390 |}
26391 !! end
26392
26393 !! test
26394 2. Table cells with escapable prefixes
26395 !! options
26396 parsoid={
26397 "modes": ["html2wt"],
26398 "scrubWikitext": true
26399 }
26400 !! html
26401 <table>
26402 <tr><td>a</td></tr>
26403 <tr><td>-</td></tr>
26404 <tr><td>+</td></tr>
26405 </table>
26406 !! wikitext
26407 {|
26408 |a
26409 |-
26410 | -
26411 |-
26412 | +
26413 |}
26414 !! end
26415
26416 !! test
26417 3a. 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", "remove"]
26424 ]
26425 }
26426 !! wikitext
26427 {|
26428 |a||-
26429 |}
26430 !! wikitext/edited
26431 {|
26432 | -
26433 |}
26434 !! end
26435
26436 !! test
26437 3b. Table cells with escapable prefixes after edits
26438 !! options
26439 parsoid={
26440 "modes": ["selser"],
26441 "scrubWikitext": true,
26442 "changes": [
26443 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26444 [ "#x", "remove" ]
26445 ]
26446 }
26447 !! wikitext
26448 {|
26449 |pqr
26450 |<span id="x">foo</span>+
26451 |}
26452 !! wikitext/edited
26453 {|
26454 | -
26455 | +
26456 |}
26457 !! end
26458
26459 # FIXME: This test will fail because
26460 # normalization doesn't realize that the id attribute
26461 # will eliminate the escapable scenario
26462 !! test
26463 4a. Table cells without escapable prefixes after edits
26464 !! options
26465 parsoid={
26466 "modes": ["selser"],
26467 "scrubWikitext": true,
26468 "changes": [
26469 [ "#x", "html", "-" ]
26470 ]
26471 }
26472 !! wikitext
26473 {|
26474 | id="x" |abcd
26475 |}
26476 !! wikitext/edited
26477 {|
26478 | id="x" |-
26479 |}
26480 !! end
26481
26482 ## This tests normalizer's ability to discriminate between
26483 ## cells having identical content.
26484 !! test
26485 4b. Table cells without escapable prefixes after edits
26486 !! options
26487 parsoid={
26488 "modes": ["selser"],
26489 "scrubWikitext": true,
26490 "changes": [
26491 [ "td", "html", "-" ]
26492 ]
26493 }
26494 !! wikitext
26495 {|
26496 |a||b
26497 |}
26498 !! wikitext/edited
26499 {|
26500 | -||-
26501 |}
26502 !! end
26503
26504 ## This tests normalizer's ability to not be tripped by
26505 ## comments (and whitespace)
26506 !! test
26507 4c. Table cells without escapable prefixes after edits
26508 !! options
26509 parsoid={
26510 "modes": ["selser"],
26511 "scrubWikitext": true,
26512 "changes": [
26513 [ "table tbody tr td:first-child", "remove" ]
26514 ]
26515 }
26516 !! wikitext
26517 {|
26518 |-
26519 <!--foo--> |a||-
26520 |}
26521 !! wikitext/edited
26522 {|
26523 |-
26524 <!--foo--> | -
26525 |}
26526 !! end
26527
26528 ## This tests normalizer's ability to handle HTML cells
26529 !! test
26530 4d. Table cells without escapable prefixes after edits
26531 !! options
26532 parsoid={
26533 "modes": ["selser"],
26534 "scrubWikitext": true,
26535 "changes": [
26536 [ "td", "html", "-" ]
26537 ]
26538 }
26539 !! wikitext
26540 <table>
26541 <tr><td>a</td></tr>
26542 </table>
26543 !! wikitext/edited
26544 <table>
26545 <tr><td>-</td></tr>
26546 </table>
26547 !! end
26548
26549 ## T111151 Remove font elements without attributes
26550 !! test
26551 5a. font tags without attributes should be dropped in scrubWikitext mode
26552 !! options
26553 parsoid={
26554 "modes": ["html2wt"],
26555 "scrubWikitext": true
26556 }
26557 !! html
26558 <font>foo</font>
26559 <font><font>bar</font></font>
26560 <font class="x">boo</font>
26561 !! wikitext
26562 foo
26563 bar
26564 <font class="x">boo</font>
26565 !! end
26566
26567 !! test
26568 5b. font tags should not be dropped without scrubWikitext being enabled
26569 !! options
26570 parsoid={
26571 "modes": ["html2wt"],
26572 "scrubWikitext": false
26573 }
26574 !! html
26575 <font>foo</font>
26576 !! wikitext
26577 <font>foo</font>
26578 !! end
26579
26580 !! test
26581 Escape nowiki DOM elements
26582 !! options
26583 parsoid=html2wt
26584 !! html/parsoid
26585 <nowiki><i>foo</i></nowiki>
26586 !! wikitext
26587 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26588 !! end
26589
26590 # This is meant to be an interim fix while we go about figuring out
26591 # how to not introduce these trailing <nowiki/>s in the first place.
26592 !! test
26593 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26594 !! options
26595 parsoid=html2wt
26596 !! html/parsoid
26597 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26598 y</p>
26599 <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>
26600 <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>
26601 !! wikitext
26602 x
26603 y
26604
26605 {{echo|
26606 1 = <nowiki/>}}
26607
26608 {{echo|
26609 1 = <nowiki/>
26610 }}
26611 !! end
26612
26613 # ---------------------------------------------------
26614 # End of tests spec'ing wikitext serialization norms |
26615 # ---------------------------------------------------
26616
26617 # T104032
26618 !! test
26619 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26620 !! options
26621 parsoid=html2wt
26622 !! html/parsoid
26623 a<p>b</p>
26624 <b>c</b><p>d</p>
26625 <table><tr>
26626 <td>a<p>b</p></td>
26627 <td><b>c</b><p>d</p></td>
26628 </tr></table>
26629 !! wikitext
26630 a
26631
26632 b
26633
26634 '''c'''
26635
26636 d
26637 {|
26638 |a
26639 b
26640 |'''c'''
26641 d
26642 |}
26643 !! end
26644
26645 # -----------------------------------------------------------------
26646 # End of section for Parsoid-only html2wt tests for serialization
26647 # of new content
26648 # -----------------------------------------------------------------
26649
26650 # -----------------------------------------------------------------
26651 # The following section of tests are primarily to spec behavior of
26652 # the selective serializer. All these tests have manual selser
26653 # changes. The automated selser changes for all tests handle the
26654 # wide variation of changes, but these tests here capture specs
26655 # deterministically.
26656 # ----------------------------------------------------------------
26657
26658 ## T90517
26659 !! test
26660 Selser: New comments should not be lost
26661 !! options
26662 parsoid={
26663 "modes": ["selser"],
26664 "changes": [
26665 [ "#a", "after", "<!--c1-->" ],
26666 [ "#b", "before", "<!--c2-->" ]
26667 ]
26668 }
26669 !! wikitext
26670 <span id="a">a</span>
26671
26672 <span id="b">b</span>
26673 !! wikitext/edited
26674 <span id="a">a</span><!--c1-->
26675
26676 <!--c2--><span id="b">b</span>
26677 !! end
26678
26679 ## T89383
26680 !! test
26681 Selser: Check for validity of DSR before using it
26682 !! options
26683 parsoid={
26684 "modes": ["selser"],
26685 "changes": [
26686 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26687 ]
26688 }
26689 !! wikitext
26690 <span id="a">a</span>
26691 !! wikitext/edited
26692 {{DISPLAYTITLE:foo}}
26693 <span id="a">a</span>
26694 !! end
26695
26696 !! test
26697 1. DOMDiff: Changes to <ref> content should be looked up using id
26698 !! options
26699 parsoid={
26700 "modes": ["selser"],
26701 "changes": [
26702 ["#X", "after", "bar"],
26703 ["#Y", "after", "baz"]
26704 ]
26705 }
26706 !! wikitext
26707 X <ref><span id="X">foo</span></ref>
26708 Y <ref name="a" />
26709 <references>
26710 <ref name="a"><span id="Y">foo</span></ref>
26711 </references>
26712 !! wikitext/edited
26713 X <ref><span id="X">foo</span>bar</ref>
26714 Y <ref name="a" />
26715 <references>
26716 <ref name="a"><span id="Y">foo</span>baz</ref>
26717 </references>
26718 !! end
26719
26720 !! test
26721 2. DOMDiff: Changes to <ref> content should be looked up using id
26722 !! options
26723 parsoid={
26724 "modes": ["selser"],
26725 "changes": [
26726 ["#Z", "after", "bar"]
26727 ]
26728 }
26729 !! wikitext
26730 A <ref>foo bar for a</ref>
26731 B <ref group="X" name="b" />
26732
26733 <references />
26734
26735 <references group="X">
26736 <ref name="b"><span id="Z">foo</span></ref>
26737 </references>
26738 !! wikitext/edited
26739 A <ref>foo bar for a</ref>
26740 B <ref group="X" name="b" />
26741
26742 <references />
26743
26744 <references group="X">
26745 <ref name="b"><span id="Z">foo</span>bar</ref>
26746 </references>
26747 !! end
26748
26749 !! test
26750 Empty LI (T49673)
26751 !! wikitext
26752 * a
26753 *
26754 *
26755 * b
26756 !! html/php+tidy
26757 <ul>
26758 <li>a</li>
26759 <li class="mw-empty-li"></li>
26760 <li class="mw-empty-li"></li>
26761 <li>b</li>
26762 </ul>
26763 !! end