Merge "Revert "Preprocessor: Don't allow unclosed extension tags (matching until...
[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 # FIXME: Preserve the attribute properly (with an empty string as value) in
6556 # the PHP parser. Parsoid implements the behavior below.
6557 !! test
6558 Table attributes with empty value
6559 !! wikitext
6560 {|
6561 | style=| hello
6562 |}
6563 !! html/parsoid
6564 <table>
6565 <tbody>
6566 <tr>
6567 <td style=""> hello
6568 </td></tr></tbody></table>
6569
6570 !! end
6571
6572 !! test
6573 Wikitext table with a lot of comments
6574 !! wikitext
6575 {|
6576 <!-- c0 -->
6577 | foo
6578 <!-- c1 -->
6579 |-<!-- c2 -->
6580 <!-- c3 -->
6581 |<!-- c4 -->
6582 <!-- c5 -->
6583 |}
6584 !! html
6585 <table>
6586 <tr>
6587 <td> foo
6588 </td></tr>
6589 <tr>
6590 <td>
6591 </td></tr></table>
6592
6593 !! end
6594
6595 !! test
6596 Wikitext table comments represented in parsoid dom
6597 !! wikitext
6598 {|<!--c1--><!--c2-->
6599 |-<!--c3-->
6600 | x
6601 |}
6602 !! html/php+tidy
6603 <table>
6604 <tr>
6605 <td>x</td>
6606 </tr>
6607 </table>
6608 !! html/parsoid
6609 <table><!--c1--><!--c2-->
6610 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6611 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6612 </tbody></table>
6613 !! end
6614
6615 !! test
6616 Wikitext table with double-line table cell
6617 !! wikitext
6618 {|
6619 |a
6620 b
6621 |}
6622 !! html
6623 <table>
6624 <tr>
6625 <td>a
6626 <p>b
6627 </p>
6628 </td></tr></table>
6629
6630 !! end
6631
6632 !! test
6633 Table cell with a single comment
6634 !! wikitext
6635 {|
6636 | <!-- c1 -->
6637 | a
6638 |}
6639 !! html
6640 <table>
6641 <tr>
6642 <td>
6643 </td>
6644 <td> a
6645 </td></tr></table>
6646
6647 !! end
6648
6649 !! test
6650 Table-cell after a comment-only-empty-line
6651 !! wikitext
6652 {|
6653 |a
6654 <!--c1-->
6655 <!--c2-->| b
6656 |}
6657 !! html
6658 <table>
6659 <tr>
6660 <td>a
6661 </td>
6662 <td> b
6663 </td></tr></table>
6664
6665 !! html/parsoid
6666 <table>
6667 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6668 <!--c1-->
6669 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6670 </tbody></table>
6671
6672 !! end
6673
6674 !! test
6675 Build table with {{!}}
6676 !! wikitext
6677 {{{!}} class="wikitable"
6678 ! header
6679 ! second header
6680 {{!}}- style="color:red;"
6681 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6682 {{!}}}
6683 !! html
6684 <table class="wikitable">
6685 <tr>
6686 <th> header
6687 </th>
6688 <th> second header
6689 </th></tr>
6690 <tr style="color:red;">
6691 <td> data </td>
6692 <td style="color:red;"> second data
6693 </td></tr></table>
6694
6695 !! end
6696
6697 !! test
6698 Build table with pipe as data
6699 !! wikitext
6700 {| class="wikitable"
6701 ! header
6702 ! second header
6703 |- style="color:red;"
6704 | data || style="color:red;" | second data
6705 |-
6706 | style="color:red;" | data with | || style="color:red;" | second data with |
6707 |-
6708 || data with | ||| second data with |
6709 |}
6710 !! html
6711 <table class="wikitable">
6712 <tr>
6713 <th> header
6714 </th>
6715 <th> second header
6716 </th></tr>
6717 <tr style="color:red;">
6718 <td> data </td>
6719 <td style="color:red;"> second data
6720 </td></tr>
6721 <tr>
6722 <td style="color:red;"> data with | </td>
6723 <td style="color:red;"> second data with |
6724 </td></tr>
6725 <tr>
6726 <td> data with | </td>
6727 <td> second data with |
6728 </td></tr></table>
6729
6730 !! end
6731
6732 !! test
6733 Build table with wikilink
6734 !! wikitext
6735 {| class="wikitable"
6736 ! header || second header
6737 |- style="color:red;"
6738 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6739 |-
6740 | data || second data [[Main Page|link|text with pipe]]
6741 |}
6742 !! html
6743 <table class="wikitable">
6744 <tr>
6745 <th> header </th>
6746 <th> second header
6747 </th></tr>
6748 <tr style="color:red;">
6749 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6750 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6751 </td></tr>
6752 <tr>
6753 <td> data </td>
6754 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6755 </td></tr></table>
6756
6757 !! end
6758
6759 # The expected HTML structure in this test is debatable. The PHP parser does
6760 # not parse this kind of table at all. The main focus for Parsoid is on
6761 # round-tripping, so this output is ok for now. TODO: revisit!
6762 !! test
6763 Wikitext table with html-syntax row
6764 !! wikitext
6765 {|
6766 |-
6767 <td>foo</td>
6768 |}
6769 !! html/parsoid
6770 <table>
6771 <tbody>
6772 <tr>
6773 <td>foo</td></tr></tbody></table>
6774 !! end
6775
6776 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6777 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6778 ## PHP parser, which tidy then compounds by fostering the content
6779 ## entirely out of the table. Parsoid recognizes the table context
6780 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6781 ## depends on PHP's treatment of broken table markup!
6782 !! test
6783 Implicit <td> after a |-
6784 !! options
6785 parsoid=wt2html,html2html
6786 !! wikitext
6787 {|
6788 |-
6789 a
6790 |}
6791 !! html/php
6792 <table>
6793
6794 a
6795 </table>
6796
6797 !! html/php+tidy
6798 <p>a</p>
6799 !! html/parsoid
6800 <table>
6801 <tr><td>a</td></tr>
6802 </table>
6803 !! end
6804
6805 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6806 !! test
6807 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6808 !! options
6809 parsoid=wt2html,html2html
6810 !! wikitext
6811 {|
6812 |-
6813 |
6814 a
6815 |-
6816 b
6817 |}
6818 !! html/php
6819 <table>
6820
6821 <tr>
6822 <td>
6823 <pre>a
6824 </pre>
6825 </td></tr>
6826 b
6827 </table>
6828
6829 !! html/php+tidy
6830 <p>b</p>
6831 <table>
6832 <tr>
6833 <td>
6834 <pre>
6835 a
6836 </pre></td>
6837 </tr>
6838 </table>
6839 !! html/parsoid
6840 <table>
6841 <tbody>
6842 <tr><td><pre>a</pre></td></tr>
6843 <tr><td> b</td></tr>
6844 </tbody>
6845 </table>
6846 !! end
6847
6848 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6849 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6850 !! test
6851 Lists should be recognized in an implicit <td> context
6852 !! options
6853 parsoid=wt2html,html2html
6854 !! wikitext
6855 {|
6856 |-
6857 *a
6858 |}
6859 !! html/php
6860 <table>
6861
6862 <ul><li>a</li></ul>
6863 </table>
6864
6865 !! html/php+tidy
6866 <ul>
6867 <li>a</li>
6868 </ul>
6869 !! html/parsoid
6870 <table>
6871 <tr>
6872 <td><ul>
6873 <li>a</li>
6874 </ul></td>
6875 </tr>
6876 </table>
6877 !! end
6878
6879 !! test
6880 Table cells not properly parsed in an implicit-td context
6881 !! wikitext
6882 {|
6883 |-
6884 {{table_attribs_4}} || a || b
6885 |}
6886 !! html/php+tidy
6887 <table>
6888 <tr>
6889 <td style="background-color:#DC241f;" width="10px"></td>
6890 <td>a</td>
6891 <td>b</td>
6892 </tr>
6893 </table>
6894 !! html/parsoid
6895 <table>
6896 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6897 <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>
6898 </tbody></table>
6899 !! end
6900
6901 !! test
6902 Parsoid: Round-trip tables directly followed by content (bug 51219)
6903 !! options
6904 parsoid=wt2html,wt2wt
6905 !! wikitext
6906 {|
6907 |foo
6908 |} bar
6909
6910 {|
6911 |baz
6912 |}<b>quux</b>
6913 !! html+tidy
6914 <table>
6915 <tr>
6916 <td>foo</td>
6917 </tr>
6918 </table>
6919 <p>bar</p>
6920 <table>
6921 <tr>
6922 <td>baz</td>
6923 </tr>
6924 </table>
6925 <p><b>quux</b></p>
6926 !! end
6927
6928 !! test
6929 Parsoid: Default to a newline after tables in new content (bug 51219)
6930 !! options
6931 parsoid=html2wt
6932 !! html/parsoid
6933 <table><tbody>
6934 <tr><td>foo</td></tr></tbody></table> bar
6935 <table><tbody>
6936 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6937 !! wikitext
6938 {|
6939 |foo
6940 |}
6941 <nowiki> </nowiki>bar
6942 {|
6943 |baz
6944 |}
6945 '''quux'''
6946 !! end
6947
6948 !! test
6949 Parsoid: newline inducing block nodes don't suppress <nowiki>
6950 !! options
6951 parsoid=html2wt
6952 !! html/parsoid
6953 a<h1>foo</h1>
6954 !! wikitext
6955 <nowiki> </nowiki>a
6956
6957 = foo =
6958 !! end
6959
6960 !! test
6961 Parsoid: Row-syntax table headings followed by comment & table cells
6962 !! options
6963 parsoid=wt2html,wt2wt
6964 !! wikitext
6965 {|
6966 ! foo || bar
6967 <!-- foo --> || baz || quux
6968 |}
6969 !! html/php
6970 <table>
6971 <tr>
6972 <th> foo </th>
6973 <th> bar
6974 </th>
6975 <td> baz </td>
6976 <td> quux
6977 </td></tr></table>
6978
6979 !! html/parsoid
6980 <table>
6981 <tbody><tr><th> foo </th><th> bar
6982 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6983 </tbody></table>
6984 !! end
6985
6986 !!test
6987 Parsoid: Recover better from broken table attributes
6988 !!options
6989 parsoid=wt2html
6990 !!wikitext
6991 {| class="foo
6992 | class="bar" |
6993 foo
6994 |}
6995 !!html/php+tidy
6996 <table class="foo">
6997 <tr>
6998 <td class="bar">
6999 <p>foo</p>
7000 </td>
7001 </tr>
7002 </table>
7003 !!html/parsoid
7004 <table class="foo">
7005 <tr>
7006 <td class="bar">
7007 <p>foo</p></td></tr>
7008 </tbody></table>
7009 !!end
7010
7011 !! test
7012 Tables: Digest broken attributes on table and tr tag
7013 !! options
7014 parsoid=wt2html
7015 !! wikitext
7016 {| || |} ++
7017 |- || || ++ --
7018 |- > [
7019 |}
7020 !! html
7021 <table>
7022 <tbody>
7023 <tr></tr>
7024 <tr></tr>
7025 </tbody></table>
7026 !! end
7027
7028 !! test
7029 Strip unsupported table tags
7030 !! options
7031 parsoid=html2wt
7032 !! html/parsoid
7033 <table>
7034 <thead>
7035 <tr>
7036 <th>Month</th>
7037 <th>Savings</th>
7038 </tr>
7039 </thead>
7040 <tbody>
7041 <tr>
7042 <td>January</td>
7043 <td>$100</td>
7044 </tr>
7045 <tr>
7046 <td>February</td>
7047 <td>$80</td>
7048 </tr>
7049 </tbody>
7050 <tfoot>
7051 <tr>
7052 <td>Sum</td>
7053 <td>$180</td>
7054 </tr>
7055 </tfoot>
7056 </table>
7057 !! wikitext
7058 {|
7059
7060 !Month
7061 !Savings
7062
7063 |January
7064 |$100
7065
7066 |-
7067 |February
7068 |$80
7069
7070 |Sum
7071 |$180
7072
7073 |}
7074 !! end
7075
7076 !!test
7077 Testing serialization after deletion of table cells
7078 !!options
7079 parsoid={
7080 "modes": ["wt2wt", "selser"],
7081 "changes": [
7082 ["#x", "remove"]
7083 ]
7084 }
7085 !!wikitext
7086 {|
7087 !h1 !!h2 !!h3
7088 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7089 |}
7090 !! wikitext/edited
7091 {|
7092 !h1 !!h2 !!h3
7093 |c2 |||c3
7094 |}
7095 !!end
7096
7097 ###
7098 ### Internal links
7099 ###
7100 !! test
7101 Plain link, capitalized
7102 !! wikitext
7103 [[Main Page]]
7104 !! html
7105 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7106 </p>
7107 !! end
7108
7109 !! test
7110 Plain link, uncapitalized
7111 !! wikitext
7112 [[main Page]]
7113 !! html
7114 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7115 </p>
7116 !! end
7117
7118 !! test
7119 Piped link
7120 !! wikitext
7121 [[Main Page|The Main Page]]
7122 !! html
7123 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7124 </p>
7125 !! end
7126
7127 !! test
7128 Piped link with comment in link text
7129 !! wikitext
7130 [[Main Page|The Main<!--front--> Page]]
7131 !! html
7132 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7133 </p>
7134 !! end
7135
7136 !! test
7137 Piped link with multiple pipe characters in link text
7138 !! wikitext
7139 [[Main Page||The|Main|Page|]]
7140 !! html/php
7141 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7142 </p>
7143 !! html/parsoid
7144 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7145 !! end
7146
7147 !! test
7148 Piped link with no link text
7149 !! wikitext
7150 [[Thomas Bek (bishop of St David's)|]]
7151 !! html/php
7152 <p>[[Thomas Bek (bishop of St David's)|]]
7153 </p>
7154 !! html/parsoid
7155 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7156 !! end
7157
7158 !! test
7159 Broken link
7160 !! wikitext
7161 [[Zigzagzogzagzig]]
7162 !! html
7163 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7164 </p>
7165 !! end
7166
7167 !! test
7168 Broken link with fragment
7169 !! wikitext
7170 [[Zigzagzogzagzig#zug]]
7171 !! html
7172 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7173 </p>
7174 !! end
7175
7176 !! test
7177 Special page link with fragment
7178 !! wikitext
7179 [[Special:Version#anchor]]
7180 !! html
7181 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7182 </p>
7183 !! end
7184
7185 !! test
7186 Nonexistent special page link with fragment
7187 !! wikitext
7188 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7189 !! html
7190 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7191 </p>
7192 !! end
7193
7194 !! test
7195 Link with prefix
7196 !! wikitext
7197 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7198 !! html
7199 <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>
7200 </p>
7201 !! end
7202
7203 !! test
7204 Link with suffix
7205 !! wikitext
7206 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7207 !! html
7208 <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>!!!
7209 </p>
7210 !! end
7211
7212 !! article
7213 prefixed article
7214 !! text
7215 Some text
7216 !! endarticle
7217
7218 !! test
7219 Bug 43661: Piped links with identical prefixes
7220 !! wikitext
7221 [[prefixed article|prefixed articles with spaces]]
7222
7223 [[prefixed article|prefixed articlesaoeu]]
7224
7225 [[Main Page|Main Page test]]
7226 !! html
7227 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7228 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7229 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7230 </p>
7231 !! end
7232
7233
7234 !! test
7235 Link with HTML entity in suffix / tail
7236 !! wikitext
7237 [[Main Page]]&quot;, [[Main Page]]&#97;
7238 !! html/php
7239 <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;
7240 </p>
7241 !! html/parsoid
7242 <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>
7243 !! end
7244
7245 !! test
7246 Link with 3 brackets
7247 !! wikitext
7248 [[[Main Page]]]
7249 Foo [[[Main Page]]]
7250 !! html
7251 <p>[[[Main Page]]]
7252 Foo [[[Main Page]]]
7253 </p>
7254 !! end
7255
7256 !! test
7257 Link with 4 brackets
7258 !! wikitext
7259 [[[[Main Page]]]]
7260 !! html
7261 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7262 </p>
7263 !! end
7264
7265 !! test
7266 Piped link with 3 brackets
7267 !! wikitext
7268 [[[main page|the main page]]]
7269 !! html
7270 <p>[[[main page|the main page]]]
7271 </p>
7272 !! end
7273
7274 !! test
7275 Piped link with extlink-like text
7276 !! wikitext
7277 [[Main Page|[bar]]]
7278 [[Main Page|This is a [bar]]]
7279 !! html/php
7280 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7281 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7282 </p>
7283 !! html/parsoid
7284 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7285 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7286 !! end
7287
7288 !! test
7289 Link with multiple pipes
7290 !! wikitext
7291 [[Main Page|The|Main|Page]]
7292 !! html
7293 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7294 </p>
7295 !! end
7296
7297 # Note that parsoid does not munge anchor text; all non-space
7298 # characters are valid in HTML5 ids.
7299 !! test
7300 Anchor containing a #. (bug 63430)
7301 !! wikitext
7302 [[Main Page#And#Link]]
7303 !! html/php
7304 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7305 </p>
7306 !! html/parsoid
7307 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7308 !! end
7309
7310 !! test
7311 Link to namespaces
7312 !! wikitext
7313 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7314 !! html
7315 <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>
7316 </p>
7317 !! end
7318
7319 !! test
7320 Link with space in namespace
7321 !! wikitext
7322 [[User talk:Foo bar]]
7323 !! html
7324 <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>
7325 </p>
7326 !! end
7327
7328 !! article
7329 MemoryAlpha:AlphaTest
7330 !! text
7331 This is an article in the MemoryAlpha namespace
7332 (which shadows the memoryalpha interwiki link).
7333 !! endarticle
7334
7335 !! test
7336 Namespace takes precedence over interwiki link (bug 51680)
7337 !! wikitext
7338 [[MemoryAlpha:AlphaTest]]
7339 !! html
7340 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7341 </p>
7342 !! end
7343
7344 # The previous test doesn't work correctly in html2*, due to not recognizing the
7345 # link as an internal one. This one checks for the correct behavior.
7346 !! test
7347 Link to namespace preferred over interwiki with correct rel attribute
7348 !! options
7349 parsoid=html2wt,html2html
7350 !! html/parsoid
7351 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7352 !! wikitext
7353 [[MemoryAlpha:AlphaTest]]
7354 !! end
7355
7356 !! test
7357 Piped link to namespace
7358 !! wikitext
7359 [[Meta:Disclaimers|The disclaimers]]
7360 !! html
7361 <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>
7362 </p>
7363 !! end
7364
7365 !! test
7366 Link containing }
7367 !! wikitext
7368 [[Usually caused by a typo (oops}]]
7369 !! html
7370 <p>[[Usually caused by a typo (oops}]]
7371 </p>
7372 !! end
7373
7374 !! article
7375 7% Solution
7376 !! text
7377 Just a test of an article title containing a percent.
7378 !! endarticle
7379
7380 !! test
7381 Link containing % (not as a hex sequence)
7382 !! wikitext
7383 [[7% Solution]]
7384 !! html/php
7385 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7386 </p>
7387 !! html/parsoid
7388 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7389 !! end
7390
7391 # note that the parsoid HTML is identical to the previous test output,
7392 # so the previous test ensures that the html2wt mode will generate the
7393 # "not as a hex sequence" wikitext.
7394 !! test
7395 Link containing % as a single hex sequence interpreted to char
7396 !! options
7397 parsoid=wt2wt,wt2html,html2html
7398 !! wikitext
7399 [[7%25 Solution]]
7400 !! html/php
7401 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7402 </p>
7403 !! html/parsoid
7404 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7405 !!end
7406
7407 !! test
7408 Link containing % as a double hex sequence interpreted to hex sequence
7409 !! wikitext
7410 [[7%2525 Solution]]
7411 !! html
7412 <p>[[7%2525 Solution]]
7413 </p>
7414 !!end
7415
7416 # note that parsoid does not munge anchor text; all non-space
7417 # characters are valid in HTML5 anchors.
7418 !! test
7419 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7420 Example for such a section: == < ==
7421 !! wikitext
7422 [[%23%3c]][[%23%3e]]
7423 !! html/php
7424 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7425 </p>
7426 !! html/parsoid
7427 <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>
7428 !! end
7429
7430 !! test
7431 Link containing "<#" and ">#" as a hex sequences
7432 !! wikitext
7433 [[%3c%23]][[%3e%23]]
7434 !! html
7435 <p>[[%3c%23]][[%3e%23]]
7436 </p>
7437 !! end
7438
7439 !! test
7440 Link containing an equals sign
7441 !! wikitext
7442 [[Special:BookSources/isbn=4-00-026157-6]]
7443 !! html/php
7444 <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>
7445 </p>
7446 !! html/parsoid
7447 <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>
7448 !! end
7449
7450 !! article
7451 Foo~bar
7452 !! text
7453 Just a test of an article title containing a tilde.
7454 !! endarticle
7455
7456 # note that links containing signatures, like [[Foo~~~~]], are
7457 # massaged by the pre-save transform (PST) and so the tildes are never
7458 # seen by the parser.
7459 !! test
7460 Link containing a tilde
7461 !! wikitext
7462 [[Foo~bar]]
7463 !! html/php
7464 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7465 </p>
7466 !! html/parsoid
7467 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7468 !! end
7469
7470 !! test
7471 Link containing double-single-quotes '' (bug 4598)
7472 !! wikitext
7473 [[Lista d''e paise d''o munno]]
7474 !! html/php
7475 <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>
7476 </p>
7477 !! html/parsoid
7478 <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>
7479 !! end
7480
7481 !! test
7482 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7483 !! wikitext
7484 Some [[Link|pretty ''italics'' and stuff]]!
7485 !! html/php
7486 <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>!
7487 </p>
7488 !! html/parsoid
7489 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7490 !! end
7491
7492 !! test
7493 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7494 !! wikitext
7495 ''Some [[Link|pretty ''italics'' and stuff]]!''
7496 !! html
7497 <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>
7498 </p>
7499 !! end
7500
7501 !! test
7502 Link with double quotes in title part (literal) and alternate part (interpreted)
7503 !! wikitext
7504 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7505
7506 [[''Pentecoste'']]
7507
7508 [[''Pentecoste''|Pentecoste]]
7509
7510 [[''Pentecoste''|''Pentecoste'']]
7511 !! html/php
7512 <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>
7513 </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>
7514 </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>
7515 </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>
7516 </p>
7517 !! html/parsoid
7518 <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>
7519 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7520 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7521 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7522 !! end
7523
7524 !! test
7525 Broken image links with HTML captions (bug 39700)
7526 !! wikitext
7527 [[File:Nonexistent|<script></script>]]
7528 [[File:Nonexistent|100x100px|<script></script>]]
7529 [[File:Nonexistent|&lt;]]
7530 [[File:Nonexistent|a<i>b</i>c]]
7531 !! html/php
7532 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7533 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7534 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7535 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7536 </p>
7537 !! html/parsoid
7538 <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>
7539 <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>
7540 <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>
7541 <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>
7542 !! end
7543
7544 !! test
7545 Plain link to URL
7546 !! wikitext
7547 [[http://www.example.com]]
7548 !! html/php
7549 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7550 </p>
7551 !! html/parsoid
7552 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7553 !! end
7554
7555 !! test
7556 Plain link to URL with link text
7557 !! wikitext
7558 [[http://www.example.com Link text]]
7559 !! html
7560 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7561 </p>
7562 !! end
7563
7564 !! test
7565 Plain link to protocol-relative URL
7566 !! wikitext
7567 [[//www.example.com]]
7568 !! html/php
7569 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7570 </p>
7571 !! html/parsoid
7572 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7573 !! end
7574
7575 !! test
7576 Plain link to protocol-relative URL with link text
7577 !! wikitext
7578 [[//www.example.com Link text]]
7579 !! html
7580 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7581 </p>
7582 !! end
7583
7584 !! test
7585 Plain link to page with question mark in title
7586 !! wikitext
7587 [[A?b]]
7588
7589 [[A?b|Baz]]
7590 !! html
7591 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7592 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7593 </p>
7594 !! end
7595
7596
7597 # I'm fairly sure the expected result here is wrong.
7598 # We want these to be URL links, not pseudo-pages with URLs for titles....
7599 # However the current output is also pretty screwy.
7600 #
7601 # ----
7602 # I'm changing it to match the current output--it arguably makes more
7603 # sense in the light of the test above. Old expected result was:
7604 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7605 #</p>
7606 # But I think this test is bordering on "garbage in, garbage out" anyway.
7607 # -- wtm
7608 !! test
7609 Piped link to URL
7610 !! wikitext
7611 Piped link to URL: [[http://www.example.com|an example URL]]
7612 !! html/php
7613 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7614 </p>
7615 !! html/parsoid
7616 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7617 !! end
7618
7619 !! test
7620 BUG 2: [[page|http://url/]] should link to page, not http://url/
7621 !! wikitext
7622 [[Main Page|http://url/]]
7623 !! html/php
7624 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7625 </p>
7626 !! html/parsoid
7627 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7628 !! end
7629
7630 # Parsoid does not mark self-links, by design.
7631 !! test
7632 BUG 337: Escaped self-links should be bold
7633 !! options
7634 title=[[Bug462]]
7635 !! wikitext
7636 [[Bu&#103;462]] [[Bug462]]
7637 !! html/php
7638 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7639 </p>
7640 !! html/php+tidy
7641 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7642 !! html/parsoid
7643 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7644 !! end
7645
7646 !! test
7647 Self-link to section should not be bold
7648 !! options
7649 title=[[Main Page]]
7650 !! wikitext
7651 [[Main Page#section]]
7652 !! html
7653 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7654 </p>
7655 !! end
7656
7657 !! article
7658 00
7659 !! text
7660 This is 00.
7661 !! endarticle
7662
7663 !!test
7664 Self-link to numeric title
7665 !!options
7666 title=[[0]]
7667 !! wikitext
7668 [[0]]
7669 !! html
7670 <p><strong class="selflink">0</strong>
7671 </p>
7672 !!end
7673
7674 !!test
7675 Link to numeric-equivalent title
7676 !!options
7677 title=[[0]]
7678 !! wikitext
7679 [[00]]
7680 !! html
7681 <p><a href="/wiki/00" title="00">00</a>
7682 </p>
7683 !!end
7684
7685 !! test
7686 <nowiki> inside a link
7687 !! wikitext
7688 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7689 !! html
7690 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7691 </p>
7692 !! end
7693
7694 !! test
7695 Non-breaking spaces in title
7696 !! wikitext
7697 [[&nbsp; Main &nbsp; Page &nbsp;]]
7698 !! html
7699 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7700 </p>
7701 !!end
7702
7703 !! test
7704 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7705 !! options
7706 language=ca
7707 !! wikitext
7708 '''[[Main Page]]'''
7709 !! html
7710 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7711 </p>
7712 !! end
7713
7714 !! test
7715 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7716 !! options
7717 language=ca
7718 !! wikitext
7719 ''[[Main Page]]''
7720 !! html
7721 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7722 </p>
7723 !! end
7724
7725 !! test
7726 Internal link with en linktrail: no apostrophes (bug 27473)
7727 !! options
7728 language=en
7729 !! wikitext
7730 [[Something]]'nice
7731 !! html
7732 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7733 </p>
7734 !! end
7735
7736 !! test
7737 Internal link with ca linktrail with apostrophes (bug 27473)
7738 !! options
7739 language=ca
7740 !! wikitext
7741 [[Something]]'nice
7742 !! html
7743 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7744 </p>
7745 !! end
7746
7747 !! test
7748 Internal link with kaa linktrail with apostrophes (bug 27473)
7749 !! options
7750 language=kaa
7751 !! wikitext
7752 [[Something]]'nice
7753 !! html
7754 <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>
7755 </p>
7756 !! end
7757
7758 !! test
7759 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7760 !! wikitext
7761 [[User:Foo/Test/63636:Bar|Test]]
7762 !! html/php
7763 <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>
7764 </p>
7765 !! html/parsoid
7766 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7767 !! end
7768
7769 !! test
7770 Purely hash wikilink
7771 !! options
7772 title=[[User:test/123]]
7773 !! wikitext
7774 [[#a|b]]
7775 !! html/php
7776 <p><a href="#a">b</a>
7777 </p>
7778 !! html/parsoid
7779 <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>
7780 !! end
7781
7782 !! test
7783 1. Interaction of linktrail and template encapsulation
7784 !! options
7785 parsoid
7786 !! wikitext
7787 {{echo|[[Foo]]}}l
7788 !! html
7789 <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>
7790 !! end
7791
7792 !! test
7793 2. Interaction of linktrail and template encapsulation
7794 !! options
7795 parsoid
7796 !! wikitext
7797 {{echo|Some [[Fool]]}}s
7798 !! html
7799 <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>
7800 !! end
7801
7802 !! test
7803 3. Interaction of linktrail and template encapsulation
7804 !! options
7805 parsoid
7806 !! wikitext
7807 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7808 !! html
7809 <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>
7810 !! end
7811
7812 !! article
7813 Söfnuður
7814 !! text
7815 Test.
7816 !! endarticle
7817
7818 !! test
7819 Internal link with is link prefix
7820 !! options
7821 language=is
7822 !! wikitext
7823 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7824 !! html
7825 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7826 </p>
7827 !! end
7828
7829 !! article
7830 Mótmælendatrú
7831 !! text
7832 Test.
7833 !! endarticle
7834
7835 !! test
7836 Internal link with is link trail and link prefix
7837 !! options
7838 language=is
7839 !! wikitext
7840 [[mótmælendatrú|xxx]]ar
7841 [[mótmælendatrú]]ar
7842 mótmælenda[[söfnuður]]
7843 mótmælenda[[söfnuður|söfnuðir]]
7844 mótmælenda[[söfnuður|söfnuðir]]xxx
7845 !! html
7846 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7847 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7848 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7849 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7850 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7851 </p>
7852 !! end
7853
7854 !! test
7855 Parsoid link trail escaping
7856 !! options
7857 parsoid=html2wt,html2html
7858 !! html/parsoid
7859 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7860 !! wikitext
7861 [[apple]]<nowiki/>s
7862 !! end
7863
7864 !! test
7865 Parsoid link prefix escaping
7866 !! options
7867 language=is
7868 parsoid=html2wt,html2html
7869 !! html/parsoid
7870 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7871 !! wikitext
7872 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7873 !! end
7874
7875 !! test
7876 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7877 !! wikitext
7878 [[Foo| bar]]
7879
7880 [[Foo| ''bar'']]
7881
7882 [http://wp.org foo]
7883
7884 [http://wp.org ''foo'']
7885 !! html
7886 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7887 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7888 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7889 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7890 </p>
7891 !! end
7892
7893 !! test
7894 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7895 !! options
7896 parsoid
7897 !! wikitext
7898 [[Foo|{{echo|a}} b {{echo|c}}]]
7899 !! html
7900 <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>
7901 !! end
7902
7903 !! test
7904 Link with angle bracket after anchor
7905 !! wikitext
7906 [[Foo#<bar>]]
7907 !! html/php
7908 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7909 </p>
7910 !! html/parsoid
7911 <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>
7912 !! end
7913
7914 ###
7915 ### Interwiki links (see maintenance/interwiki.sql)
7916 ###
7917
7918 !! test
7919 Inline interwiki link
7920 !! options
7921 parsoid=wt2html,wt2wt,html2html
7922 !! wikitext
7923 [[MeatBall:SoftSecurity]]
7924 !! html/php
7925 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7926 </p>
7927 !! html/parsoid
7928 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7929 !! end
7930
7931 !! test
7932 Inline interwiki link with empty title (bug 2372)
7933 !! options
7934 parsoid=wt2html,wt2wt,html2html
7935 !! wikitext
7936 [[MeatBall:]]
7937 !! html/php
7938 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7939 </p>
7940 !! html/parsoid
7941 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7942 !! end
7943
7944 !! test
7945 Interwiki link encoding conversion (bug 1636)
7946 !! wikitext
7947 *[[Wikipedia:ro:Olteni&#0355;a]]
7948 *[[Wikipedia:ro:Olteni&#355;a]]
7949 !! html
7950 <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>
7951 <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>
7952
7953 !! html+tidy
7954 <ul>
7955 <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>
7956 <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>
7957 </ul>
7958 !! end
7959
7960 !! test
7961 Interwiki link with fragment (bug 2130)
7962 !! wikitext
7963 [[MeatBall:SoftSecurity#foo]]
7964 !! html
7965 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7966 </p>
7967 !! end
7968
7969 # Ideally the wikipedia: prefix here should be proto-relative too
7970 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7971 # define the 'en' prefix, and originally the test used 'wikipedia',
7972 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7973 # article.
7974 !! test
7975 Different interwiki prefixes mapping to the same URL
7976 !! wikitext
7977 [[:en:Foo]]
7978
7979 [[:en:Foo|Foo]]
7980
7981 [[wikipedia:Foo]]
7982
7983 [[:wikipedia:Foo|Foo]]
7984
7985 [[wikipedia:en:Foo]]
7986
7987 [[:wikipedia:en:Foo]]
7988
7989 [[ wikiPEdia :Foo]]
7990 !! html/parsoid
7991 <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>
7992
7993 <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>
7994
7995 <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>
7996
7997 <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>
7998
7999 <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>
8000
8001 <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>
8002
8003 <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>
8004 !! end
8005
8006 !! test
8007 Interwiki links that cannot be represented in wiki syntax
8008 !! wikitext
8009 [[meatball:ok]]
8010 [[meatball:ok#foo|ok with fragment]]
8011 [[meatball:ok_as_well?|ok ending with ? mark]]
8012 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8013 [http://de.wikipedia.org/wiki/#foo is just fragment]
8014
8015 !! html/php
8016 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8017 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8018 <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>
8019 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8020 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8021 </p>
8022 !! html/parsoid
8023 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8024 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8025 <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>
8026 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8027 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8028 !! end
8029
8030 !! test
8031 Interwiki links: trail
8032 !! wikitext
8033 [[wikipedia:Foo|Ba]]r
8034 !! html/php
8035 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8036 </p>
8037 !! html/parsoid
8038 <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>
8039 !! end
8040
8041 !! test
8042 Local interwiki link
8043 !! options
8044 parsoid=wt2html,wt2wt,html2html
8045 !! wikitext
8046 [[local:Template:Foo]]
8047 !! html/php
8048 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8049 </p>
8050 !! html/parsoid
8051 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8052 !! end
8053
8054 # Parsoid does not mark self-links, by design.
8055 !! test
8056 Local interwiki link: self-link to current page
8057 !! options
8058 title=[[Main Page]]
8059 parsoid=wt2html,wt2wt,html2html
8060 !! wikitext
8061 [[local:Main Page]]
8062 !! html/php
8063 <p><strong class="selflink">local:Main Page</strong>
8064 </p>
8065 !! html/parsoid
8066 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8067 !! end
8068
8069 !! test
8070 Local interwiki link: prefix only (bug 64167)
8071 !! options
8072 parsoid=wt2html,wt2wt,html2html
8073 !! wikitext
8074 [[local:]]
8075 !! html/php
8076 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8077 </p>
8078 !! html/parsoid
8079 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8080 !! end
8081
8082 !! test
8083 Local interwiki link: with additional interwiki prefix (bug 61357)
8084 !! options
8085 parsoid=wt2html,wt2wt,html2html
8086 !! wikitext
8087 [[local:meatball:Hello]]
8088 !! html/php
8089 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8090 </p>
8091 !! html/parsoid
8092 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8093 !! end
8094
8095 !! test
8096 Multiple local interwiki link prefixes
8097 !! wikitext
8098 [[local:local:local:local:mi:local:Foo]]
8099 !! options
8100 parsoid=wt2html,wt2wt,html2html
8101 !! html/php
8102 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8103 </p>
8104 !! html/parsoid
8105 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8106 !! end
8107
8108 ###
8109 ### Interlanguage links
8110 ### Language links (so that searching for '### language' matches..)
8111 ###
8112
8113 !! test
8114 Interlanguage link
8115 !! options
8116 parsoid=wt2html,wt2wt,html2html
8117 !! wikitext
8118 Blah blah blah
8119 [[zh:Chinese]]
8120 !! html/php
8121 <p>Blah blah blah
8122 </p>
8123 !! html/parsoid
8124 <p>Blah blah blah</p>
8125 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8126 !! end
8127
8128 !! test
8129 Interlanguage link with spacing
8130 !! options
8131 parsoid=wt2html,wt2wt,html2html
8132 !! wikitext
8133 Blah blah blah
8134 [[ zh : Chinese ]]
8135 !! html/php
8136 <p>Blah blah blah
8137 </p>
8138 !! html/parsoid
8139 <p>Blah blah blah</p>
8140 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8141 !! end
8142
8143 !! test
8144 Double interlanguage link
8145 !! options
8146 parsoid=wt2html,wt2wt,html2html
8147 !! wikitext
8148 Blah blah blah
8149 [[es:Spanish]]
8150 [[zh:Chinese]]
8151 !! html/php
8152 <p>Blah blah blah
8153 </p>
8154 !! html/parsoid
8155 <p>Blah blah blah</p>
8156 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8157 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8158 !! end
8159
8160 !! test
8161 Interlanguage link variations
8162 !! options
8163 parsoid=wt2html,wt2wt,html2html
8164 !! wikitext
8165 Blah blah blah
8166 [[ es :Spanish]]
8167 [[ ZH :Chinese]]
8168 [[es:Foo_bar]]
8169 !! html/php
8170 <p>Blah blah blah
8171 </p>
8172 !! html/parsoid
8173 <p>Blah blah blah</p>
8174 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8175 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8176 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8177 !! end
8178
8179 !! test
8180 Space and question mark encoding in interlanguage links (T95473)
8181 !! options
8182 parsoid=wt2html,wt2wt,html2html
8183 !! wikitext
8184 Blah blah blah
8185 [[es:Foo bar?]]
8186 !! html/php
8187 <p>Blah blah blah
8188 </p>
8189 !! html/parsoid
8190 <p>Blah blah blah</p>
8191 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8192 !! end
8193
8194 !! test
8195 Interlanguage link, with prefix links
8196 !! options
8197 language=ln
8198 !! wikitext
8199 Blah blah blah
8200 [[zh:Chinese]]
8201 !! html/php
8202 <p>Blah blah blah
8203 </p>
8204 !! html/parsoid
8205 <p>Blah blah blah</p>
8206 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8207 !! end
8208
8209 !! test
8210 Double interlanguage link, with prefix links (bug 8897)
8211 !! options
8212 language=ln
8213 !! wikitext
8214 Blah blah blah
8215 [[es:Spanish]]
8216 [[zh:Chinese]]
8217 !! html/php
8218 <p>Blah blah blah
8219 </p>
8220 !! html/parsoid
8221 <p>Blah blah blah</p>
8222 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8223 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8224 !! end
8225
8226 !! test
8227 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8228 !! wikitext
8229 Blah blah blah
8230 [[mul:Article]]
8231 !! html/php
8232 <p>Blah blah blah
8233 </p>
8234 !! html/parsoid
8235 <p>Blah blah blah</p>
8236 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8237 !! end
8238
8239 !! test
8240 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8241 !! options
8242 language=ln
8243 !! wikitext
8244 [[WW&nbsp;II]]
8245 !! html
8246 <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>
8247 </p>
8248 !! end
8249
8250 !! test
8251 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8252 !! options
8253 parsoid=html2wt
8254 !! html/parsoid
8255 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8256 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8257 !! wikitext
8258 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8259
8260 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8261 !! end
8262
8263 !! test
8264 Parsoid: handle constructor well
8265 !! wikitext
8266 [[constructor]]
8267
8268 [[constructor:foo]]
8269 !! html/php
8270 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8271 </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>
8272 </p>
8273 !! html/parsoid
8274 <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>
8275
8276 <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>
8277 !! end
8278
8279 !! article
8280 ko:
8281 !! text
8282 Test.
8283 !! endarticle
8284
8285 # Note that `ko` isn't a known interlanguage prefix
8286 !! test
8287 Parsoid: recognize interlanguage links without a target page
8288 !! options
8289 ill
8290 !! wikitext
8291 [[es:]]
8292
8293 [[ko:]]
8294 !! html/php
8295 es:
8296 !! html/parsoid
8297 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8298
8299 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8300 !! end
8301
8302 # Note that `ko` isn't a known interwiki prefix
8303 !! test
8304 Parsoid: recognize interwiki links without a target page
8305 !! options
8306 parsoid=wt2html,wt2wt,html2html
8307 !! wikitext
8308 [[:es:]]
8309
8310 [[:ko:]]
8311 !! html/php
8312 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8313 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8314 </p>
8315 !! html/parsoid
8316 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8317 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8318 !! end
8319
8320 !! test
8321 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8322 !! wikitext
8323 [[mi:Foo]]
8324 !! html/php
8325 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8326 </p>
8327 !! html/parsoid
8328 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8329 !! end
8330
8331 !! test
8332 Interlanguage link with preceding local interwiki link (bug 68085)
8333 !! options
8334 parsoid=wt2html,wt2wt,html2html
8335 !! wikitext
8336 Blah blah blah
8337 [[local:es:Spanish]]
8338 !! html/php
8339 <p>Blah blah blah
8340 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8341 </p>
8342 !! html/parsoid
8343 <p>Blah blah blah
8344 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8345 !! end
8346
8347 !! test
8348 Looks like an interlanguage link, but is actually a local interwiki
8349 !! options
8350 parsoid=wt2html,wt2wt,html2html
8351 !! wikitext
8352 Blah blah blah
8353 [[mi:Template:Foo]]
8354 !! html/php
8355 <p>Blah blah blah
8356 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8357 </p>
8358 !! html/parsoid
8359 <p>Blah blah blah
8360 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8361 !! end
8362
8363 ###
8364 ### Redirects, Parsoid-only
8365 ###
8366
8367 !! test
8368 1. Simple redirect to page
8369 !! wikitext
8370 #REDIRECT [[Main Page]]
8371 !! html/parsoid
8372 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8373 !! end
8374
8375 !! test
8376 2. Other redirect variants
8377 !! wikitext
8378 #REDIRECT [[Main_Page]]
8379 !! html/parsoid
8380 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8381 !! end
8382
8383 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8384 # This tests the Parsoid bail-out code.
8385 !! test
8386 3. Other redirect variants
8387 !! wikitext
8388 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8389 !! html/parsoid
8390 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8391 !! end
8392
8393 !! test
8394 4. Redirect to a templated destination
8395 !! wikitext
8396 #REDIRECT [[{{echo|Foo}}bar]]
8397 !! html/parsoid
8398 <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"}]]}'/>
8399 !! end
8400
8401 !! test
8402 Empty redirect
8403 !! options
8404 parsoid=wt2html,wt2wt
8405 !! wikitext
8406 #REDIRECT [[]]
8407 !! html/parsoid
8408 <ol>
8409 <li>REDIRECT [[]]</li></ol>
8410 !! end
8411
8412 !! test
8413 Optional colon in #REDIRECT
8414 !! options
8415 # the colon is archaic syntax. we support it for wt2html, but we
8416 # don't care that it roundtrips back to the modern syntax.
8417 parsoid=wt2html,html2html
8418 !! wikitext
8419 #REDIRECT:[[Main Page]]
8420 !! html/parsoid
8421 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8422 !! end
8423
8424 !! test
8425 Whitespace in #REDIRECT with optional colon
8426 !! options
8427 # the colon and gratuitous whitespace is archaic syntax. we support
8428 # it for wt2html, but we don't care that it roundtrips back to the
8429 # modern syntax (without extra whitespace)
8430 parsoid=wt2html,html2html
8431 !! wikitext
8432
8433 #REDIRECT
8434 :
8435 [[Main Page]]
8436 !! html/parsoid
8437 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8438 !! end
8439
8440 !! test
8441 Piped link in #REDIRECT
8442 !! options
8443 # content after piped link is ignored. we support this syntax,
8444 # but don't care that the piped link is lost when we roundtrip this.
8445 parsoid=wt2html
8446 !! wikitext
8447 #REDIRECT [[Main Page|bar]]
8448 !! html/parsoid
8449 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8450 !! end
8451
8452 !! test
8453 Redirect to category (T104502)
8454 !! options
8455 parsoid=wt2html,wt2wt
8456 !! wikitext
8457 #REDIRECT [[Category:Foo]]
8458 !! html/parsoid
8459 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8460 !! end
8461
8462 !! test
8463 Redirect to category with URL encoding (T104502)
8464 !! options
8465 parsoid=wt2html
8466 !! wikitext
8467 #REDIRECT [[Category%3AFoo]]
8468 !! html/parsoid
8469 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8470 !! end
8471
8472 !! test
8473 Redirect to category page
8474 !! wikitext
8475 #REDIRECT [[:Category:Foo]]
8476 !! html/parsoid
8477 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8478 !! end
8479
8480 !! test
8481 Redirect to image page (1)
8482 !! wikitext
8483 #REDIRECT [[File:Wiki.png]]
8484 !! html/parsoid
8485 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8486 !! end
8487
8488 !! test
8489 Redirect to image page (2)
8490 !! wikitext
8491 #REDIRECT [[Image:Wiki.png]]
8492 !! html/parsoid
8493 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8494 !! end
8495
8496 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8497 # Next test confirms this.
8498 !! test
8499 Redirect to language (1) (T104918)
8500 !! options
8501 parsoid=wt2html,wt2wt,html2html
8502 !! wikitext
8503 #REDIRECT [[en:File:Wiki.png]]
8504 !! html/parsoid
8505 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8506 !! end
8507
8508 !! test
8509 Redirect to language (2) (T104918)
8510 !! wikitext
8511 #REDIRECT [[:en:File:Wiki.png]]
8512 !! html/parsoid
8513 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8514 !! end
8515
8516 !! test
8517 Redirect to interwiki (T104918)
8518 !! wikitext
8519 #REDIRECT [[meatball:File:Wiki.png]]
8520 !! html/parsoid
8521 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8522 !! end
8523
8524 !! test
8525 Non-English #REDIRECT
8526 !! options
8527 language=is
8528 !! wikitext
8529 #TILVÍSUN [[Main Page]]
8530 !! html/parsoid
8531 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8532 !! end
8533
8534 !! test
8535 Redirect syntax under text isn't considered a redirect
8536 !! wikitext
8537 some text
8538 #redirect [[Main Page]]
8539 !! html/parsoid
8540 <p>some text</p>
8541 <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>
8542 !! end
8543
8544 # FIXME: Should hoist the redirect to the top of the page and ensure there
8545 # is only one.
8546 !! test
8547 New redirect
8548 !! options
8549 parsoid=html2wt
8550 !! html/parsoid
8551 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8552 !! wikitext
8553 Foo
8554 #REDIRECT [[Foo]]
8555 !! end
8556
8557 ##
8558 ## XHTML tidiness
8559 ###
8560
8561 !! test
8562 <br> to <br />
8563 !! wikitext
8564 1<br>2<br />3
8565 !! html
8566 <p>1<br />2<br />3
8567 </p>
8568 !! end
8569
8570 !! test
8571 Broken br tag sanitization
8572 !! wikitext
8573 </br>
8574 !! html/php
8575 <p>&lt;/br&gt;
8576 </p>
8577 !! end
8578
8579 # TODO: Fix html2html mode (bug 51055)!
8580 !! test
8581 Parsoid: Broken br tag recognition
8582 !! options
8583 parsoid=wt2html
8584 !! wikitext
8585 </br>
8586
8587 <br/ >
8588 !! html+tidy
8589 <p><br /></p>
8590 <p><br /></p>
8591 !! end
8592
8593 !! test
8594 Incorrecly removing closing slashes from correctly formed XHTML
8595 !! wikitext
8596 <br style="clear:both;" />
8597 !! html
8598 <p><br style="clear:both;" />
8599 </p>
8600 !! end
8601
8602 !! test
8603 Failing to transform badly formed HTML into correct XHTML
8604 !! wikitext
8605 <br style="clear: left;">
8606 <br style="clear: right;">
8607 <br style="clear: both;">
8608 !! html
8609 <p><br style="clear: left;" />
8610 <br style="clear: right;" />
8611 <br style="clear: both;" />
8612 </p>
8613 !!end
8614
8615 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8616 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8617 !! test
8618 Handling html with a div self-closing tag
8619 !! wikitext
8620 <div title />
8621 <div title/>
8622 <div title/ >
8623 <div title=bar />
8624 <div title=bar/>
8625 <div title=bar/ >
8626 !! html/php
8627 <p>&lt;div title /&gt;
8628 &lt;div title/&gt;
8629 </p>
8630 <div>
8631 <p>&lt;div title=bar /&gt;
8632 &lt;div title=bar/&gt;
8633 </p>
8634 <div title="bar/"></div>
8635 </div>
8636
8637 !! html/parsoid
8638 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8639 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8640 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8641 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8642 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8643 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8644 !! end
8645
8646 !! test
8647 Handling html with a br self-closing tag
8648 !! wikitext
8649 <br title />
8650 <br title/>
8651 <br title/ >
8652 <br title=bar />
8653 <br title=bar/>
8654 <br title=bar/ >
8655 !! html/php
8656 <p><br title="" />
8657 <br title="" />
8658 <br />
8659 <br title="bar" />
8660 <br title="bar" />
8661 <br title="bar/" />
8662 </p>
8663 !! html/parsoid
8664 <p><br title="" />
8665 <br title="" />
8666 <br title="" />
8667 <br title="bar" />
8668 <br title="bar" />
8669 <br title="bar/" />
8670 </p>
8671 !! end
8672
8673 !! test
8674 Horizontal ruler (should it add that extra space?)
8675 !! wikitext
8676 <hr>
8677 <hr >
8678 foo <hr
8679 > bar
8680 !! html+tidy
8681 <hr />
8682 <hr />
8683 <p>foo</p>
8684 <hr />
8685 <p>bar</p>
8686 !! end
8687
8688 !! test
8689 Horizontal ruler -- 4+ dashes render hr
8690 !! wikitext
8691 ----
8692 !! html
8693 <hr />
8694
8695 !! end
8696
8697 !! test
8698 Horizontal ruler -- eats additional dashes on the same line
8699 !! wikitext
8700 ---------
8701 !! html
8702 <hr />
8703
8704 !! end
8705
8706 !! test
8707 Horizontal ruler -- does not collapse dashes on consecutive lines
8708 !! wikitext
8709 ----
8710 ----
8711 !! html
8712 <hr />
8713 <hr />
8714
8715 !! end
8716
8717 !! test
8718 Horizontal ruler -- <4 dashes render as plain text
8719 !! wikitext
8720 ---
8721 !! html
8722 <p>---
8723 </p>
8724 !! end
8725
8726 !! test
8727 Horizontal ruler -- Supports content following dashes on same line
8728 !! wikitext
8729 ---- Foo
8730 !! html
8731 <hr /> Foo
8732
8733 !! html+tidy
8734 <hr />
8735 <p>Foo</p>
8736 !! end
8737
8738 ###
8739 ### Block-level elements
8740 ###
8741 !! test
8742 Common list
8743 !! wikitext
8744 *Common list
8745 * item 2
8746 *item 3
8747 !! html
8748 <ul><li>Common list</li>
8749 <li> item 2</li>
8750 <li>item 3</li></ul>
8751
8752 !! end
8753
8754 !! test
8755 Numbered list
8756 !! wikitext
8757 #Numbered list
8758 #item 2
8759 # item 3
8760 !! html
8761 <ol><li>Numbered list</li>
8762 <li>item 2</li>
8763 <li> item 3</li></ol>
8764
8765 !! end
8766
8767 !! test
8768 Mixed list
8769 !! wikitext
8770 *Mixed list
8771 *# with numbers
8772 ** and bullets
8773 *# and numbers
8774 *bullets again
8775 **bullet level 2
8776 ***bullet level 3
8777 ***#Number on level 4
8778 **bullet level 2
8779 **#Number on level 3
8780 **#Number on level 3
8781 *#number level 2
8782 *Level 1
8783 *** Level 3
8784 #** Level 3, but ordered
8785 !! html
8786 <ul><li>Mixed list
8787 <ol><li> with numbers</li></ol>
8788 <ul><li> and bullets</li></ul>
8789 <ol><li> and numbers</li></ol></li>
8790 <li>bullets again
8791 <ul><li>bullet level 2
8792 <ul><li>bullet level 3
8793 <ol><li>Number on level 4</li></ol></li></ul></li>
8794 <li>bullet level 2
8795 <ol><li>Number on level 3</li>
8796 <li>Number on level 3</li></ol></li></ul>
8797 <ol><li>number level 2</li></ol></li>
8798 <li>Level 1
8799 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8800 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8801
8802 !! end
8803
8804 !! test
8805 1. Nested mixed wikitext and html list
8806 !! wikitext
8807 * hi
8808 * <ul><li>ho</li></ul>
8809 * hi
8810 ** ho
8811 !! html/php
8812 <ul><li> hi</li>
8813 <li> <ul><li>ho</li></ul></li>
8814 <li> hi
8815 <ul><li> ho</li></ul></li></ul>
8816
8817 !! html/parsoid
8818 <ul><li> hi</li>
8819 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8820 <li> hi
8821 <ul><li> ho</li></ul></li></ul>
8822 !! end
8823
8824 !! test
8825 2. Nested mixed wikitext and html list (incompatible)
8826 !! wikitext
8827 ; hi
8828 : {{echo|<li>ho</li>}}
8829 !! html/php
8830 <dl><dt> hi</dt>
8831 <dd> <li>ho</li></dd></dl>
8832
8833 !! html/parsoid
8834 <dl><dt> hi</dt>
8835 <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>
8836 !! end
8837
8838 !! test
8839 Nested lists 1
8840 !! wikitext
8841 *foo
8842 **bar
8843 !! html
8844 <ul><li>foo
8845 <ul><li>bar</li></ul></li></ul>
8846
8847 !! end
8848
8849 !! test
8850 Nested lists 2
8851 !! wikitext
8852 **foo
8853 *bar
8854 !! html
8855 <ul><li><ul><li>foo</li></ul></li>
8856 <li>bar</li></ul>
8857
8858 !! end
8859
8860 !! test
8861 Nested lists 3 (first element empty)
8862 !! wikitext
8863 *
8864 **bar
8865 !! html
8866 <ul><li>
8867 <ul><li>bar</li></ul></li></ul>
8868
8869 !! end
8870
8871 !! test
8872 Nested lists 4 (first element empty)
8873 !! wikitext
8874 **
8875 *bar
8876 !! html
8877 <ul><li><ul><li></li></ul></li>
8878 <li>bar</li></ul>
8879
8880 !! end
8881
8882 !! test
8883 Nested lists 5 (both elements empty)
8884 !! wikitext
8885 **
8886 *
8887 !! html
8888 <ul><li><ul><li></li></ul></li>
8889 <li></li></ul>
8890
8891 !! end
8892
8893 !! test
8894 Nested lists 6 (both elements empty)
8895 !! wikitext
8896 *
8897 **
8898 !! html
8899 <ul><li>
8900 <ul><li></li></ul></li></ul>
8901
8902 !! end
8903
8904 !! test
8905 Nested lists 7 (skip initial nesting levels)
8906 !! wikitext
8907 *** foo
8908 !! html
8909 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8910
8911 !! end
8912
8913 !! test
8914 Nested lists 8 (multiple nesting transitions)
8915 !! wikitext
8916 * foo
8917 *** bar
8918 ** baz
8919 * boo
8920 !! html
8921 <ul><li> foo
8922 <ul><li><ul><li> bar</li></ul></li>
8923 <li> baz</li></ul></li>
8924 <li> boo</li></ul>
8925
8926 !! end
8927
8928 !! test
8929 Nested lists 9 (extension interaction)
8930 !! options
8931 parsoid
8932 !! wikitext
8933 *<references />
8934 !! html/parsoid
8935 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8936 !! end
8937
8938 !! test
8939 1. Lists with start-of-line-transparent tokens before bullets: Comments
8940 !! wikitext
8941 *foo
8942 *<!--cmt-->bar
8943 <!--cmt-->*baz
8944 !! html
8945 <ul><li>foo</li>
8946 <li>bar</li>
8947 <li>baz</li></ul>
8948
8949 !! end
8950
8951 !! test
8952 2. Lists with start-of-line-transparent tokens before bullets: Template close
8953 !! wikitext
8954 *foo {{echo|bar
8955 }}*baz
8956 !! html
8957 <ul><li>foo bar</li>
8958 <li>baz</li></ul>
8959
8960 !! end
8961
8962 !! test
8963 List items are not parsed correctly following a <pre> block (bug 785)
8964 !! wikitext
8965 * <pre>foo</pre>
8966 * <pre>bar</pre>
8967 * zar
8968 !! html/php
8969 <ul><li> <pre>foo</pre></li>
8970 <li> <pre>bar</pre></li>
8971 <li> zar</li></ul>
8972
8973 !! html/parsoid
8974 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8975 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8976 <li> zar</li></ul>
8977 !! end
8978
8979 !! test
8980 List items from template
8981 !! wikitext
8982
8983 {{inner list}}
8984 * item 2
8985
8986 * item 0
8987 {{inner list}}
8988 * item 2
8989
8990 * item 0
8991 * notSOL{{inner list}}
8992 * item 2
8993 !! html
8994 <ul><li> item 1</li>
8995 <li> item 2</li></ul>
8996 <ul><li> item 0</li>
8997 <li> item 1</li>
8998 <li> item 2</li></ul>
8999 <ul><li> item 0</li>
9000 <li> notSOL</li>
9001 <li> item 1</li>
9002 <li> item 2</li></ul>
9003
9004 !! end
9005
9006 !! test
9007 List interrupted by empty line or heading
9008 !! wikitext
9009 * foo
9010
9011 ** bar
9012 == A heading ==
9013 * Another list item
9014 !! html
9015 <ul><li> foo</li></ul>
9016 <ul><li><ul><li> bar</li></ul></li></ul>
9017 <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>
9018 <ul><li> Another list item</li></ul>
9019
9020 !!end
9021
9022 !!test
9023 Multiple list tags generated by templates
9024 !! wikitext
9025 {{echo|<li>}}a
9026 {{echo|<li>}}b
9027 {{echo|<li>}}c
9028 !! html
9029 <li>a
9030 <li>b
9031 <li>c</li>
9032 </li>
9033 </li>
9034
9035 !! html+tidy
9036 <ul>
9037 <li>a</li>
9038 <li>b</li>
9039 <li>c</li>
9040 </ul>
9041 !!end
9042
9043 !!test
9044 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9045 !! wikitext
9046 *a
9047 <!--This line will NOT split the list-->
9048 *b
9049 <!--This line will NOT split the list either-->
9050 *c
9051 <!--foo--> <!----> <!--This line NOT split the list either-->
9052 *d
9053 !! html
9054 <ul><li>a</li>
9055 <li>b</li>
9056 <li>c</li>
9057 <li>d</li></ul>
9058
9059 !!end
9060
9061 !!test
9062 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9063 !! wikitext
9064 *a
9065 <!--This line will NOT split the list-->
9066 *b
9067 <!--This line will NOT split the list either-->
9068 *c
9069 <!--foo--> <!----> <!--This line NOT split the list
9070 either-->
9071 *d
9072 !! html
9073 <ul><li>a</li>
9074 <li>b</li>
9075 <li>c</li>
9076 <li>d</li></ul>
9077
9078 !!end
9079
9080 !!test
9081 Test the li-hack
9082 (The PHP parser relies on Tidy for the hack)
9083 !!options
9084 parsoid=wt2html,wt2wt
9085 !! wikitext
9086 * foo
9087 * <li>li-hack
9088 * {{echo|<li>templated li-hack}}
9089 * <!--foo--> <li> unsupported li-hack with preceding comments
9090
9091 <ul>
9092 <li><li>not a li-hack
9093 </li>
9094 </ul>
9095 !! html+tidy
9096 <ul>
9097 <li>foo</li>
9098 <li>li-hack</li>
9099 <li>templated li-hack</li>
9100 <li>unsupported li-hack with preceding comments</li>
9101 </ul>
9102 <ul>
9103 <li>not a li-hack</li>
9104 </ul>
9105 !!end
9106
9107 !! test
9108 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9109 !! options
9110 parsoid
9111 !! wikitext
9112 # foo
9113 ## bar
9114 * foo
9115 ** bar
9116 : foo
9117 :: bar
9118 !! html
9119 <ol>
9120 <li> foo<ol>
9121 <li> bar</li>
9122 </ol></li>
9123 </ol><ul>
9124 <li> foo<ul>
9125 <li> bar</li>
9126 </ul></li>
9127 </ul><dl>
9128 <dd> foo<dl>
9129 <dd> bar</dd>
9130 </dl></dd>
9131 </dl>
9132 !! end
9133
9134 !! test
9135 Parsoid: Test of whitespace serialization with Templated bullets
9136 !! options
9137 parsoid
9138 !! wikitext
9139 * {{bullet}}
9140 !! html
9141 <ul>
9142 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9143 </ul>
9144 !! end
9145
9146 # ------------------------------------------------------------------------
9147 # The next set of tests are about Parsoid's ability to handle badly nested
9148 # tags (parse, minimize scope of fixup, and roundtrip back)
9149 # ------------------------------------------------------------------------
9150
9151 !! test
9152 Unbalanced closing block tags break a list
9153 (php parser relies on Tidy to fix up)
9154 !! wikitext
9155 <div>
9156 *a</div><div>
9157 *b</div>
9158 !! html+tidy
9159 <div>
9160 <ul>
9161 <li>a</li>
9162 </ul>
9163 </div>
9164 <div>
9165 <ul>
9166 <li>b</li>
9167 </ul>
9168 </div>
9169 !! end
9170
9171 # Parsoid fails this test, but it might be tricky to support properly.
9172 # See bug 68395.
9173 !! test
9174 Unbalanced closing non-block tags don't break a list
9175 (php parser relies on Tidy to fix up)
9176 !! wikitext
9177 <span>
9178 *a</span><span>
9179 *b</span>
9180 !! html/php+tidy
9181 <ul>
9182 <li><span>a</span></li>
9183 <li><span>b</span></li>
9184 </ul>
9185 !! html/parsoid
9186 <span>
9187 <ul>
9188 <li>a<span></span>
9189 </li>
9190 <li>b
9191 </li>
9192 </ul>
9193 </span>
9194 !! end
9195
9196 !! test
9197 Unclosed formatting tags that straddle lists are closed and reopened
9198 (php parser relies on Tidy to fix up)
9199 !! options
9200 parsoid=wt2html,wt2wt,html2html
9201 !! wikitext
9202 # <s> a
9203 # b </s>
9204 !! html/php+tidy
9205 <ol>
9206 <li><s>a</s></li>
9207 <li><s>b</s></li>
9208 </ol>
9209 !! html/parsoid
9210 <ol><li> <s> a</s></li>
9211 <li><s> b </s></li></ol>
9212 !! end
9213
9214 # See bug 68395.
9215 !!test
9216 1. List embedded in a formatting tag
9217 !! wikitext
9218 <small>
9219 * foo
9220 </small>
9221 !! html/php+tidy
9222 <ul>
9223 <li><small>foo</small></li>
9224 </ul>
9225 !! html/parsoid
9226 <small>
9227 <ul>
9228 <li> foo</li>
9229 </ul>
9230 </small>
9231 !!end
9232
9233 ## Ugly Parsoid output here
9234 ## Not sure what the right output is.
9235 !!test
9236 2. List embedded in a formatting tag
9237 !! wikitext
9238 <small>
9239 *a
9240 *b</small>
9241 !! html/php+tidy
9242 <ul>
9243 <li><small>a</small></li>
9244 <li><small>b</small></li>
9245 </ul>
9246 !! html/parsoid
9247 <small></small>
9248 <ul><small>
9249 <li>a</li>
9250 </small>
9251 <li><small>b</small></li>
9252 </ul>
9253 !!end
9254
9255 # Ugly Parsoid and PHP parser output here
9256 # Not sure if we want to make this a test!
9257 #
9258 ## !!test
9259 ## 3. Unclosed formatting tags in list elements
9260 ## !! wikitext
9261 ## *<small>a
9262 ## *<small>b
9263 ## !! html/php+tidy
9264 ## <ul>
9265 ## <li><small>a</small></li>
9266 ## <li><small><small>b</small></small></li>
9267 ## </ul>
9268 ## !! html/parsoid
9269 ## <ul>
9270 ## <li><small>a</small></li>
9271 ## <small>
9272 ## <li><small>b</small></li>
9273 ## </small></ul>
9274 ## !!end
9275
9276 # This is a bug in the PHP parser + tidy combination.
9277 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9278 # and then fostered out of the table by tidy.)
9279 # We believe the Parsoid output to be correct.
9280 !! test
9281 Table with missing opening <tr> tag
9282 !! options
9283 parsoid=wt2html,wt2wt
9284 !! wikitext
9285 <table>
9286 <td>foo</td>
9287 </tr>
9288 </table>
9289 !! html+tidy
9290 <table>
9291 <tr>
9292 <td>foo</td>
9293 </tr>
9294 </table>
9295 !! end
9296
9297 ###
9298 ### Magic Words
9299 ###
9300
9301 # Note that the current date is hard-coded as
9302 # 1970-01-01T00:02:03Z (a Thursday)
9303 # when running parser tests. The timezone is also fixed to GMT, so
9304 # local date will be identical to current date.
9305
9306 !! test
9307 Magic Word: {{CURRENTDAY}}
9308 !! wikitext
9309 {{CURRENTDAY}}
9310 !! html
9311 <p>1
9312 </p>
9313 !! end
9314
9315 !! test
9316 Magic Word: {{CURRENTDAY2}}
9317 !! wikitext
9318 {{CURRENTDAY2}}
9319 !! html
9320 <p>01
9321 </p>
9322 !! end
9323
9324 !! test
9325 Magic Word: {{CURRENTDAYNAME}}
9326 !! wikitext
9327 {{CURRENTDAYNAME}}
9328 !! html
9329 <p>Thursday
9330 </p>
9331 !! end
9332
9333 !! test
9334 Magic Word: {{CURRENTDOW}}
9335 !! wikitext
9336 {{CURRENTDOW}}
9337 !! html
9338 <p>4
9339 </p>
9340 !! end
9341
9342 !! test
9343 Magic Word: {{CURRENTMONTH}}
9344 !! wikitext
9345 {{CURRENTMONTH}}
9346 !! html
9347 <p>01
9348 </p>
9349 !! end
9350
9351 !! test
9352 Magic Word: {{CURRENTMONTH1}}
9353 !! wikitext
9354 {{CURRENTMONTH1}}
9355 !! html
9356 <p>1
9357 </p>
9358 !! end
9359
9360 !! test
9361 Magic Word: {{CURRENTMONTHABBREV}}
9362 !! wikitext
9363 {{CURRENTMONTHABBREV}}
9364 !! html
9365 <p>Jan
9366 </p>
9367 !! end
9368
9369 !! test
9370 Magic Word: {{CURRENTMONTHNAME}}
9371 !! wikitext
9372 {{CURRENTMONTHNAME}}
9373 !! html
9374 <p>January
9375 </p>
9376 !! end
9377
9378 !! test
9379 Magic Word: {{CURRENTMONTHNAMEGEN}}
9380 !! wikitext
9381 {{CURRENTMONTHNAMEGEN}}
9382 !! html
9383 <p>January
9384 </p>
9385 !! end
9386
9387 !! test
9388 Magic Word: {{CURRENTTIME}}
9389 !! wikitext
9390 {{CURRENTTIME}}
9391 !! html
9392 <p>00:02
9393 </p>
9394 !! end
9395
9396 !! test
9397 Magic Word: {{CURRENTHOUR}}
9398 !! wikitext
9399 {{CURRENTHOUR}}
9400 !! html
9401 <p>00
9402 </p>
9403 !! end
9404
9405 !! test
9406 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9407 !! wikitext
9408 {{CURRENTWEEK}}
9409 !! html
9410 <p>1
9411 </p>
9412 !! end
9413
9414 !! test
9415 Magic Word: {{CURRENTYEAR}}
9416 !! wikitext
9417 {{CURRENTYEAR}}
9418 !! html
9419 <p>1970
9420 </p>
9421 !! end
9422
9423 !! test
9424 Magic Word: {{CURRENTTIMESTAMP}}
9425 !! wikitext
9426 {{CURRENTTIMESTAMP}}
9427 !! html
9428 <p>19700101000203
9429 </p>
9430 !! end
9431
9432 !! test
9433 Magic Words LOCAL (UTC)
9434 !! wikitext
9435 * {{LOCALMONTH}}
9436 * {{LOCALMONTH1}}
9437 * {{LOCALMONTHNAME}}
9438 * {{LOCALMONTHNAMEGEN}}
9439 * {{LOCALMONTHABBREV}}
9440 * {{LOCALDAY}}
9441 * {{LOCALDAY2}}
9442 * {{LOCALDAYNAME}}
9443 * {{LOCALYEAR}}
9444 * {{LOCALTIME}}
9445 * {{LOCALHOUR}}
9446 * {{LOCALWEEK}}
9447 * {{LOCALDOW}}
9448 * {{LOCALTIMESTAMP}}
9449 !! html
9450 <ul><li> 01</li>
9451 <li> 1</li>
9452 <li> January</li>
9453 <li> January</li>
9454 <li> Jan</li>
9455 <li> 1</li>
9456 <li> 01</li>
9457 <li> Thursday</li>
9458 <li> 1970</li>
9459 <li> 00:02</li>
9460 <li> 00</li>
9461 <li> 1</li>
9462 <li> 4</li>
9463 <li> 19700101000203</li></ul>
9464
9465 !! end
9466
9467 !! test
9468 Magic Word: {{FULLPAGENAME}}
9469 !! options
9470 title=[[User:Ævar Arnfjörð Bjarmason]]
9471 !! wikitext
9472 {{FULLPAGENAME}}
9473 !! html
9474 <p>User:Ævar Arnfjörð Bjarmason
9475 </p>
9476 !! end
9477
9478 !! test
9479 Magic Word: {{FULLPAGENAMEE}}
9480 !! options
9481 title=[[User:Ævar Arnfjörð Bjarmason]]
9482 !! wikitext
9483 {{FULLPAGENAMEE}}
9484 !! html
9485 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9486 </p>
9487 !! end
9488
9489 !! test
9490 Magic Word: {{TALKSPACE}}
9491 !! options
9492 title=[[User:Ævar Arnfjörð Bjarmason]]
9493 !! wikitext
9494 {{TALKSPACE}}
9495 !! html
9496 <p>User talk
9497 </p>
9498 !! end
9499
9500 !! test
9501 Magic Word: {{TALKSPACE}}, same namespace
9502 !! options
9503 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9504 !! wikitext
9505 {{TALKSPACE}}
9506 !! html
9507 <p>User talk
9508 </p>
9509 !! end
9510
9511 !! test
9512 Magic Word: {{TALKSPACE}}, main namespace
9513 !! options
9514 title=[[Parser Test]]
9515 !! wikitext
9516 {{TALKSPACE}}
9517 !! html
9518 <p>Talk
9519 </p>
9520 !! end
9521
9522 !! test
9523 Magic Word: {{TALKSPACEE}}
9524 !! options
9525 title=[[User:Ævar Arnfjörð Bjarmason]]
9526 !! wikitext
9527 {{TALKSPACEE}}
9528 !! html
9529 <p>User_talk
9530 </p>
9531 !! end
9532
9533 !! test
9534 Magic Word: {{SUBJECTSPACE}}
9535 !! options
9536 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9537 !! wikitext
9538 {{SUBJECTSPACE}}
9539 !! html
9540 <p>User
9541 </p>
9542 !! end
9543
9544 !! test
9545 Magic Word: {{SUBJECTSPACE}}, same namespace
9546 !! options
9547 title=[[User:Ævar Arnfjörð Bjarmason]]
9548 !! wikitext
9549 {{SUBJECTSPACE}}
9550 !! html
9551 <p>User
9552 </p>
9553 !! end
9554
9555 !! test
9556 Magic Word: {{SUBJECTSPACE}}, main namespace
9557 !! options
9558 title=[[Parser Test]]
9559 !! wikitext
9560 {{SUBJECTSPACE}}
9561 !! html
9562
9563 !! end
9564
9565 !! test
9566 Magic Word: {{SUBJECTSPACEE}}
9567 !! options
9568 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9569 !! wikitext
9570 {{SUBJECTSPACEE}}
9571 !! html
9572 <p>User
9573 </p>
9574 !! end
9575
9576 !! test
9577 Magic Word: {{NAMESPACE}}
9578 !! options
9579 title=[[User:Ævar Arnfjörð Bjarmason]]
9580 !! wikitext
9581 {{NAMESPACE}}
9582 !! html
9583 <p>User
9584 </p>
9585 !! end
9586
9587 !! test
9588 Magic Word: {{NAMESPACEE}}
9589 !! options
9590 title=[[User:Ævar Arnfjörð Bjarmason]]
9591 !! wikitext
9592 {{NAMESPACEE}}
9593 !! html
9594 <p>User
9595 </p>
9596 !! end
9597
9598 !! test
9599 Magic Word: {{NAMESPACENUMBER}}
9600 !! options
9601 title=[[User:Ævar Arnfjörð Bjarmason]]
9602 !! wikitext
9603 {{NAMESPACENUMBER}}
9604 !! html
9605 <p>2
9606 </p>
9607 !! end
9608
9609 !! test
9610 Magic Word: {{SUBPAGENAME}}
9611 !! options
9612 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9613 !! wikitext
9614 {{SUBPAGENAME}}
9615 !! html
9616 <p>sub ö
9617 </p>
9618 !! end
9619
9620 !! test
9621 Magic Word: {{SUBPAGENAMEE}}
9622 !! options
9623 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9624 !! wikitext
9625 {{SUBPAGENAMEE}}
9626 !! html
9627 <p>sub_%C3%B6
9628 </p>
9629 !! end
9630
9631 !! test
9632 Magic Word: {{ROOTPAGENAME}}
9633 !! options
9634 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9635 !! wikitext
9636 {{ROOTPAGENAME}}
9637 !! html
9638 <p>Ævar Arnfjörð Bjarmason
9639 </p>
9640 !! end
9641
9642 !! test
9643 Magic Word: {{ROOTPAGENAMEE}}
9644 !! options
9645 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9646 !! wikitext
9647 {{ROOTPAGENAMEE}}
9648 !! html
9649 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9650 </p>
9651 !! end
9652
9653 !! test
9654 Magic Word: {{BASEPAGENAME}}
9655 !! options
9656 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9657 !! wikitext
9658 {{BASEPAGENAME}}
9659 !! html
9660 <p>Ævar Arnfjörð Bjarmason
9661 </p>
9662 !! end
9663
9664 !! test
9665 Magic Word: {{BASEPAGENAMEE}}
9666 !! options
9667 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9668 !! wikitext
9669 {{BASEPAGENAMEE}}
9670 !! html
9671 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9672 </p>
9673 !! end
9674
9675 !! test
9676 Magic Word: {{TALKPAGENAME}}
9677 !! options
9678 title=[[User:Ævar Arnfjörð Bjarmason]]
9679 !! wikitext
9680 {{TALKPAGENAME}}
9681 !! html
9682 <p>User talk:Ævar Arnfjörð Bjarmason
9683 </p>
9684 !! end
9685
9686 !! test
9687 Magic Word: {{TALKPAGENAMEE}}
9688 !! options
9689 title=[[User:Ævar Arnfjörð Bjarmason]]
9690 !! wikitext
9691 {{TALKPAGENAMEE}}
9692 !! html
9693 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9694 </p>
9695 !! end
9696
9697 !! test
9698 Magic Word: {{SUBJECTPAGENAME}}
9699 !! options
9700 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9701 !! wikitext
9702 {{SUBJECTPAGENAME}}
9703 !! html
9704 <p>User:Ævar Arnfjörð Bjarmason
9705 </p>
9706 !! end
9707
9708 !! test
9709 Magic Word: {{SUBJECTPAGENAMEE}}
9710 !! options
9711 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9712 !! wikitext
9713 {{SUBJECTPAGENAMEE}}
9714 !! html
9715 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9716 </p>
9717 !! end
9718
9719 !! test
9720 Magic Word: {{NUMBEROFFILES}}
9721 !! wikitext
9722 {{NUMBEROFFILES}}
9723 !! html
9724 <p>6
9725 </p>
9726 !! end
9727
9728 !! test
9729 Magic Word: {{PAGENAME}}
9730 !! options
9731 title=[[User:Ævar Arnfjörð Bjarmason]]
9732 !! wikitext
9733 {{PAGENAME}}
9734 !! html
9735 <p>Ævar Arnfjörð Bjarmason
9736 </p>
9737 !! end
9738
9739 !! test
9740 Magic Word: {{PAGENAME}} with metacharacters
9741 !! options
9742 title=[['foo & bar = baz']]
9743 !! wikitext
9744 ''{{PAGENAME}}''
9745 !! html/php
9746 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9747 </p>
9748 !! html+tidy
9749 <p><i>'foo &amp; bar = baz'</i></p>
9750 !! end
9751
9752 !! test
9753 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9754 !! options
9755 title=[[*RFC 1234 http://example.com/]]
9756 !! wikitext
9757 {{PAGENAME}}
9758 !! html/php
9759 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9760 </p>
9761 !! html+tidy
9762 <p>*RFC 1234 http://example.com/</p>
9763 !! end
9764
9765 !! test
9766 Magic Word: {{PAGENAMEE}}
9767 !! options
9768 title=[[User:Ævar Arnfjörð Bjarmason]]
9769 !! wikitext
9770 {{PAGENAMEE}}
9771 !! html
9772 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9773 </p>
9774 !! end
9775
9776 !! test
9777 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9778 !! options
9779 title=[[*RFC 1234 http://example.com/]]
9780 !! wikitext
9781 {{PAGENAMEE}}
9782 !! html/php
9783 <p>&#42;RFC_1234_http&#58;//example.com/
9784 </p>
9785 !! html+tidy
9786 <p>*RFC_1234_http://example.com/</p>
9787 !! end
9788
9789 !! test
9790 Magic Word: {{REVISIONID}}
9791 !! wikitext
9792 {{REVISIONID}}
9793 !! html
9794 <p>1337
9795 </p>
9796 !! end
9797
9798 !! test
9799 Magic Word: {{SCRIPTPATH}}
9800 !! wikitext
9801 {{SCRIPTPATH}}
9802 !! html
9803 <p>/
9804 </p>
9805 !! end
9806
9807 !! test
9808 Magic Word: {{STYLEPATH}}
9809 !! wikitext
9810 {{STYLEPATH}}
9811 !! html
9812 <p>/skins
9813 </p>
9814 !! end
9815
9816 !! test
9817 Magic Word: {{SERVER}}
9818 !! wikitext
9819 {{SERVER}}
9820 !! html
9821 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9822 </p>
9823 !! end
9824
9825 !! test
9826 Magic Word: {{SERVERNAME}}
9827 !! wikitext
9828 {{SERVERNAME}}
9829 !! html
9830 <p>example.org
9831 </p>
9832 !! end
9833
9834 !! test
9835 Magic Word: {{SITENAME}}
9836 !! wikitext
9837 {{SITENAME}}
9838 !! html
9839 <p>MediaWiki
9840 </p>
9841 !! end
9842
9843 !! test
9844 Case-sensitive magic words, when cased differently, should just be template transclusions
9845 !! wikitext
9846 {{CurrentMonth}}
9847 {{currentday}}
9848 {{cURreNTweEK}}
9849 {{currentHour}}
9850 !! html
9851 <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>
9852 <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>
9853 <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>
9854 <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>
9855 </p>
9856 !! end
9857
9858 !! test
9859 Case-insensitive magic words should still work with weird casing.
9860 !! wikitext
9861 {{sErVeRNaMe}}
9862 {{LCFirst:AOEU}}
9863 {{ucFIRST:aoeu}}
9864 {{SERver}}
9865 !! html
9866 <p>example.org
9867 aOEU
9868 Aoeu
9869 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9870 </p>
9871 !! end
9872
9873 # From plwiki:PLOS_ONE
9874 !! test
9875 Parsoid: Page property magic word with magic word contents
9876 !! wikitext
9877 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9878 !! html/parsoid
9879 <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>"}]]}'/>
9880 !! end
9881
9882 !! test
9883 Parsoid: Template-generated DISPLAYTITLE
9884 !! wikitext
9885 {{{{echo|DISPLAYTITLE}}:Foo}}
9886 !! html/parsoid
9887 <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}}]}'/>
9888 !! end
9889
9890 !! test
9891 Namespace 1 {{ns:1}}
9892 !! wikitext
9893 {{ns:1}}
9894 !! html
9895 <p>Talk
9896 </p>
9897 !! end
9898
9899 !! test
9900 Namespace 1 {{ns:01}}
9901 !! wikitext
9902 {{ns:01}}
9903 !! html
9904 <p>Talk
9905 </p>
9906 !! end
9907
9908 !! test
9909 Namespace 0 {{ns:0}} (bug 4783)
9910 !! wikitext
9911 {{ns:0}}
9912 !! html
9913
9914 !! end
9915
9916 !! test
9917 Namespace 0 {{ns:00}} (bug 4783)
9918 !! wikitext
9919 {{ns:00}}
9920 !! html
9921
9922 !! end
9923
9924 !! test
9925 Namespace -1 {{ns:-1}}
9926 !! wikitext
9927 {{ns:-1}}
9928 !! html
9929 <p>Special
9930 </p>
9931 !! end
9932
9933 !! test
9934 Namespace User {{ns:User}}
9935 !! wikitext
9936 {{ns:User}}
9937 !! html
9938 <p>User
9939 </p>
9940 !! end
9941
9942 !! test
9943 Namespace User talk {{ns:User_talk}}
9944 !! wikitext
9945 {{ns:User_talk}}
9946 !! html
9947 <p>User talk
9948 </p>
9949 !! end
9950
9951 !! test
9952 Namespace User talk {{ns:uSeR tAlK}}
9953 !! wikitext
9954 {{ns:uSeR tAlK}}
9955 !! html
9956 <p>User talk
9957 </p>
9958 !! end
9959
9960 !! test
9961 Namespace File {{ns:File}}
9962 !! wikitext
9963 {{ns:File}}
9964 !! html
9965 <p>File
9966 </p>
9967 !! end
9968
9969 !! test
9970 Namespace File {{ns:Image}}
9971 !! wikitext
9972 {{ns:Image}}
9973 !! html
9974 <p>File
9975 </p>
9976 !! end
9977
9978 !! test
9979 Namespace (lang=de) Benutzer {{ns:User}}
9980 !! options
9981 language=de
9982 !! wikitext
9983 {{ns:User}}
9984 !! html
9985 <p>Benutzer
9986 </p>
9987 !! end
9988
9989 !! test
9990 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9991 !! options
9992 language=de
9993 !! wikitext
9994 {{ns:3}}
9995 !! html
9996 <p>Benutzer Diskussion
9997 </p>
9998 !! end
9999
10000
10001 !! test
10002 Urlencode
10003 !! wikitext
10004 {{urlencode:hi world?!}}
10005 {{urlencode:hi world?!|WIKI}}
10006 {{urlencode:hi world?!|PATH}}
10007 {{urlencode:hi world?!|QUERY}}
10008 !! html
10009 <p>hi+world%3F%21
10010 hi_world%3F!
10011 hi%20world%3F%21
10012 hi+world%3F%21
10013 </p>
10014 !! end
10015
10016 !! test
10017 Magic Word: prioritize type info over data-parsoid
10018 !! options
10019 parsoid=html2wt
10020 !! html/parsoid
10021 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10022 !! wikitext
10023 __FORCETOC__
10024 !! end
10025
10026 !! test
10027 Magic Word: serialize on separate line (parsoid)
10028 !! options
10029 parsoid=wt2wt,html2wt
10030 !! wikitext
10031 foo
10032 __NOTOC__
10033 bar
10034 !! html/parsoid
10035 foo<meta property="mw:PageProp/notoc"/>bar
10036 !! end
10037
10038 !! test
10039 Magic Word: rt non-english wikis
10040 !! options
10041 parsoid=wt2wt
10042 language=de
10043 !! wikitext
10044 __NOEDITSECTION__
10045 !! html/parsoid
10046 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10047 !! end
10048
10049 !!test
10050 __proto__ is treated as normal wikitext (T105997)
10051 !!wikitext
10052 __proto__
10053 !!html
10054 <p>__proto__
10055 </p>
10056 !!end
10057
10058 ###
10059 ### Magic links
10060 ###
10061 !! test
10062 Magic links: internal link to RFC (bug 479)
10063 !! wikitext
10064 [[RFC 123]]
10065 !! html/php
10066 <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>
10067 </p>
10068 !! html/parsoid
10069 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10070 !! end
10071
10072 !! test
10073 Magic links: RFC (bug 479)
10074 !! wikitext
10075 RFC 822
10076 !! html/php
10077 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10078 </p>
10079 !! html/parsoid
10080 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10081 !! end
10082
10083 !! test
10084 Magic links: RFC (bug 65278)
10085 !! wikitext
10086 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10087 !! html/php
10088 <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.
10089 </p>
10090 !! html/parsoid
10091 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10092 !! end
10093
10094 !! test
10095 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10096 !! wikitext
10097 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10098 RFC
10099 822
10100 !! html/php
10101 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10102 RFC
10103 822
10104 </p>
10105 !! html/parsoid
10106 <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>
10107 RFC
10108 822</p>
10109 !! end
10110
10111 !! test
10112 Magic links: ISBN (bug 1937)
10113 !! wikitext
10114 ISBN 0-306-40615-2
10115 !! html/php
10116 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10117 </p>
10118 !! html/parsoid
10119 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10120 !! end
10121
10122 !! test
10123 Magic links: ISBN (bug 65278)
10124 !! wikitext
10125 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10126 !! html/php
10127 <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.
10128 </p>
10129 !! html/parsoid
10130 <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>
10131 !! end
10132
10133 !! test
10134 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10135 !! wikitext
10136 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10137 ISBN
10138 9780316098113
10139 ISBN 978
10140 0316098113
10141 !! html/php
10142 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10143 ISBN
10144 9780316098113
10145 ISBN 978
10146 0316098113
10147 </p>
10148 !! html/parsoid
10149 <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>
10150 ISBN
10151 9780316098113
10152 ISBN 978
10153 0316098113</p>
10154 !! end
10155
10156 !! test
10157 Magic links: PMID incorrectly converts space to underscore
10158 !! wikitext
10159 PMID 1234
10160 !! html/php
10161 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10162 </p>
10163 !! html/parsoid
10164 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10165 !! end
10166
10167 !! test
10168 Magic links: PMID (bug 65278)
10169 !! wikitext
10170 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10171 !! html/php
10172 <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.
10173 </p>
10174 !! html/parsoid
10175 <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>
10176 !! end
10177
10178 !! test
10179 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10180 !! wikitext
10181 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10182 PMID
10183 1234
10184 !! html/php
10185 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10186 PMID
10187 1234
10188 </p>
10189 !! html/parsoid
10190 <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>
10191 PMID
10192 1234</p>
10193 !! end
10194
10195 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10196 # since these are ExtLinkText, not MagicLinkText
10197 !! test
10198 Magic links: use appropriate serialization for "almost" magic links.
10199 !! wikitext
10200 X[[Special:BookSources/0978739256|foo]]
10201
10202 X[//tools.ietf.org/html/rfc1234 foo]
10203 !! html/php
10204 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10205 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10206 </p>
10207 !! html/parsoid
10208 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10209 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10210 !! end
10211
10212 ###
10213 ### Templates
10214 ####
10215
10216 !! test
10217 Nonexistent template
10218 !! wikitext
10219 {{thistemplatedoesnotexist}}
10220 !! html
10221 <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>
10222 </p>
10223 !! end
10224
10225 !! test
10226 Template with invalid target containing tags
10227 !! wikitext
10228 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10229 !! html
10230 <p>{{a<b>b</b>|foo|a=b|a = b}}
10231 </p>
10232 !! end
10233
10234 !! test
10235 Template with invalid target containing unclosed tag
10236 !! wikitext
10237 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10238 !! html
10239 <p>{{a<b>|foo|a=b|a = b}}</b>
10240 </p>
10241 !! end
10242
10243 !! test
10244 Template with invalid target containing wikilink
10245 !! wikitext
10246 {{[[Main Page]]}}
10247 !! html/php
10248 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10249 </p>
10250 !! html/parsoid
10251 <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>
10252 !! end
10253
10254 !! test
10255 Template with just whitespace in it, bug #68421
10256 !! wikitext
10257 {{echo|{{ }}}}
10258 !! html/parsoid
10259 <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>
10260 !! end
10261
10262 !! article
10263 Template:test
10264 !! text
10265 This is a test template
10266 !! endarticle
10267
10268 !! test
10269 Simple template
10270 !! wikitext
10271 {{test}}
10272 !! html
10273 <p>This is a test template
10274 </p>
10275 !! end
10276
10277 !! test
10278 Template with explicit namespace
10279 !! wikitext
10280 {{Template:test}}
10281 !! html
10282 <p>This is a test template
10283 </p>
10284 !! end
10285
10286
10287 !! article
10288 Template:paramtest
10289 !! text
10290 This is a test template with parameter {{{param}}}
10291 !! endarticle
10292
10293 !! test
10294 Template parameter
10295 !! wikitext
10296 {{paramtest|param=foo}}
10297 !! html
10298 <p>This is a test template with parameter foo
10299 </p>
10300 !! end
10301
10302 !! article
10303 Template:paramtestnum
10304 !! text
10305 [[{{{1}}}|{{{2}}}]]
10306 !! endarticle
10307
10308 !! test
10309 Template unnamed parameter
10310 !! wikitext
10311 {{paramtestnum|Main Page|the main page}}
10312 !! html
10313 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10314 </p>
10315 !! end
10316
10317 !! article
10318 Template:templatesimple
10319 !! text
10320 (test)
10321 !! endarticle
10322
10323 !! article
10324 Template:templateredirect
10325 !! text
10326 #redirect [[Template:templatesimple]]
10327 !! endarticle
10328
10329 !! article
10330 Template:templateasargtestnum
10331 !! text
10332 {{{{{1}}}}}
10333 !! endarticle
10334
10335 !! article
10336 Template:templateasargtest
10337 !! text
10338 {{template{{{templ}}}}}
10339 !! endarticle
10340
10341 !! article
10342 Template:templateasargtest2
10343 !! text
10344 {{{{{templ}}}}}
10345 !! endarticle
10346
10347 !! test
10348 Template with template name as unnamed argument
10349 !! wikitext
10350 {{templateasargtestnum|templatesimple}}
10351 !! html
10352 <p>(test)
10353 </p>
10354 !! end
10355
10356 !! test
10357 Template with template name as argument
10358 !! wikitext
10359 {{templateasargtest|templ=simple}}
10360 !! html
10361 <p>(test)
10362 </p>
10363 !! end
10364
10365 !! test
10366 Template with template name as argument (2)
10367 !! wikitext
10368 {{templateasargtest2|templ=templatesimple}}
10369 !! html
10370 <p>(test)
10371 </p>
10372 !! end
10373
10374 !! article
10375 Template:templateasargtestdefault
10376 !! text
10377 {{{{{templ|templatesimple}}}}}
10378 !! endarticle
10379
10380 !! article
10381 Template:templa
10382 !! text
10383 '''templ'''
10384 !! endarticle
10385
10386 !! test
10387 Template with default value
10388 !! wikitext
10389 {{templateasargtestdefault}}
10390 !! html
10391 <p>(test)
10392 </p>
10393 !! end
10394
10395 !! test
10396 Template with default value (value set)
10397 !! wikitext
10398 {{templateasargtestdefault|templ=templa}}
10399 !! html
10400 <p><b>templ</b>
10401 </p>
10402 !! end
10403
10404 !! test
10405 Template redirect
10406 !! wikitext
10407 {{templateredirect}}
10408 !! html/php
10409 <p>(test)
10410 </p>
10411 !! html/parsoid
10412 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10413 !! end
10414
10415 !! test
10416 Template with argument in separate line
10417 !! wikitext
10418 {{ templateasargtest |
10419 templ = simple }}
10420 !! html
10421 <p>(test)
10422 </p>
10423 !! end
10424
10425 !! test
10426 Template with complex template as argument
10427 !! wikitext
10428 {{paramtest|
10429 param ={{ templateasargtest |
10430 templ = simple }}}}
10431 !! html
10432 <p>This is a test template with parameter (test)
10433 </p>
10434 !! end
10435
10436 !! test
10437 Template with thumb image (with link in description)
10438 !! wikitext
10439 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10440 !! html/php
10441 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>
10442
10443 !! html+tidy
10444 <p>This is a test template with parameter</p>
10445 <div class="thumb tright">
10446 <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>
10447 <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>
10448 </div>
10449 </div>
10450 !! html/parsoid
10451 <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>
10452 !! end
10453
10454 !! article
10455 Template:complextemplate
10456 !! text
10457 {{{1}}} {{paramtest|
10458 param ={{{param}}}}}
10459 !! endarticle
10460
10461 !! test
10462 Template with complex arguments
10463 !! wikitext
10464 {{complextemplate|
10465 param ={{ templateasargtest |
10466 templ = simple }}|[[Template:complextemplate|link]]}}
10467 !! html
10468 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10469 </p>
10470 !! end
10471
10472 !! test
10473 BUG 553: link with two variables in a piped link
10474 !! wikitext
10475 {|
10476 |[[{{{1}}}|{{{2}}}]]
10477 |}
10478 !! html/php
10479 <table>
10480 <tr>
10481 <td>[[{{{1}}}|{{{2}}}]]
10482 </td></tr></table>
10483
10484 !! html/parsoid
10485 <table>
10486 <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>
10487 !! end
10488
10489 # See: T2553
10490 !! test
10491 Abort table cell attribute parsing on wikilink
10492 !! wikitext
10493 {|
10494 | testing [[one|two]] | three || four
10495 | testing one two | three || four
10496 |}
10497 !! html/php
10498 <table>
10499 <tr>
10500 <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>
10501 <td> four
10502 </td>
10503 <td> three </td>
10504 <td> four
10505 </td></tr></table>
10506
10507 !! html/parsoid
10508 <table>
10509 <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>
10510 <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>
10511 </tbody></table>
10512 !! end
10513
10514 !! test
10515 Don't abort table cell attribute parsing if wikilink is found in template arg
10516 !! wikitext
10517 {|
10518 | Test {{#tag:ref|One two "[[three]]" four}}
10519 |}
10520 !! html/parsoid
10521 <table>
10522 <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>
10523 </tbody></table>
10524 !! end
10525
10526 !! test
10527 Magic variable as template parameter
10528 !! wikitext
10529 {{paramtest|param={{SITENAME}}}}
10530 !! html
10531 <p>This is a test template with parameter MediaWiki
10532 </p>
10533 !! end
10534
10535 !! article
10536 Template:linktest
10537 !! text
10538 [[{{{param}}}|link]]
10539 !! endarticle
10540
10541 !! test
10542 Template parameter as link source
10543 !! wikitext
10544 {{linktest|param=Main Page}}
10545 !! html
10546 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10547 </p>
10548 !! end
10549
10550 !!article
10551 Template:paramtest2
10552 !! text
10553 including another template, {{paramtest|param={{{arg}}}}}
10554 !! endarticle
10555
10556 !! test
10557 Template passing argument to another template
10558 !! wikitext
10559 {{paramtest2|arg='hmm'}}
10560 !! html
10561 <p>including another template, This is a test template with parameter 'hmm'
10562 </p>
10563 !! end
10564
10565 !! article
10566 Template:Linktest2
10567 !! text
10568 Main Page
10569 !! endarticle
10570
10571 !! test
10572 Template as link source
10573 !! wikitext
10574 [[{{linktest2}}]]
10575
10576 [[{{linktest2}}|Main Page]]
10577
10578 [[{{linktest2}}]]Page
10579 !! html
10580 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10581 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10582 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10583 </p>
10584 !! end
10585
10586
10587 !! article
10588 Template:loop1
10589 !! text
10590 {{loop2}}
10591 !! endarticle
10592
10593 !! article
10594 Template:loop2
10595 !! text
10596 {{loop1}}
10597 !! endarticle
10598
10599 !! test
10600 Template infinite loop
10601 !! wikitext
10602 {{loop1}}
10603 !! html
10604 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10605 </p>
10606 !! end
10607
10608 !! test
10609 Template from main namespace
10610 !! wikitext
10611 {{:Main Page}}
10612 !! html
10613 <p>blah blah
10614 </p>
10615 !! end
10616
10617 !! article
10618 Template:table
10619 !! text
10620 {|
10621 | 1 || 2
10622 |-
10623 | 3 || 4
10624 |}
10625 !! endarticle
10626
10627 !! test
10628 BUG 529: Template with table, not included at beginning of line
10629 !! wikitext
10630 foo {{table}}
10631 !! html
10632 <p>foo
10633 </p>
10634 <table>
10635 <tr>
10636 <td> 1 </td>
10637 <td> 2
10638 </td></tr>
10639 <tr>
10640 <td> 3 </td>
10641 <td> 4
10642 </td></tr></table>
10643
10644 !! end
10645
10646 !! test
10647 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10648 !! wikitext
10649 foo
10650 {{table}}
10651 !! html
10652 <p>foo
10653 </p>
10654 <table>
10655 <tr>
10656 <td> 1 </td>
10657 <td> 2
10658 </td></tr>
10659 <tr>
10660 <td> 3 </td>
10661 <td> 4
10662 </td></tr></table>
10663
10664 !! end
10665
10666 !! test
10667 BUG 41: Template parameters shown as broken links
10668 !! wikitext
10669 {{{parameter}}}
10670 !! html
10671 <p>{{{parameter}}}
10672 </p>
10673 !! end
10674
10675 !! test
10676 Template with targets containing wikilinks
10677 !! wikitext
10678 {{[[foo]]}}
10679
10680 {{[[{{echo|foo}}]]}}
10681
10682 {{{{echo|[[foo}}]]}}
10683 !! html
10684 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10685 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10686 </p><p>{{[[foo}}]]
10687 </p>
10688 !! end
10689
10690 !! article
10691 Template:''
10692 !! text
10693 bar
10694 !! endarticle
10695
10696 !! test
10697 Templates: Double quotes as template target
10698 !! wikitext
10699 foo {{''}} baz
10700 !! html/php
10701 <p>foo bar baz
10702 </p>
10703 !! html/parsoid
10704 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10705 </p>
10706 !! end
10707
10708 ## This test is about making sure Parsoid's data-mw is well formed in the
10709 ## face of multiple templates with intersecting and overlapping ranges. The
10710 ## wikitext itself is wretched.
10711 !! test
10712 Templates with intersecting and overlapping ranges
10713 !! wikitext
10714 {|{{echo|
10715 <p>ha</p>}}
10716 {|{{echo|
10717 <p>ho</p>}}
10718 {{echo|{{!}}hi}}
10719 |}
10720 !! html/php+tidy
10721 <p>ha</p>
10722 <p>ho</p>
10723 <table>
10724 <tr>
10725 <td></td>
10726 </tr>
10727 <tr>
10728 <td>hi</td>
10729 </tr>
10730 </table>
10731 <table>
10732 <tr>
10733 <td></td>
10734 </tr>
10735 </table>
10736 !! html/parsoid
10737 <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":""}]]}'>
10738
10739 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10740
10741 <tbody><tr><td>hi</td></tr>
10742 </tbody></table>
10743 !! end
10744
10745 !! article
10746 Template:MSGNW test
10747 !! text
10748 ''None'' of '''this''' should be
10749 * interpreted
10750 but rather passed unmodified
10751 {{test}}
10752 <gallery>
10753 File:Foobar.jpg
10754 </gallery>
10755 <!-- comment -->
10756 !! endarticle
10757
10758 # hmm, fix this or just deprecate msgnw and document its behavior?
10759 !! test
10760 msgnw keyword
10761 !! wikitext
10762 {{msgnw:MSGNW test}}
10763 !! html/php
10764 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10765 &#42; interpreted
10766 &#32;but rather passed unmodified
10767 &#123;&#123;test&#125;&#125;
10768 &#60;gallery&#62;
10769 File:Foobar.jpg
10770 &#60;/gallery&#62;
10771 &#60;!-- comment --&#62;
10772 </p>
10773 !! end
10774
10775 !! test
10776 int keyword
10777 !! wikitext
10778 {{int:youhavenewmessages|lots of money|not!}}
10779 !! html
10780 <p>You have lots of money (not!).
10781 </p>
10782 !! end
10783
10784 !! test
10785 int keyword - non-existing message
10786 !! wikitext
10787 {{int:var}}
10788 !! html
10789 <p>&lt;var&gt;
10790 </p>
10791 !! end
10792
10793 !! article
10794 Template:Includes
10795 !! text
10796 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10797 !! endarticle
10798
10799 !! test
10800 <includeonly> and <noinclude> being included
10801 !! wikitext
10802 {{Includes}}
10803 !! html
10804 <p>Foobar
10805 </p>
10806 !! end
10807
10808 !! article
10809 Template:Includes2
10810 !! text
10811 <onlyinclude>Foo</onlyinclude>bar
10812 !! endarticle
10813
10814 !! test
10815 <onlyinclude> being included
10816 !! wikitext
10817 {{Includes2}}
10818 !! html
10819 <p>Foo
10820 </p>
10821 !! end
10822
10823
10824 !! article
10825 Template:Includes3
10826 !! text
10827 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10828 !! endarticle
10829
10830 !! test
10831 <onlyinclude> and <includeonly> being included
10832 !! wikitext
10833 {{Includes3}}
10834 !! html
10835 <p>Foo
10836 </p>
10837 !! end
10838
10839 !! test
10840 <includeonly> and <noinclude> on a page
10841 !! wikitext
10842 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10843 !! html
10844 <p>Foozar
10845 </p>
10846 !! end
10847
10848 !! test
10849 Un-closed <noinclude>
10850 !! wikitext
10851 <noinclude>
10852 !! html
10853 !! end
10854
10855 !! test
10856 <onlyinclude> on a page
10857 !! wikitext
10858 <onlyinclude>Foo</onlyinclude>bar
10859 !! html
10860 <p>Foobar
10861 </p>
10862 !! end
10863
10864 !! test
10865 Un-closed <onlyinclude>
10866 !! wikitext
10867 <onlyinclude>
10868 !! html
10869 !! end
10870
10871 !!test
10872 Self-closed noinclude, includeonly, onlyinclude tags
10873 !! wikitext
10874 <noinclude />
10875 <includeonly />
10876 <onlyinclude />
10877 !! html
10878 <p><br />
10879 </p>
10880 !!end
10881
10882 !!test
10883 Unbalanced includeonly and noinclude tags
10884 !! wikitext
10885 {|
10886 |a</noinclude>
10887 |b</noinclude></noinclude>
10888 |c</noinclude></includeonly>
10889 |d</includeonly></includeonly>
10890 |}
10891 !! html
10892 <table>
10893 <tr>
10894 <td>a
10895 </td>
10896 <td>b
10897 </td>
10898 <td>c&lt;/includeonly&gt;
10899 </td>
10900 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10901 </td></tr></table>
10902
10903 !!end
10904
10905 !! article
10906 Template:Includeonly section
10907 !! text
10908 <includeonly>
10909 ==Includeonly section==
10910 </includeonly>
10911 ==Section T-1==
10912 !!endarticle
10913
10914 !! test
10915 Bug 6563: Edit link generation for section shown by <includeonly>
10916 !! wikitext
10917 {{includeonly section}}
10918 !! html
10919 <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>
10920 <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>
10921
10922 !! end
10923
10924 # Uses same input as the contents of [[Template:Includeonly section]]
10925 !! test
10926 Bug 6563: Section extraction for section shown by <includeonly>
10927 !! options
10928 section=T-2
10929 !! wikitext
10930 <includeonly>
10931 ==Includeonly section==
10932 </includeonly>
10933 ==Section T-2==
10934 !! html
10935 ==Section T-2==
10936 !! end
10937
10938 !! test
10939 Bug 6563: Edit link generation for section suppressed by <includeonly>
10940 !! wikitext
10941 <includeonly>
10942 ==Includeonly section==
10943 </includeonly>
10944 ==Section 1==
10945 !! html
10946 <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>
10947
10948 !! end
10949
10950 !! test
10951 Bug 6563: Section extraction for section suppressed by <includeonly>
10952 !! options
10953 section=1
10954 !! wikitext
10955 <includeonly>
10956 ==Includeonly section==
10957 </includeonly>
10958 ==Section 1==
10959 !! html
10960 ==Section 1==
10961 !! end
10962
10963 !! test
10964 Un-closed <includeonly>
10965 !! wikitext
10966 <includeonly>
10967 !! html
10968 !! end
10969
10970 ## We used to, but no longer wt2wt this test since the default serializer
10971 ## will normalize the include directives to serialize on their own line.
10972 ## Selser will take care of preserving formatting in scenarios where they
10973 ## intermingled with other wikitext.
10974 !! test
10975 Includes and comments at SOL
10976 !! options
10977 parsoid=wt2html,html2html
10978 !! wikitext
10979 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10980
10981 <noinclude>
10982 some
10983 </noinclude>* stuff
10984 * here
10985
10986 <includeonly>can have stuff</includeonly>=== here ===
10987
10988 !! html/php
10989 <h2><span class="mw-headline" id="hu">hu</span></h2>
10990 <p>some
10991 </p>
10992 <ul><li> stuff</li>
10993 <li> here</li></ul>
10994 <h3><span class="mw-headline" id="here">here</span></h3>
10995
10996 !! html/parsoid
10997 <!-- 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>
10998
10999 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11000 <p>some</p>
11001 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11002 <li> here</li></ul>
11003
11004 <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>
11005
11006 !! end
11007
11008 # TODO: test with DOM fragment reuse!
11009 !! test
11010 Parsoid: DOM fragment reuse
11011 !! options
11012 parsoid=wt2wt,wt2html
11013 !! wikitext
11014 a{{echo|b<table></table>c}}d
11015
11016 a{{echo|b
11017 <table></table>
11018 c}}d
11019
11020 {{echo|a
11021
11022 <table></table>
11023
11024 b}}
11025 !! html
11026 <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>
11027
11028 <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">
11029 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11030 </span><p about="#mwt2">cd</p>
11031
11032 <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">
11033
11034 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11035
11036 </span><p about="#mwt3">b</p>
11037 !! end
11038
11039 !! test
11040 Parsoid: Merge double tds (T52603)
11041 !! options
11042 parsoid
11043 !! wikitext
11044 {|
11045 |{{echo|{{!}} foo}}
11046 |}
11047 !! html
11048 <table><tbody>
11049 <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>
11050 </tbody></table>
11051 !! end
11052
11053 !! test
11054 Parsoid: Merge double tds in nested transclusion content (T52603)
11055 !! options
11056 parsoid
11057 !! wikitext
11058 {{echo|<div>}}
11059 {|
11060 |{{echo|{{!}} foo}}
11061 |}
11062 {{echo|</div>}}
11063 !! html
11064 <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}}]}'>
11065 <table><tbody>
11066 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11067 </tbody></table>
11068 </div>
11069 !! end
11070
11071 ###
11072 ### <includeonly> and <noinclude> in attributes
11073 ###
11074 !!test
11075 0. includeonly around the entire attribute
11076 !! wikitext
11077 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11078 !! html
11079 <p><span id="v2">bar</span>
11080 </p>
11081 !!end
11082
11083 !!test
11084 1. includeonly in html attr key
11085 !! wikitext
11086 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11087 !! html
11088 <p><span id="foo">bar</span>
11089 </p>
11090 !!end
11091
11092 !!test
11093 2. includeonly in html attr value
11094 !! wikitext
11095 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11096 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11097 !! html
11098 <p><span id="v1">bar</span>
11099 <span id="v1">bar</span>
11100 </p>
11101 !!end
11102
11103 !!test
11104 3. includeonly in part of an attr value
11105 !! wikitext
11106 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11107 !! html
11108 <p><span style="color:red;">bar</span>
11109 </p>
11110 !!end
11111
11112 !!test
11113 4. includeonly in table attributes
11114 !! wikitext
11115 {|
11116 |- <noinclude>
11117 |-
11118 |a
11119 </noinclude>
11120 |- <includeonly>
11121 |-
11122 |b
11123 </includeonly>
11124 |}
11125 !! html
11126 <table>
11127
11128
11129 <tr>
11130 <td>a
11131 </td></tr>
11132 </table>
11133
11134 !!end
11135
11136 ###
11137 ### Token Stream Patcher tests
11138 ###
11139 ### These tests won't always pass wt2wt and other modes because
11140 ### on serialization, the table will be output on a new line.
11141 ### For now, we are blacklisting them, and using this to test selser.
11142 ###
11143
11144 !!test
11145 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11146 !!options
11147 parsoid=wt2html,wt2wt
11148 !!wikitext
11149 {{echo|}}{| width = '100%'
11150 |foo
11151 |}
11152 !!html/parsoid
11153 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11154 <tbody><tr><td>foo</td></tr>
11155 </tbody></table>
11156 !!end
11157
11158 ## We used to, but no longer wt2wt this test since the default serializer
11159 ## will normalize the include directives to serialize on their own line.
11160 ## Selser will take care of preserving formatting in scenarios where they
11161 ## intermingled with other wikitext.
11162 !!test
11163 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11164 !!options
11165 parsoid=wt2html
11166 !!wikitext
11167 <includeonly>a</includeonly>{| {{{b}}}
11168 |c
11169 |}
11170 !!html/parsoid
11171 <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}}}":""}}'>
11172 <tbody><tr><td>c</td></tr>
11173 </tbody></table>
11174
11175 !!end
11176
11177 ###
11178 ### Testing parsing of templates where a template arg
11179 ### has the same name as the template itself.
11180 ###
11181
11182 !! article
11183 Template:quote
11184 !! text
11185 {{{quote|{{{1}}}}}}
11186 !! endarticle
11187
11188 !!test
11189 Templates: Template Name/Arg clash: 1. Use of positional param
11190 !! wikitext
11191 {{quote|foo}}
11192 !! html
11193 <p>foo
11194 </p>
11195 !!end
11196
11197 !!test
11198 Templates: Template Name/Arg clash: 2. Use of named param
11199 !! wikitext
11200 {{quote|quote=foo}}
11201 !! html
11202 <p>foo
11203 </p>
11204 !!end
11205
11206 !!test
11207 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11208 !! wikitext
11209 {{quote|quote}}
11210 !! html
11211 <p>quote
11212 </p>
11213 !!end
11214
11215 ###
11216 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11217 ###
11218
11219 !!test
11220 Templates: 1. Simple use
11221 !! wikitext
11222 {{echo|Foo}}
11223 !! html
11224 <p>Foo
11225 </p>
11226 !!end
11227
11228 !!test
11229 Templates: 2. Inside a block tag
11230 !! wikitext
11231 <div>{{echo|Foo}}</div>
11232 <blockquote>{{echo|Foo}}</blockquote>
11233 !! html
11234 <div>Foo</div>
11235 <blockquote>Foo</blockquote>
11236
11237 !! html+tidy
11238 <div>Foo</div>
11239 <blockquote>
11240 <p>Foo</p>
11241 </blockquote>
11242 !!end
11243
11244 !!test
11245 Templates: P-wrapping: 1a. Templates on consecutive lines
11246 !! wikitext
11247 {{echo|Foo}}
11248 {{echo|bar}}
11249 !! html
11250 <p>Foo
11251 bar
11252 </p>
11253 !!end
11254
11255 !!test
11256 Templates: P-wrapping: 1b. Templates on consecutive lines
11257 !! wikitext
11258 Foo
11259
11260 {{echo|bar}}
11261 {{echo|baz}}
11262 !! html
11263 <p>Foo
11264 </p><p>bar
11265 baz
11266 </p>
11267 !!end
11268
11269 !!test
11270 Templates: P-wrapping: 1c. Templates on consecutive lines
11271 !! wikitext
11272 {{echo|Foo}}
11273 {{echo|bar}} <div>baz</div>
11274 !! html
11275 <p>Foo
11276 </p>
11277 bar <div>baz</div>
11278
11279 !! html+tidy
11280 <p>Foo</p>
11281 <p>bar</p>
11282 <div>baz</div>
11283 !! end
11284
11285 !!test
11286 Templates: P-wrapping: 1d. Template preceded by comment-only line
11287 !!options
11288 parsoid
11289 !! wikitext
11290 <!-- foo -->
11291 {{echo|Bar}}
11292 !! html
11293 <!-- foo -->
11294
11295 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11296 !!end
11297
11298 !!test
11299 Templates: Inline Text: 1. Multiple template uses
11300 !! wikitext
11301 {{echo|Foo}}bar{{echo|baz}}
11302 !! html
11303 <p>Foobarbaz
11304 </p>
11305 !!end
11306
11307 !!test
11308 Templates: Inline Text: 2. Back-to-back template uses
11309 !! wikitext
11310 {{echo|Foo}}{{echo|bar}}
11311 !! html
11312 <p>Foobar
11313 </p>
11314 !!end
11315
11316 !!test
11317 Templates: Block Tags: 1. Multiple template uses
11318 !! wikitext
11319 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11320 !! html
11321 <div>Foo</div><div>bar</div><div>baz</div>
11322
11323 !!end
11324
11325 !!test
11326 Templates: Block Tags: 2. Back-to-back template uses
11327 !! wikitext
11328 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11329 !! html
11330 <div>Foo</div><div>bar</div>
11331
11332 !!end
11333
11334 # This is an edge case relating to paragraph wrapping.
11335 !!test
11336 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11337 !! wikitext
11338 {{echo|a
11339 b</p>}}
11340 !! html/parsoid
11341 <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
11342 b</p>
11343 !!end
11344
11345 !!test
11346 Templates: Links: 1. Simple example
11347 !! wikitext
11348 {{echo|[[Foo|bar]]}}
11349 !! html
11350 <p><a href="/wiki/Foo" title="Foo">bar</a>
11351 </p>
11352 !!end
11353
11354 !!test
11355 Templates: Links: 2. Generation of link href
11356 !! wikitext
11357 [[{{echo|Foo}}|bar]]
11358 !! html
11359 <p><a href="/wiki/Foo" title="Foo">bar</a>
11360 </p>
11361 !!end
11362
11363 !!test
11364 Templates: Links: 3. Generation of part of a link href
11365 !! wikitext
11366 [[Fo{{echo|o}}|bar]]
11367
11368 [[Foo{{echo|bar}}]]
11369
11370 [[Foo{{echo|bar}}baz]]
11371
11372 [[Foo{{echo|bar}}|bar]]
11373
11374 [[:Foo{{echo|bar}}]]
11375
11376 [[:Foo{{echo|bar}}|bar]]
11377 !! html
11378 <p><a href="/wiki/Foo" title="Foo">bar</a>
11379 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11380 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11381 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11382 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11383 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11384 </p>
11385 !!end
11386
11387 !!test
11388 Templates: Links: 4. Multiple templates generating link href
11389 !! wikitext
11390 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11391 !! html
11392 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11393 </p>
11394 !!end
11395
11396 !!test
11397 Templates: Links: 5. Generation of link text
11398 !! wikitext
11399 [[Foo|{{echo|bar}}]]
11400 !! html
11401 <p><a href="/wiki/Foo" title="Foo">bar</a>
11402 </p>
11403 !!end
11404
11405 !!test
11406 Templates: Links: 5. Nested templates (only outermost template should be marked)
11407 !! wikitext
11408 {{echo|[[{{echo|Foo}}|bar]]}}
11409 !! html
11410 <p><a href="/wiki/Foo" title="Foo">bar</a>
11411 </p>
11412 !!end
11413
11414 !!test
11415 Templates: HTML Tag: 1. Generation of HTML attr. key
11416 !! wikitext
11417 <div {{echo|style}}="color:red;">foo</div>
11418 !! html
11419 <div style="color:red;">foo</div>
11420
11421 !!end
11422
11423 !!test
11424 Templates: HTML Tag: 2. Generation of HTML attr. value
11425 !! wikitext
11426 <div style={{echo|'color:red;'}}>foo</div>
11427 !! html
11428 <div style="color:red;">foo</div>
11429
11430 !!end
11431
11432 !!test
11433 Templates: HTML Tag: 3. Generation of HTML attr key and value
11434 !! wikitext
11435 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11436 !! html
11437 <div style="color:red;">foo</div>
11438
11439 !!end
11440
11441 !!test
11442 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11443 !! wikitext
11444 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11445 !! html
11446 <div title="This is a long title with just one piece templated">foo</div>
11447
11448 !!end
11449
11450 !!test
11451 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11452 !! wikitext
11453 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11454 !! html
11455 <div title="This is a long title with just one piece templated">foo</div>
11456
11457 !!end
11458
11459 !!test
11460 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11461 !! wikitext
11462 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11463 !! html
11464 <div title="This is a long title with just one piece templated">foo</div>
11465
11466 !!end
11467
11468 # SSS FIXME: While it is great we added support for all this,
11469 # do we want to make this part of the spec? Maybe we want to
11470 # deprecate this kind of usage in the future?
11471 !!test
11472 Templates: HTML Tag: 7. Generation of partial attribute key string
11473 !! wikitext
11474 <div st{{echo|yle}}="color:red;">foo</div>
11475 !! html
11476 <div style="color:red;">foo</div>
11477
11478 !!end
11479
11480 !! test
11481 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11482 !! wikitext
11483 <div {{echo|1=id="v1"}}>bar</div>
11484 !! html
11485 <div id="v1">bar</div>
11486
11487 !!end
11488
11489 !! test
11490 Templates: HTML Tag: 9. Multiple template-generated attributes
11491 !! wikitext
11492 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11493 !! html
11494 <div id="v1" title="foo">bar</div>
11495
11496 !!end
11497
11498 !! test
11499 Templates: Support for templates generating attributes and content
11500 !! wikitext
11501 {| {{mixed_attr_content_template}}
11502 |-
11503 |bar
11504 |}
11505 !! html/php
11506 <table style="color:red;" title="T48811">
11507
11508 <tr>
11509 <td>foo
11510 </td></tr>
11511 <tr>
11512 <td>bar
11513 </td></tr></table>
11514
11515 !! html/parsoid
11516 <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|}"]}'>
11517 <tbody><tr>
11518 <td>foo</td></tr>
11519 <tr>
11520 <td>bar</td></tr>
11521 </tbody></table>
11522 !!end
11523
11524 !! test
11525 1. Entities and nowikis inside templated attributes should be handled correctly
11526 !! wikitext
11527 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11528 !! html/php
11529 <div style="background:#f9f9f9;">foo</div>
11530
11531 !! html/parsoid
11532 <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>
11533 !! end
11534
11535 !! test
11536 2. Entities and nowikis inside templated attributes should be handled correctly
11537 !! wikitext
11538 {|
11539 |{{table_attribs_3}}
11540 |}
11541 !! html/php
11542 <table>
11543 <tr>
11544 <td style="background:#f9f9f9;">Foo
11545 </td></tr></table>
11546
11547 !! html/parsoid
11548 <table>
11549 <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>
11550 </tbody></table>
11551 !! end
11552
11553 !! test
11554 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11555 !! wikitext
11556 {{tbl-start}}
11557 |{{table_attribs_3}}
11558 {{tbl-end}}
11559 !! html/php
11560 <table>
11561 <tr>
11562 <td style="background:#f9f9f9;">Foo
11563 </td></tr></table>
11564
11565 !! html/parsoid
11566 <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}}]}'>
11567 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11568 </tbody></table>
11569 !! end
11570
11571 # T107622
11572 !! test
11573 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11574 !! wikitext
11575 {|
11576 | {{table_attribs_6}} hi
11577 |}
11578 !! html/php
11579 <table>
11580 <tr>
11581 <td style="background: red;"> hi
11582 </td></tr></table>
11583
11584 !! html/parsoid
11585 <table>
11586 <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>
11587 </tbody></table>
11588 !! end
11589
11590 !!test
11591 Templates: HTML Tables: 1. Generating start of a HTML table
11592 !! wikitext
11593 {{echo|<table><tr><td>foo</td>}}</tr></table>
11594 !! html
11595 <table><tr><td>foo</td></tr></table>
11596
11597 !!end
11598
11599 !!test
11600 Templates: HTML Tables: 2a. Generating middle of a HTML table
11601 !! wikitext
11602 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11603 !! html
11604 <table><tr><td>foo</td></tr></table>
11605
11606 !!end
11607
11608 !!test
11609 Templates: HTML Tables: 2b. Generating middle of a HTML table
11610 !! wikitext
11611 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11612 !! html
11613 <table><tr><td>foo</td></tr></table>
11614
11615 !!end
11616
11617 !!test
11618 Templates: HTML Tables: 3. Generating end of a HTML table
11619 !! wikitext
11620 <table><tr>{{echo|<td>foo</td></tr></table>}}
11621 !! html
11622 <table><tr><td>foo</td></tr></table>
11623
11624 !!end
11625
11626 !!test
11627 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11628 !! wikitext
11629 {{echo|<table>}}<tr><td>foo</td></tr></table>
11630 !! html
11631 <table><tr><td>foo</td></tr></table>
11632
11633 !!end
11634
11635 !!test
11636 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11637 !! wikitext
11638 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11639 !! html
11640 <table><tr><td>foo</td></tr></table>
11641
11642 !!end
11643
11644 !!test
11645 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11646 !! wikitext
11647 <table><tr>{{echo|<td>}}foo</td></tr></table>
11648 !! html
11649 <table><tr><td>foo</td></tr></table>
11650
11651 !!end
11652
11653 !!test
11654 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11655 !! wikitext
11656 <table><tr><td>foo{{echo|</td>}}</tr></table>
11657 !! html
11658 <table><tr><td>foo</td></tr></table>
11659
11660 !!end
11661
11662 !!test
11663 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11664 !! wikitext
11665 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11666 !! html
11667 <table><tr><td>foo</td></tr></table>
11668
11669 !!end
11670
11671 !!test
11672 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11673 !! wikitext
11674 <table><tr><td>foo</td></tr>{{echo|</table>}}
11675 !! html
11676 <table><tr><td>foo</td></tr></table>
11677
11678 !!end
11679
11680 !!test
11681 Templates: HTML Tables: 5. Proper fostering of categories from inside
11682 !!options
11683 parsoid=wt2html,wt2wt
11684 !! wikitext
11685 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11686 <!--Two categories (Bug 50330)-->
11687 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11688 !! html
11689 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11690 <!--Two categories (Bug 50330)-->
11691 <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>
11692 !!end
11693
11694 !!test
11695 Templates: Wiki Tables: 1a. Fostering of entire template content
11696 !! wikitext
11697 {|
11698 {{echo|a}}
11699 |}
11700 !! html
11701 <table>
11702 a
11703 <tr><td></td></tr></table>
11704
11705 !! html+tidy
11706 <p>a</p>
11707 <table>
11708 <tr>
11709 <td></td>
11710 </tr>
11711 </table>
11712 !! end
11713
11714 !!test
11715 Templates: Wiki Tables: 1b. Fostering of entire template content
11716 !! wikitext
11717 {|
11718 {{echo|<div>}}
11719 foo
11720 {{echo|</div>}}
11721 |}
11722 !! html
11723 <table>
11724 <div>
11725 <p>foo
11726 </p>
11727 </div>
11728 <tr><td></td></tr></table>
11729
11730 !! html+tidy
11731 <div>
11732 <p>foo</p>
11733 </div>
11734 <table>
11735 <tr>
11736 <td></td>
11737 </tr>
11738 </table>
11739 !! end
11740
11741 !!test
11742 Templates: Wiki Tables: 2. Fostering of partial template content
11743 !! wikitext
11744 {|
11745 {{echo|a
11746 <div>b</div>}}
11747 |}
11748 !! html
11749 <table>
11750 a
11751 <div>b</div>
11752 <tr><td></td></tr></table>
11753
11754 !! html+tidy
11755 <p>a</p>
11756 <div>b</div>
11757 <table>
11758 <tr>
11759 <td></td>
11760 </tr>
11761 </table>
11762 !! end
11763
11764 !!test
11765 Templates: Wiki Tables: 3. td-content via multiple templates
11766 !! wikitext
11767 {|
11768 {{echo|{{pipe}}a}}{{echo|b}}
11769 |}
11770 !! html
11771 <table>
11772 <tr>
11773 <td>ab
11774 </td></tr></table>
11775
11776 !!end
11777
11778 !!test
11779 Templates: Wiki Tables: 4. Templated tags, no content
11780 !! wikitext
11781 {{tbl-start}}
11782 {{tbl-end}}
11783 !! html
11784 <table>
11785 <tr><td></td></tr></table>
11786
11787 !!end
11788
11789 !!test
11790 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11791 !! wikitext
11792 {{tbl-start}}
11793 |foo
11794 {{tbl-end}}
11795 !! html
11796 <table>
11797 <tr>
11798 <td>foo
11799 </td></tr></table>
11800
11801 !!end
11802
11803 !!test
11804 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11805 !! wikitext
11806 {{tbl-start}}
11807 {{!}}foo
11808 {{tbl-end}}
11809 !! html
11810 <table>
11811 <tr>
11812 <td>foo
11813 </td></tr></table>
11814
11815 !!end
11816
11817 ## This test case is very specific to Parsoid's internals
11818 ## and is hence only tested for Parsoid's code. Parsoid uses
11819 ## a <meta> marker tag for <ref> tags and they are expanded
11820 ## much later. We are verifying that this <meta> tag usage
11821 ## doesn't prevent foster parenting.
11822 !!test
11823 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11824 !!wikitext
11825 {{PartialTable}}<ref>foo</ref>
11826 |}
11827
11828 <references />
11829 !!html/parsoid
11830 <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">
11831 <tbody>
11832 </tbody></table>
11833
11834 <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>
11835 !!end
11836
11837 !! test
11838 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11839 !! wikitext
11840 {{echo|
11841 {{{!}}
11842 {{!}}-}}
11843 <onlyinclude>
11844 |foo
11845 </onlyinclude>
11846 {{!}}}
11847 !! html/parsoid
11848 <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{{!}}}"]}'>
11849 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11850 <tbody><tr>
11851
11852 <td>foo
11853 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11854 </tbody></table>
11855 !! end
11856
11857 !!test
11858 Templates: Lists: Multi-line list-items via templates
11859 !! wikitext
11860 *{{echo|a {{nonexistent|
11861 unused}}}}
11862 *{{echo|b {{nonexistent|
11863 unused}}}}
11864 !! html
11865 <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>
11866 <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>
11867
11868 !!end
11869
11870 !!test
11871 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11872 !! wikitext
11873 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11874 !! html
11875 <p><i>ab</i>c<i>d</i>e
11876 </p>
11877 !!end
11878
11879 !!test
11880 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11881 (PHP parser generates misnested html)
11882 !! wikitext
11883 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11884 !! html/parsoid
11885 <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>
11886 !!end
11887
11888 !!test
11889 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11890 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11891 !! options
11892 parsoid=wt2html,wt2wt
11893 !! wikitext
11894 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11895 !! html
11896 <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>
11897 <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>
11898 <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>
11899 !!end
11900
11901 !!test
11902 Templates: Ugly nesting: 4. Divs opened/closed across templates
11903 !! wikitext
11904 a<div>b{{echo|c</div>d}}e
11905 !! html
11906 a<div>bc</div>de
11907
11908 !! html+tidy
11909 <p>a</p>
11910 <div>bc</div>
11911 <p>de</p>
11912 !! end
11913
11914 !!test
11915 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11916 (Parsoid-centric)
11917 !! options
11918 parsoid
11919 !! wikitext
11920 {|
11921 |{{echo|foo</table>}}
11922 |bar
11923 |}
11924 !! html
11925 <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|}"]}'>
11926
11927 <tbody>
11928 <tr>
11929 <td>foo</td></tr></tbody></table><span about="#mwt1">
11930 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11931 |}</span>
11932 !!end
11933
11934 !!test
11935 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11936 (Parsoid-centric)
11937 !! options
11938 parsoid
11939 !! wikitext
11940 <table>
11941 <tr>
11942 <td>
11943 <table>
11944 <tr>
11945 <td>1. {{echo|foo </table>}}</td>
11946 <td> bar </td>
11947 <td>2. {{echo|baz </table>}}</td>
11948 </tr>
11949 <tr>
11950 <td>abc</td>
11951 </tr>
11952 </table>
11953 </td>
11954 </tr>
11955 <tr>
11956 <td>xyz</td>
11957 </tr>
11958 </table>
11959 !! html
11960 <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>"]}'>
11961 <tbody><tr>
11962 <td>
11963 <table>
11964 <tbody><tr>
11965 <td>1. foo </td></tr></tbody></table></td>
11966 <td> bar </td>
11967 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11968 </span><span about="#mwt2">
11969 </span><span about="#mwt2">
11970 </span><span about="#mwt2">abc</span><span about="#mwt2">
11971 </span><span about="#mwt2">
11972 </span><span about="#mwt2">
11973 </span><span about="#mwt2">
11974 </span><span about="#mwt2">
11975 </span><span about="#mwt2">
11976 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11977 </span><span about="#mwt2">
11978 </span>
11979 !!end
11980
11981 !! test
11982 Templates: Ugly templates: 3. newline-only template parameter
11983 !! wikitext
11984 foo {{echo|
11985 }}
11986 !! html
11987 <p>foo
11988 </p>
11989 !! end
11990
11991 # This looks like a bug: a single newline triggers p/br for some reason.
11992 !! test
11993 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11994 !! wikitext
11995 {{echo|
11996 }}
11997 !! html
11998 <p><br />
11999 </p>
12000 !! end
12001
12002 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12003 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12004 !! test
12005 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12006 !! wikitext
12007 {{echo|<table>}}
12008 {{echo|<div>foo}}
12009 {{echo|</table>}}
12010 !! html/parsoid
12011 <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
12012 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12013 </table>
12014 !! end
12015
12016 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12017 # that are "identical" and generate nesting cycles in the algorithm
12018 !! test
12019 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12020 !! wikitext
12021 {{echo|<table><tr><td><table>}}
12022 {{echo|<div>}}
12023 {{echo|</div>}}
12024 !! html/parsoid
12025 <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"}'>
12026 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12027 </table></td></tr></tbody></table>
12028 !! end
12029
12030 !! test
12031 Templates: Parameters substituted at the top-level
12032 !! wikitext
12033 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12034 !! html/php
12035 <p><i>who</i> me? <b>never!</b>
12036 </p>
12037 !! html/parsoid
12038 <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>
12039 !! end
12040
12041 !!test
12042 Parser Functions: 1. Simple example
12043 !! wikitext
12044 {{uc:foo}}
12045 !! html
12046 <p>FOO
12047 </p>
12048 !!end
12049
12050 !!test
12051 Parser Functions: 2. Nested use (only outermost should be marked up)
12052 !! wikitext
12053 {{uc:{{lc:FOO}}}}
12054 !! html
12055 <p>FOO
12056 </p>
12057 !!end
12058
12059 ###
12060 ### Pre-save transform tests
12061 ###
12062 !! test
12063 pre-save transform: subst:
12064 !! options
12065 pst
12066 !! wikitext
12067 {{subst:test}}
12068 !! html/php
12069 This is a test template
12070 !! end
12071
12072 !! test
12073 pre-save transform: normal template
12074 !! options
12075 pst
12076 !! wikitext
12077 {{test}}
12078 !! html/php
12079 {{test}}
12080 !! end
12081
12082 !! test
12083 pre-save transform: nonexistent template
12084 !! options
12085 pst
12086 !! wikitext
12087 {{thistemplatedoesnotexist}}
12088 !! html/php
12089 {{thistemplatedoesnotexist}}
12090 !! end
12091
12092 !! test
12093 pre-save transform: subst magic variables
12094 !! options
12095 pst
12096 !! wikitext
12097 {{subst:SITENAME}}
12098 !! html/php
12099 MediaWiki
12100 !! end
12101
12102 # This is bug 89, which I fixed. -- wtm
12103 !! test
12104 pre-save transform: subst: templates with parameters
12105 !! options
12106 pst
12107 !! wikitext
12108 {{subst:paramtest|param="something else"}}
12109 !! html/php
12110 This is a test template with parameter "something else"
12111 !! end
12112
12113 !! article
12114 Template:nowikitest
12115 !! text
12116 <nowiki>'''not wiki'''</nowiki>
12117 !! endarticle
12118
12119 !! test
12120 pre-save transform: nowiki in subst (bug 1188)
12121 !! options
12122 pst
12123 !! wikitext
12124 {{subst:nowikitest}}
12125 !! html/php
12126 <nowiki>'''not wiki'''</nowiki>
12127 !! end
12128
12129 !! article
12130 Template:commenttest
12131 !! text
12132 This template has <!-- a comment --> in it.
12133 !! endarticle
12134
12135 !! test
12136 pre-save transform: comment in subst (bug 1936)
12137 !! options
12138 pst
12139 !! wikitext
12140 {{subst:commenttest}}
12141 !! html/php
12142 This template has <!-- a comment --> in it.
12143 !! end
12144
12145 !! test
12146 pre-save transform: unclosed tag
12147 !! options
12148 pst noxml
12149 !! wikitext
12150 <nowiki>'''not wiki'''
12151 !! html/php
12152 <nowiki>'''not wiki'''
12153 !! end
12154
12155 !! test
12156 pre-save transform: mixed tag case
12157 !! options
12158 pst noxml
12159 !! wikitext
12160 <NOwiki>'''not wiki'''</noWIKI>
12161 !! html/php
12162 <NOwiki>'''not wiki'''</noWIKI>
12163 !! end
12164
12165 !! test
12166 pre-save transform: unclosed comment in <nowiki>
12167 !! options
12168 pst noxml
12169 !! wikitext
12170 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12171 !! html/php
12172 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12173 !!end
12174
12175 # Leading @ in this template definition works around a limitation
12176 # in parsoid's parserTests which otherwise strips the <span> from the
12177 # result (confusing it for a template wrapper)
12178 !! article
12179 Template:dangerous
12180 !!text
12181 @<span onmouseover="alert('crap')">Oh no</span>
12182 !!endarticle
12183
12184 !!test
12185 (confirming safety of fix for subst bug 1936)
12186 !! wikitext
12187 {{Template:dangerous}}
12188 !! html
12189 <p>@<span>Oh no</span>
12190 </p>
12191 !! end
12192
12193 !! test
12194 pre-save transform: comment containing gallery (bug 5024)
12195 !! options
12196 pst
12197 !! wikitext
12198 <!-- <gallery>data</gallery> -->
12199 !! html/php
12200 <!-- <gallery>data</gallery> -->
12201 !!end
12202
12203 !! test
12204 pre-save transform: comment containing extension
12205 !! options
12206 pst
12207 !! wikitext
12208 <!-- <tag>data</tag> -->
12209 !! html/php
12210 <!-- <tag>data</tag> -->
12211 !!end
12212
12213 !! test
12214 pre-save transform: comment containing nowiki
12215 !! options
12216 pst
12217 !! wikitext
12218 <!-- <nowiki>data</nowiki> -->
12219 !! html/php
12220 <!-- <nowiki>data</nowiki> -->
12221 !!end
12222
12223 !! test
12224 pre-save transform: <noinclude> in subst (bug 3298)
12225 !! options
12226 pst
12227 !! wikitext
12228 {{subst:Includes}}
12229 !! html/php
12230 Foobar
12231 !! end
12232
12233 !! test
12234 pre-save transform: <onlyinclude> in subst (bug 3298)
12235 !! options
12236 pst
12237 !! wikitext
12238 {{subst:Includes2}}
12239 !! html/php
12240 Foo
12241 !! end
12242
12243 !! article
12244 Template:SubstTest
12245 !!text
12246 {{<includeonly>subst:</includeonly>Includes}}
12247 !! endarticle
12248
12249 !! article
12250 Template:SafeSubstTest
12251 !! text
12252 {{<includeonly>safesubst:</includeonly>Includes}}
12253 !! endarticle
12254
12255 !! test
12256 bug 22297: safesubst: works during PST
12257 !! options
12258 pst
12259 !! wikitext
12260 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12261 !! html/php
12262 FoobarFoobar
12263 !! end
12264
12265 !! test
12266 bug 22297: safesubst: works during normal parse
12267 !! wikitext
12268 {{SafeSubstTest}}
12269 !! html
12270 <p>Foobar
12271 </p>
12272 !! end
12273
12274 !! test
12275 subst: does not work during normal parse
12276 !! wikitext
12277 {{SubstTest}}
12278 !! html
12279 <p>{{subst:Includes}}
12280 </p>
12281 !! end
12282
12283 !! test
12284 pre-save transform: context links ("pipe trick")
12285 !! options
12286 pst
12287 !! wikitext
12288 [[Article (context)|]]
12289 [[Bar:Article|]]
12290 [[:Bar:Article|]]
12291 [[Bar:Article (context)|]]
12292 [[:Bar:Article (context)|]]
12293 [[|Article]]
12294 [[|Article (context)]]
12295 [[Bar:X (Y) Z|]]
12296 [[:Bar:X (Y) Z|]]
12297 !! html/php
12298 [[Article (context)|Article]]
12299 [[Bar:Article|Article]]
12300 [[:Bar:Article|Article]]
12301 [[Bar:Article (context)|Article]]
12302 [[:Bar:Article (context)|Article]]
12303 [[Article]]
12304 [[Article (context)]]
12305 [[Bar:X (Y) Z|X (Y) Z]]
12306 [[:Bar:X (Y) Z|X (Y) Z]]
12307 !! end
12308
12309 !! test
12310 pre-save transform: context links ("pipe trick") with interwiki prefix
12311 !! options
12312 pst
12313 !! wikitext
12314 [[interwiki:Article|]]
12315 [[:interwiki:Article|]]
12316 [[interwiki:Bar:Article|]]
12317 [[:interwiki:Bar:Article|]]
12318 !! html/php
12319 [[interwiki:Article|Article]]
12320 [[:interwiki:Article|Article]]
12321 [[interwiki:Bar:Article|Bar:Article]]
12322 [[:interwiki:Bar:Article|Bar:Article]]
12323 !! end
12324
12325 !! test
12326 pre-save transform: context links ("pipe trick") with parens in title
12327 !! options
12328 pst title=[[Somearticle (context)]]
12329 !! wikitext
12330 [[|Article]]
12331 !! html/php
12332 [[Article (context)|Article]]
12333 !! end
12334
12335 !! test
12336 pre-save transform: context links ("pipe trick") with comma in title
12337 !! options
12338 pst title=[[Someplace, Somewhere]]
12339 !! wikitext
12340 [[|Otherplace]]
12341 [[Otherplace, Elsewhere|]]
12342 [[Otherplace, Elsewhere, Anywhere|]]
12343 !! html/php
12344 [[Otherplace, Somewhere|Otherplace]]
12345 [[Otherplace, Elsewhere|Otherplace]]
12346 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12347 !! end
12348
12349 !! test
12350 pre-save transform: context links ("pipe trick") with parens and comma
12351 !! options
12352 pst title=[[Someplace (IGNORED), Somewhere]]
12353 !! wikitext
12354 [[|Otherplace]]
12355 [[Otherplace (place), Elsewhere|]]
12356 !! html/php
12357 [[Otherplace, Somewhere|Otherplace]]
12358 [[Otherplace (place), Elsewhere|Otherplace]]
12359 !! end
12360
12361 !! test
12362 pre-save transform: context links ("pipe trick") with comma and parens
12363 !! options
12364 pst title=[[Who, me? (context)]]
12365 !! wikitext
12366 [[|Yes, you.]]
12367 [[Me, Myself, and I (1937 song)|]]
12368 !! html/php
12369 [[Yes, you. (context)|Yes, you.]]
12370 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12371 !! end
12372
12373 !! test
12374 pre-save transform: context links ("pipe trick") with namespace
12375 !! options
12376 pst title=[[Ns:Somearticle]]
12377 !! wikitext
12378 [[|Article]]
12379 !! html/php
12380 [[Ns:Article|Article]]
12381 !! end
12382
12383 !! test
12384 pre-save transform: context links ("pipe trick") with namespace and parens
12385 !! options
12386 pst title=[[Ns:Somearticle (context)]]
12387 !! wikitext
12388 [[|Article]]
12389 !! html/php
12390 [[Ns:Article (context)|Article]]
12391 !! end
12392
12393 !! test
12394 pre-save transform: context links ("pipe trick") with namespace and comma
12395 !! options
12396 pst title=[[Ns:Somearticle, Context, Whatever]]
12397 !! wikitext
12398 [[|Article]]
12399 !! html/php
12400 [[Ns:Article, Context, Whatever|Article]]
12401 !! end
12402
12403 !! test
12404 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12405 !! options
12406 pst title=[[Ns:Somearticle, Context (context)]]
12407 !! wikitext
12408 [[|Article]]
12409 !! html/php
12410 [[Ns:Article (context)|Article]]
12411 !! end
12412
12413 !! test
12414 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12415 !! options
12416 pst title=[[Ns:Somearticle (IGNORED), Context]]
12417 !! wikitext
12418 [[|Article]]
12419 !! html/php
12420 [[Ns:Article, Context|Article]]
12421 !! end
12422
12423 !! test
12424 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12425 !! options
12426 pst
12427 !! wikitext
12428 [[Article(context)|]]
12429 [[Bar:Article(context)|]]
12430 [[:Bar:Article(context)|]]
12431 [[|Article(context)]]
12432 [[Bar:X(Y)Z|]]
12433 [[:Bar:X(Y)Z|]]
12434 !! html/php
12435 [[Article(context)|Article]]
12436 [[Bar:Article(context)|Article]]
12437 [[:Bar:Article(context)|Article]]
12438 [[Article(context)]]
12439 [[Bar:X(Y)Z|X(Y)Z]]
12440 [[:Bar:X(Y)Z|X(Y)Z]]
12441 !! end
12442
12443 !! test
12444 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12445 !! options
12446 pst
12447 !! wikitext
12448 [[Article (context)|]]
12449 [[Bar:Article (context)|]]
12450 [[:Bar:Article (context)|]]
12451 [[|Article (context)]]
12452 [[Bar:X (Y) Z|]]
12453 [[:Bar:X (Y) Z|]]
12454 !! html/php
12455 [[Article (context)|Article]]
12456 [[Bar:Article (context)|Article]]
12457 [[:Bar:Article (context)|Article]]
12458 [[Article (context)]]
12459 [[Bar:X (Y) Z|X (Y) Z]]
12460 [[:Bar:X (Y) Z|X (Y) Z]]
12461 !! end
12462
12463 !! test
12464 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12465 !! options
12466 pst
12467 !! wikitext
12468 [[Article(context)|]]
12469 [[Bar:Article(context)|]]
12470 [[:Bar:Article(context)|]]
12471 [[|Article(context)]]
12472 [[Bar:X(Y)Z|]]
12473 [[:Bar:X(Y)Z|]]
12474 !! html/php
12475 [[Article(context)|Article]]
12476 [[Bar:Article(context)|Article]]
12477 [[:Bar:Article(context)|Article]]
12478 [[Article(context)]]
12479 [[Bar:X(Y)Z|X(Y)Z]]
12480 [[:Bar:X(Y)Z|X(Y)Z]]
12481 !! end
12482
12483 !! test
12484 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12485 !! options
12486 pst
12487 !! wikitext
12488 [[Article (context), context|]]
12489 [[Article (context),context|]]
12490 [[Bar:Article (context), context|]]
12491 [[Bar:Article (context),context|]]
12492 [[:Bar:Article (context), context|]]
12493 [[:Bar:Article (context),context|]]
12494 !! html/php
12495 [[Article (context), context|Article]]
12496 [[Article (context),context|Article]]
12497 [[Bar:Article (context), context|Article]]
12498 [[Bar:Article (context),context|Article]]
12499 [[:Bar:Article (context), context|Article]]
12500 [[:Bar:Article (context),context|Article]]
12501 !! end
12502
12503 !! test
12504 pre-save transform: trim trailing empty lines
12505 !! options
12506 pst
12507 !! wikitext
12508 Empty lines are trimmed
12509
12510
12511
12512
12513 !! html/php
12514 Empty lines are trimmed
12515 !! end
12516
12517 !! test
12518 pre-save transform: Signature expansion
12519 !! options
12520 pst
12521 !! wikitext
12522 * ~~~
12523 * <noinclude>~~~</noinclude>
12524 * <includeonly>~~~</includeonly>
12525 * <onlyinclude>~~~</onlyinclude>
12526 !! html/php
12527 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12528 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12529 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12530 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12531 !! end
12532
12533
12534 !! test
12535 pre-save transform: Signature expansion in nowiki tags (bug 93)
12536 !! options
12537 pst disabled
12538 !! wikitext
12539 Shall not expand:
12540
12541 <nowiki>~~~~</nowiki>
12542
12543 <includeonly><nowiki>~~~~</nowiki></includeonly>
12544
12545 <noinclude><nowiki>~~~~</nowiki></noinclude>
12546
12547 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12548
12549 {{subst:Foo}} shall be converted to FOO
12550
12551 As well as inside noinclude/onlyinclude
12552 <noinclude>{{subst:Foo}}</noinclude>
12553 <onlyinclude>{{subst:Foo}}</onlyinclude>
12554
12555 But not inside includeonly
12556 <includeonly>{{subst:Foo}}</includeonly>
12557 !! html/php
12558 Shall not expand:
12559
12560 <nowiki>~~~~</nowiki>
12561
12562 <includeonly><nowiki>~~~~</nowiki></includeonly>
12563
12564 <noinclude><nowiki>~~~~</nowiki></noinclude>
12565
12566 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12567
12568 FOO shall be converted to FOO
12569
12570 As well as inside noinclude/onlyinclude
12571 <noinclude>FOO</noinclude>
12572 <onlyinclude>FOO</onlyinclude>
12573
12574 But not inside includeonly
12575 <includeonly>{{subst:Foo}}</includeonly>
12576 !! end
12577
12578 !! test
12579 Parsoid: Recognize nowiki with trailing space in tags
12580 !! options
12581 parsoid=wt2html
12582 !! wikitext
12583 <nowiki ><div>[[foo]]</nowiki >
12584
12585 a<nowiki / >b
12586
12587 c<nowiki />d
12588
12589 e<nowiki/ >f
12590 !! html
12591 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12592 <p>ab</p>
12593 <p>cd</p>
12594 <p>ef</p>
12595 !! end
12596
12597 !! test
12598 Parsoid: Recognize nowiki with odd capitalization
12599 !! options
12600 parsoid=wt2html
12601 !! wikitext
12602 <noWikI ><div>[[foo]]</Nowiki >
12603 !! html
12604 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12605 !! end
12606
12607
12608 !! test
12609 Parsoid: Escape nowiki with trailing space in tags
12610 !! options
12611 parsoid=html2wt
12612 !! html/parsoid
12613 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12614 <p>a&lt;nowiki /&gt;b</p>
12615 <p>c&lt;nowiki/ &gt;d</p>
12616 !! wikitext
12617 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12618
12619 a&lt;nowiki /&gt;b
12620
12621 c&lt;nowiki/ &gt;d
12622 !! end
12623
12624 !! test
12625 Parsoid: Escape weird noWikI capitalizations
12626 !! options
12627 parsoid=html2wt
12628 !! html/parsoid
12629 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12630 !! wikitext
12631 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12632 !! end
12633
12634 ###
12635 ### Message transform tests
12636 ###
12637 !! test
12638 message transform: magic variables
12639 !! options
12640 msg
12641 !! wikitext
12642 {{SITENAME}}
12643 !! html
12644 MediaWiki
12645 !! end
12646
12647 !! test
12648 message transform: should not transform wiki markup
12649 !! options
12650 msg
12651 !! wikitext
12652 ''test''
12653 !! html
12654 ''test''
12655 !! end
12656
12657 !! test
12658 message transform: <noinclude> in transcluded template (bug 4926)
12659 !! options
12660 msg
12661 !! wikitext
12662 {{Includes}}
12663 !! html
12664 Foobar
12665 !! end
12666
12667 !! test
12668 message transform: <onlyinclude> in transcluded template (bug 4926)
12669 !! options
12670 msg
12671 !! wikitext
12672 {{Includes2}}
12673 !! html
12674 Foo
12675 !! end
12676
12677 !! test
12678 {{#special:}} page name, known
12679 !! options
12680 msg
12681 !! wikitext
12682 {{#special:Recentchanges}}
12683 !! html
12684 Special:RecentChanges
12685 !! end
12686
12687 !! test
12688 {{#special:}} page name with subpage, known
12689 !! options
12690 msg
12691 !! wikitext
12692 {{#special:Recentchanges/param}}
12693 !! html
12694 Special:RecentChanges/param
12695 !! end
12696
12697 !! test
12698 {{#special:}} page name, unknown
12699 !! options
12700 msg
12701 !! wikitext
12702 {{#special:foobar nonexistent}}
12703 !! html
12704 Special:Foobar nonexistent
12705 !! end
12706
12707 !! test
12708 {{#speciale:}} page name, known
12709 !! options
12710 msg
12711 !! wikitext
12712 {{#speciale:Recentchanges}}
12713 !! html
12714 Special:RecentChanges
12715 !! end
12716
12717 !! test
12718 {{#speciale:}} page name with subpage, known
12719 !! options
12720 msg
12721 !! wikitext
12722 {{#speciale:Recentchanges/param}}
12723 !! html
12724 Special:RecentChanges/param
12725 !! end
12726
12727 !! test
12728 {{#speciale:}} page name, unknown
12729 !! options
12730 msg
12731 !! wikitext
12732 {{#speciale:foobar nonexistent}}
12733 !! html
12734 Special:Foobar_nonexistent
12735 !! end
12736
12737 ###
12738 ### Images
12739 ###
12740 ### For Parsoid-specific tests, see
12741 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12742
12743 !! test
12744 Simple image
12745 !! options
12746 parsoid=wt2html,wt2wt,html2html
12747 !! wikitext
12748 [[Image:foobar.jpg]]
12749 !! html/php
12750 <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>
12751 </p>
12752 !! html/parsoid
12753 <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>
12754 !! end
12755
12756 !! test
12757 Simple image (using File: namespace, now canonical)
12758 !! wikitext
12759 [[File:Foobar.jpg]]
12760 !! html/php
12761 <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>
12762 </p>
12763 !! html/parsoid
12764 <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>
12765 !! end
12766
12767 !! test
12768 Right-aligned image
12769 !! wikitext
12770 [[File:Foobar.jpg|right]]
12771 !! html/php
12772 <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>
12773
12774 !! html/parsoid
12775 <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>
12776 !! end
12777
12778 !! test
12779 Image with caption
12780 !! wikitext
12781 [[File:Foobar.jpg|right|Caption text]]
12782 !! html/php
12783 <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>
12784
12785 !! html/parsoid
12786 <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>
12787 !! end
12788
12789 !! test
12790 Image with caption, bug 53312 #1
12791 !! wikitext
12792 [[File:Foobar.jpg|right|Caption page stuff]]
12793 !! html/php
12794 <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>
12795
12796 !! html/parsoid
12797 <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>
12798 !! end
12799
12800 !! test
12801 Image with caption, bug 53312 #2
12802 !! wikitext
12803 [[File:Foobar.jpg|right|Caption page=]]
12804 !! html/php
12805 <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>
12806
12807 !! html/parsoid
12808 <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>
12809 !! end
12810
12811 !! test
12812 Image with caption, bug 53312 #3
12813 !! wikitext
12814 [[File:Foobar.jpg|right|Caption page=stuff]]
12815 !! html/php
12816 <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>
12817
12818 !! html/parsoid
12819 <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>
12820 !! end
12821
12822 !! test
12823 Allow empty links in image captions (Bug 60753)
12824 !! options
12825 thumbsize=220
12826 !! wikitext
12827 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12828 [[]]
12829 [[Link2]]
12830 ]]
12831 !! html/php
12832 <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>
12833
12834 !! html/parsoid
12835 <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>
12836 [[]]
12837 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12838 </figcaption></figure>
12839 !! end
12840
12841 !! test
12842 Titles in unlinked images (T23454)
12843 !! wikitext
12844 [[File:Foobar.jpg|link=|stuff]]
12845 !! html/php
12846 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12847 </p>
12848 !! end
12849
12850 !! test
12851 Link with empty target
12852 !! wikitext
12853 [[]]
12854 !! html
12855 <p>[[]]
12856 </p>
12857 !! end
12858
12859 !! test
12860 Image with link trail
12861 !! wikitext
12862 Linktrails should not work for images: [[File:Foobar.jpg]]s
12863 !! html/php
12864 <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
12865 </p>
12866 !! html/parsoid
12867 <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>
12868 !! end
12869
12870 !! test
12871 Image with empty attribute
12872 !! options
12873 parsoid=wt2html,wt2wt,html2html
12874 !! wikitext
12875 [[File:Foobar.jpg|right||Caption text]]
12876 !! html/php
12877 <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>
12878
12879 !! html/parsoid
12880 <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>
12881 !! end
12882
12883 !! test
12884 1. Block image with individual attributes from templates
12885 !! wikitext
12886 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12887 !! html/php
12888 <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>
12889
12890 !! html/parsoid
12891 <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>
12892 !! end
12893
12894 !! test
12895 2. Block Image with individual attributes from templates
12896 !! wikitext
12897 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12898 !! html/php
12899 <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>
12900
12901 !! html/parsoid
12902 <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>
12903 !! end
12904
12905 !! test
12906 3. Inline image with individual attributes from templates
12907 !! wikitext
12908 [[File:Foobar.jpg|{{echo|50px}}]]
12909 !! html/php
12910 <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>
12911 </p>
12912 !! html/parsoid
12913 <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>
12914 !! end
12915
12916 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12917 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12918 !! test
12919 Image with multiple attributes from the same template
12920 !! wikitext
12921 [[File:Foobar.jpg|{{image_attribs}}]]
12922 !! html/php
12923 <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>
12924
12925 !! html/parsoid
12926 <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>
12927 !! end
12928
12929 !! test
12930 Image with link tails
12931 !! options
12932 thumbsize=220
12933 !! wikitext
12934 123[[File:Foobar.jpg]]456
12935 123[[File:Foobar.jpg|right]]456
12936 123[[File:Foobar.jpg|thumb]]456
12937 !! html/php
12938 <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
12939 </p>
12940 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
12941 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
12942
12943 !! html/php+tidy
12944 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456</p>
12945 <p>123</p>
12946 <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>
12947 <p>456 123</p>
12948 <div class="thumb tright">
12949 <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>
12950 <div class="thumbcaption">
12951 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12952 </div>
12953 </div>
12954 </div>
12955 <p>456</p>
12956 !! html/parsoid
12957 <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>
12958 <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>
12959 <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>
12960 !! end
12961
12962 !! test
12963 Image with multiple captions -- only last one is accepted
12964 !! wikitext
12965 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12966 !! html/php
12967 <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>
12968
12969 !! html/parsoid
12970 <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>
12971 !! end
12972
12973 !! test
12974 Image with multiple widths -- use last
12975 !! wikitext
12976 [[File:Foobar.jpg|200px|300px|caption]]
12977 !! html/php
12978 <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>
12979 </p>
12980 !! html/parsoid
12981 <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>
12982 !! end
12983
12984 !! test
12985 Image with multiple alignments -- use first (bug 48664)
12986 !! options
12987 thumbsize=220
12988 !! wikitext
12989 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12990
12991 [[File:Foobar.jpg|middle|text-top|caption]]
12992 !! html/php
12993 <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>
12994 <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>
12995 </p>
12996 !! html/parsoid
12997 <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>
12998 <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>
12999 !! end
13000
13001 !! test
13002 Image with width attribute at different positions
13003 !! wikitext
13004 [[File:Foobar.jpg|200px|right|Caption]]
13005 [[File:Foobar.jpg|right|200px|Caption]]
13006 [[File:Foobar.jpg|right|Caption|200px]]
13007 !! html/php
13008 <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>
13009 <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>
13010 <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>
13011
13012 !! html/parsoid
13013 <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>
13014 <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>
13015 <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>
13016 !! end
13017
13018 # a sad bit of backward-compatibility
13019 !! test
13020 Image with size specified with pxpx (bug 13500, 51628)
13021 !! options
13022 parsoid=wt2html,wt2wt,html2html
13023 !! wikitext
13024 [[File:Foobar.jpg|20pxpx]]
13025 [[File:Foobar.jpg|200x20pxpx]]
13026 !! html/php
13027 <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>
13028 <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>
13029 </p>
13030 !! html/parsoid
13031 <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>
13032 !! end
13033
13034 !! test
13035 Image with link parameter, wiki target
13036 !! wikitext
13037 [[File:Foobar.jpg|link=Main Page]]
13038 !! html/php
13039 <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>
13040 </p>
13041 !! html/parsoid
13042 <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>
13043 !! end
13044
13045 # parsoid bug 49293 (part 1)
13046 !! test
13047 Image with link parameter, URL target
13048 !! wikitext
13049 [[File:Foobar.jpg|link=http://example.com/]]
13050 !! html/php
13051 <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>
13052 </p>
13053 !! html/parsoid
13054 <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>
13055 !! end
13056
13057 # parsoid bug 49293 (part 2)
13058 !! test
13059 Image with link parameter, protocol-less URL target
13060 !! wikitext
13061 [[File:Foobar.jpg|link=//example.com/]]
13062 !! html/php
13063 <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>
13064 </p>
13065 !! html/parsoid
13066 <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>
13067 !! end
13068
13069 !! test
13070 Escaping non-block captions (T107435)
13071 !! options
13072 parsoid={
13073 "modes": ["wt2wt"],
13074 "changes": [
13075 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13076 ]
13077 }
13078 !! wikitext
13079 [[Image:Foobar.jpg|caption]]
13080 !! wikitext/edited
13081 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13082 !! end
13083
13084 # wgExternalLinkTarget not supported by Parsoid
13085 !! test
13086 Image with link parameter, wgExternalLinkTarget
13087 !! wikitext
13088 [[Image:foobar.jpg|link=http://example.com/]]
13089 !! config
13090 wgExternalLinkTarget='foobar'
13091 !! html/php
13092 <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>
13093 </p>
13094 !! end
13095
13096 !! test
13097 Image with link parameter, wgNoFollowLinks set to false
13098 !! wikitext
13099 [[Image:foobar.jpg|link=http://example.com/]]
13100 !! config
13101 wgNoFollowLinks=false
13102 !! html
13103 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13104 </p>
13105 !! end
13106
13107 !! test
13108 Image with link parameter, wgNoFollowDomainExceptions
13109 !! wikitext
13110 [[Image:foobar.jpg|link=http://example.com/]]
13111 !! config
13112 wgNoFollowDomainExceptions='example.com'
13113 !! html
13114 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13115 </p>
13116 !! end
13117
13118 # wgExternalLinkTarget not supported by Parsoid
13119 !! test
13120 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13121 !! wikitext
13122 [[Image:foobar.jpg|link=http://example.com/|Title]]
13123 !! config
13124 wgExternalLinkTarget='foobar'
13125 !! html/php
13126 <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>
13127 </p>
13128 !! end
13129
13130 !! test
13131 Image with empty link parameter
13132 !! wikitext
13133 [[File:Foobar.jpg|link=]]
13134 !! html/php
13135 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13136 </p>
13137 !! html/parsoid
13138 <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>
13139 !! end
13140
13141 !! test
13142 Image with link parameter (wiki target) and unnamed parameter
13143 !! wikitext
13144 [[File:Foobar.jpg|link=Main_Page|Title]]
13145 !! html/php
13146 <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>
13147 </p>
13148 !! html/parsoid
13149 <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>
13150 !! end
13151
13152 !! test
13153 Image with link parameter (URL target) and unnamed parameter
13154 !! wikitext
13155 [[File:Foobar.jpg|link=http://example.com/|Title]]
13156 !! html/php
13157 <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>
13158 </p>
13159 !! html/parsoid
13160 <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>
13161 !! end
13162
13163 !! test
13164 Thumbnail image with link parameter
13165 !! options
13166 thumbsize=220
13167 parsoid=wt2html,wt2wt,html2html
13168 !! wikitext
13169 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13170 !! html/php
13171 <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>
13172
13173 !! html/parsoid
13174 <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>
13175 !! end
13176
13177 !! test
13178 Manually-specified thumbnail image
13179 !! options
13180 thumbsize=220
13181 !! wikitext
13182 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13183 !! html/php
13184 <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>
13185
13186 !! html/parsoid
13187 <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>
13188 !! end
13189
13190 !! test
13191 Manually-specified thumbnail image with explicit link to wiki page
13192 !! options
13193 thumbsize=220
13194 parsoid=wt2html,wt2wt,html2html
13195 !! wikitext
13196 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13197 !! html/php
13198 <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>
13199
13200 !! html/parsoid
13201 <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>
13202 !! end
13203
13204 !! test
13205 Manually-specified thumbnail image with explicit link to url
13206 !! options
13207 thumbsize=220
13208 parsoid=wt2html,wt2wt,html2html
13209 !! wikitext
13210 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13211 !! html/php
13212 <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>
13213
13214 !! html/parsoid
13215 <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>
13216 !! end
13217
13218 !! test
13219 Manually-specified thumbnail image with explicit no link
13220 !! options
13221 thumbsize=220
13222 parsoid=wt2html,wt2wt,html2html
13223 !! wikitext
13224 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13225 !! html/php
13226 <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>
13227
13228 !! html/parsoid
13229 <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>
13230 !! end
13231
13232 !! test
13233 Manually-specified thumbnail image with explicit link and alt text
13234 !! options
13235 thumbsize=220
13236 parsoid=wt2html,wt2wt,html2html
13237 !! wikitext
13238 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13239 !! html/php
13240 <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>
13241
13242 !! html/parsoid
13243 <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>
13244 !! end
13245
13246 !! test
13247 Image with frame and link
13248 !! options
13249 parsoid=wt2html,wt2wt,html2html
13250 !! wikitext
13251 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13252 !! html/php
13253 <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>
13254
13255 !! html/parsoid
13256 <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>
13257 !! end
13258
13259 !! test
13260 Image with frame and link and explicit alt
13261 !! options
13262 parsoid=wt2html,wt2wt,html2html
13263 !! wikitext
13264 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13265 !! html/php
13266 <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>
13267
13268 !! html/parsoid
13269 <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>
13270 !! end
13271
13272 !! test
13273 Image with wiki markup in implicit alt
13274 !! wikitext
13275 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13276
13277 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13278 !! html/php
13279 <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>
13280 </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>
13281 </p>
13282 !! html/parsoid
13283 <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>
13284 <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>
13285 !! end
13286
13287 !! test
13288 Alt image option should handle most kinds of wikitext without barfing
13289 !! wikitext
13290 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13291 !! html/php
13292 <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>
13293
13294 !! html/parsoid
13295 <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>
13296 !! end
13297
13298 ###################
13299 # Conflicting image format options.
13300 # First option specified should 'win'.
13301 # All three cases in each test should be identical.
13302
13303 !! test
13304 Image with 'frameless' first.
13305 !! options
13306 parsoid=wt2html,wt2wt,html2html
13307 !! wikitext
13308 [[File:Foobar.jpg|frameless|caption]]
13309
13310 [[File:Foobar.jpg|frameless|frame|caption]]
13311
13312 [[File:Foobar.jpg|frameless|thumb|caption]]
13313 !! html/php
13314 <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>
13315 </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>
13316 </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>
13317 </p>
13318 !! html/parsoid
13319 <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>
13320 <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>
13321 <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>
13322 !! end
13323
13324 !! test
13325 Image with 'frame' first.
13326 !! options
13327 parsoid=wt2html,wt2wt,html2html
13328 !! wikitext
13329 [[File:Foobar.jpg|frame|caption]]
13330 [[File:Foobar.jpg|frame|frameless|caption]]
13331 [[File:Foobar.jpg|frame|thumb|caption]]
13332 !! html/php
13333 <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>
13334 <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>
13335 <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>
13336
13337 !! html/parsoid
13338 <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>
13339 <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>
13340 <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>
13341 !! end
13342
13343 !! test
13344 Image with 'thumb' first.
13345 !! options
13346 parsoid=wt2html,wt2wt,html2html
13347 !! wikitext
13348 [[File:Foobar.jpg|thumb|caption]]
13349 [[File:Foobar.jpg|thumb|frameless|caption]]
13350 [[File:Foobar.jpg|thumb|frame|caption]]
13351 !! html/php
13352 <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>
13353 <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>
13354 <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>
13355
13356 !! html/parsoid
13357 <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>
13358 <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>
13359 <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>
13360 !! end
13361
13362 ###################
13363 # Image sizing.
13364 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13365 # and https://phabricator.wikimedia.org/T64258
13366 # Foobar has actual size of 1941x220
13367 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13368 # a scalable format.
13369 # 2. Framed images always ignore size options; always render at default size.
13370 # 3. "Unspecified format" and border are the only types which can be
13371 # enlarged.
13372
13373 !! test
13374 Image: "unspecified format" and border enlarge
13375 !! options
13376 parsoid=wt2html,wt2wt,html2html
13377 !! wikitext
13378 [[File:Foobar.jpg|2000px]]
13379
13380 [[File:Foobar.jpg|border|2000px]]
13381 !! html/php
13382 <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>
13383 </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>
13384 </p>
13385 !! html/parsoid
13386 <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>
13387 <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>
13388 !! end
13389
13390 !! test
13391 Image: "unspecified format" and border reduce
13392 !! options
13393 parsoid=wt2html,wt2wt,html2html
13394 !! wikitext
13395 [[File:Foobar.jpg|1000px]]
13396
13397 [[File:Foobar.jpg|border|1000px]]
13398 !! html/php
13399 <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>
13400 </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>
13401 </p>
13402 !! html/parsoid
13403 <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>
13404 <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>
13405 !! end
13406
13407 !! test
13408 Image: thumbs reduce
13409 !! options
13410 parsoid=wt2html,wt2wt,html2html
13411 !! wikitext
13412 [[File:Foobar.jpg|thumb|50px]]
13413 !! html/php
13414 <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>
13415
13416 !! html/parsoid
13417 <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>
13418 !! end
13419
13420 !! test
13421 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13422 !! options
13423 parsoid=wt2html,wt2wt,html2html
13424 !! wikitext
13425 [[File:Foobar.jpg|thumb|2000px]]
13426
13427 [[File:Foobar.svg|thumb|2000px]]
13428 !! html/php
13429 <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>
13430 <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>
13431
13432 !! html/parsoid
13433 <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>
13434 <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>
13435 !! end
13436
13437 !! test
13438 Image: frameless can reduce in size
13439 !! options
13440 parsoid=wt2html,wt2wt,html2html
13441 !! wikitext
13442 [[File:Foobar.jpg|frameless|50px]]
13443 !! html/php
13444 <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>
13445 </p>
13446 !! html/parsoid
13447 <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>
13448 !! end
13449
13450 !! test
13451 Image: bitmap frameless can't be enlarged past original size, but vector can
13452 !! options
13453 parsoid=wt2html,wt2wt,html2html
13454 !! wikitext
13455 [[File:Foobar.jpg|frameless|2000px]]
13456
13457 [[File:Foobar.svg|frameless|2000px]]
13458 !! html/php
13459 <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>
13460 </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>
13461 </p>
13462 !! html/parsoid
13463 <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>
13464 <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>
13465 !! end
13466
13467 !! test
13468 Image: framed images are always unscaled.
13469 !! options
13470 parsoid=wt2html,wt2wt,html2html
13471 !! wikitext
13472 [[File:Foobar.jpg|frame]]
13473
13474 [[File:Foobar.jpg|frame|50px]]
13475
13476 [[File:Foobar.jpg|frame|50x50px]]
13477
13478 [[File:Foobar.jpg|frame|2000px]]
13479 !! html/php
13480 <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>
13481 <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>
13482 <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>
13483 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13484
13485 !! html/parsoid
13486 <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>
13487 <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>
13488 <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>
13489 <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>
13490 !! end
13491
13492 ###################
13493
13494 !! test
13495 Link to image page- image page normally doesn't exists, hence edit link
13496 Add test with existing image page
13497 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13498 !! wikitext
13499 [[:Image:test]]
13500 !! html
13501 <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>
13502 </p>
13503 !! end
13504
13505 !! test
13506 bug 18784 Link to non-existent image page with caption should use caption as link text
13507 !! wikitext
13508 [[:Image:test|caption]]
13509 !! html
13510 <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>
13511 </p>
13512 !! end
13513
13514 !! test
13515 Frameless image caption with a free URL
13516 !! wikitext
13517 [[File:Foobar.jpg|http://example.com]]
13518 !! html/php
13519 <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>
13520 </p>
13521 !! html/parsoid
13522 <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>
13523 !! end
13524
13525 !! test
13526 Thumbnail image caption with a free URL
13527 !! options
13528 thumbsize=220
13529 !! wikitext
13530 [[File:Foobar.jpg|thumb|http://example.com]]
13531 !! html/php
13532 <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>
13533
13534 !! html/parsoid
13535 <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>
13536 !! end
13537
13538 !! test
13539 Thumbnail image caption with a free URL and explicit alt
13540 !! options
13541 thumbsize=220
13542 parsoid=wt2html,wt2wt,html2html
13543 !! wikitext
13544 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13545 !! html/php
13546 <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>
13547
13548 !! html/parsoid
13549 <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>
13550 !! end
13551
13552 !! test
13553 SVG thumbnails with no language set
13554 !! options
13555 !! wikitext
13556 [[File:Foobar.svg|thumb|caption]]
13557 !! html/php
13558 <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>
13559
13560 !! html/parsoid
13561 <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>
13562 !! end
13563
13564 !! test
13565 SVG thumbnails with language de
13566 !! options
13567 parsoid=wt2html,wt2wt,html2html
13568 !! wikitext
13569 [[File:Foobar.svg|thumb|caption|lang=de]]
13570 !! html/php
13571 <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>
13572
13573 !! html/parsoid
13574 <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>
13575 !! end
13576
13577 !! test
13578 SVG thumbnails with invalid language code
13579 !! options
13580 parsoid=wt2html,wt2wt,html2html
13581 !! wikitext
13582 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13583 !! html/php
13584 <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>
13585
13586 !! html/parsoid
13587 <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>
13588 !! end
13589
13590 !! test
13591 BUG 1887: A ISBN with a thumbnail
13592 !! wikitext
13593 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13594 !! html/php
13595 <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>
13596
13597 !! html/parsoid
13598 <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>
13599 !! end
13600
13601 !! test
13602 BUG 1887: A RFC with a thumbnail
13603 !! wikitext
13604 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13605 !! html/php
13606 <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>
13607
13608 !! html/parsoid
13609 <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>
13610 !! end
13611
13612 !! test
13613 BUG 1887: A mailto link with a thumbnail
13614 !! wikitext
13615 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13616 !! html/php
13617 <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>
13618
13619 !! html/parsoid
13620 <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>
13621 !! end
13622
13623 # Pending resolution to bug 368
13624 !! test
13625 BUG 648: Frameless image caption with a link
13626 !! wikitext
13627 [[File:Foobar.jpg|text with a [[link]] in it]]
13628 !! html/php
13629 <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>
13630 </p>
13631 !! html/parsoid
13632 <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>
13633 !! end
13634
13635 !! test
13636 BUG 648: Frameless image caption with a link (suffix)
13637 !! wikitext
13638 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13639 !! html/php
13640 <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>
13641 </p>
13642 !! html/parsoid
13643 <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>
13644 !! end
13645
13646 !! test
13647 BUG 648: Frameless image caption with an interwiki link
13648 !! wikitext
13649 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13650 !! html/php
13651 <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>
13652 </p>
13653 !! html/parsoid
13654 <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>
13655 !! end
13656
13657 !! test
13658 BUG 648: Frameless image caption with a piped interwiki link
13659 !! wikitext
13660 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13661 !! html/php
13662 <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>
13663 </p>
13664 !! html/parsoid
13665 <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>
13666 !! end
13667
13668 !! test
13669 T107474: Frameless image caption with <nowiki>
13670 !! wikitext
13671 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13672 !! html/parsoid
13673 <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>
13674 !! end
13675
13676 !! test
13677 Escape HTML special chars in image alt text
13678 !! wikitext
13679 [[File:Foobar.jpg|& < > "]]
13680 !! html/php
13681 <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>
13682 </p>
13683 !! html/parsoid
13684 <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>
13685 !! end
13686
13687 !! test
13688 BUG 499: Alt text should have &#1234;, not &amp;1234;
13689 !! wikitext
13690 [[File:Foobar.jpg|&#9792;]]
13691 !! html/php
13692 <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>
13693 </p>
13694 !! html/parsoid
13695 <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>
13696 !! end
13697
13698 !! test
13699 Broken image caption with link
13700 !! options
13701 parsoid=wt2html,wt2wt,html2html
13702 !! wikitext
13703 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13704 !! html/php
13705 <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.
13706 </p>
13707 !! html/parsoid
13708 <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>
13709 !! end
13710
13711 !! test
13712 Image caption containing another image
13713 !! wikitext
13714 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13715 !! html/php
13716 <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>
13717
13718 !! html/parsoid
13719 <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>
13720 !! end
13721
13722 !! test
13723 Image: caption containing a newline
13724 !! wikitext
13725 [[File:Foobar.jpg|This
13726 *is some text]]
13727 !! html/php
13728 <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>
13729 </p>
13730 !! html/parsoid
13731 <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>
13732 !!end
13733
13734 !!test
13735 Image: caption containing leading space
13736 (The leading space should not trigger nowiki escaping in wt2wt mode)
13737 !! wikitext
13738 [[File:Foobar.jpg|thumb| bar]]
13739 !! html/php
13740 <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>
13741
13742 !! html/parsoid
13743 <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>
13744 !!end
13745
13746 !! test
13747 Image: caption containing a table
13748 !! options
13749 parsoid=wt2html,wt2wt,html2html
13750 !! wikitext
13751 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13752 {|
13753 ! Foo !! Bar
13754 |-
13755 | Foo1 || Bar1
13756 |}
13757 and some more text.]]
13758 !! html/php
13759 <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>
13760
13761 !! html/parsoid
13762 <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
13763 <table>
13764 <tbody>
13765 <tr><th>Foo </th><th>Bar</th></tr>
13766 <tr>
13767 <td>Foo1 </td>
13768 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13769 !! end
13770
13771 !! test
13772 Bug 3090: External links other than http: in image captions
13773 !! wikitext
13774 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13775 !! html/php
13776 <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>
13777
13778 !! html/parsoid
13779 <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>
13780 !! end
13781
13782 !! test
13783 Custom class
13784 !! options
13785 parsoid=wt2html,wt2wt,html2html
13786 !! wikitext
13787 [[Image:foobar.jpg|a|class=b]]
13788 !! html/php
13789 <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>
13790 </p>
13791 !! html/parsoid
13792 <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>
13793 !! end
13794
13795 !! test
13796 Localized image handling (1).
13797 !! options
13798 parsoid=wt2html,wt2wt,html2html
13799 language=es
13800 !! wikitext
13801 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13802 !! html/php
13803 <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>
13804
13805 !! html/parsoid
13806 <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>
13807 !! end
13808
13809 !! test
13810 Localized image handling (2).
13811 !! options
13812 thumbsize=220
13813 parsoid=wt2html,wt2wt,html2html
13814 language=es
13815 !! wikitext
13816 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13817 !! html/php
13818 <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>
13819
13820 !! html/parsoid
13821 <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>
13822 !! end
13823
13824 !! test
13825 "border", "frameless" and "class" attributes on an image.
13826 !! options
13827 thumbsize=220
13828 parsoid=wt2html,wt2wt,html2html
13829 !! wikitext
13830 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13831 !! html/php
13832 <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>
13833 </p>
13834 !! html/parsoid
13835 <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>
13836 !! end
13837
13838 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13839 !! test
13840 Invalid image attributes (bug 62500)
13841 !! options
13842 thumbsize=220
13843 parsoid=wt2html,wt2wt,html2html
13844 !! wikitext
13845 [[File:Foobar.jpg|thumb|float|left|caption]]
13846
13847 [[File:Foobar.jpg|thumb|righ|caption]]
13848
13849 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13850 !! html/php
13851 <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>
13852 <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>
13853 <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>
13854
13855 !! html/parsoid
13856 <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>
13857 <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>
13858 <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>
13859 !! end
13860
13861 !! article
13862 File:Barfoo.jpg
13863 !! text
13864 #REDIRECT [[File:Barfoo.jpg]]
13865 !! endarticle
13866
13867 # FIXME: Parsoid should run this test -- but we'd need to teach the
13868 # mockAPI about the redirected Barfoo.jpg image.
13869 !! test
13870 Redirected image
13871 !! wikitext
13872 [[Image:Barfoo.jpg]]
13873 !! html/php
13874 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13875 </p>
13876 !! end
13877
13878 !! test
13879 Missing image with uploads disabled
13880 !! options
13881 wgEnableUploads=0
13882 !! wikitext
13883 [[File:Foobaz.jpg]]
13884 !! html/php
13885 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13886 </p>
13887 !! html/parsoid
13888 <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>
13889 !! end
13890
13891 # Parsoid-specific testing for images
13892 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13893 # Currently imperfect due to a flaw in the Parsoid testrunner
13894 # Work in progress
13895 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13896 # image tests.
13897
13898 !! test
13899 Parsoid-specific image handling - simple image with size and middle alignment
13900 !! wikitext
13901 [[File:Foobar.jpg|middle|50px]]
13902 !! html/parsoid
13903 <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>
13904 !! end
13905
13906 !! test
13907 Parsoid-specific image handling - simple image with size, middle alignment,
13908 non-standard namespace alias
13909 !! options
13910 parsoid=wt2wt,wt2html,html2html
13911 !! wikitext
13912 [[Image:Foobar.jpg|middle|50px]]
13913 !! html/parsoid
13914 <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>
13915 !! end
13916
13917 !! test
13918 Parsoid-specific image handling - simple image with size and middle alignment
13919 (existing content)
13920 !! wikitext
13921 [[File:Foobar.jpg|50px|middle]]
13922 !! html/parsoid
13923 <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>
13924 !! end
13925
13926 !! test
13927 Parsoid-specific image handling - simple image with size and middle alignment
13928 and non-standard namespace name
13929 !! options
13930 parsoid=wt2html,wt2wt,html2html
13931 !! wikitext
13932 [[Image:Foobar.jpg|50px|middle]]
13933 !! html/parsoid
13934 <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>
13935 !! end
13936
13937 !! test
13938 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13939 !! wikitext
13940 [[File:Foobar.jpg|500x10px|baseline|caption]]
13941 !! html/parsoid
13942 <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>
13943 !! end
13944
13945 !! test
13946 Parsoid-specific image handling - simple image with border and size spec
13947 !! wikitext
13948 [[File:Foobar.jpg|50px|border|caption]]
13949 !! html/parsoid
13950 <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>
13951 !! end
13952
13953 !! test
13954 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13955 !! wikitext
13956 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13957 !! html/parsoid
13958 <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>
13959 !! end
13960
13961 !! test
13962 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13963 (existing content)
13964 !! wikitext
13965 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13966 !! html/parsoid
13967 <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>
13968 !! end
13969
13970 !! test
13971 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13972 !! wikitext
13973 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13974 !! html/parsoid
13975 <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>
13976 !! end
13977
13978 !! test
13979 Parsoid-specific image handling - thumbnail with specific size, halign,
13980 valign, and caption (existing content)
13981 !! wikitext
13982 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13983 !! html/parsoid
13984 <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>
13985 !! end
13986
13987 !! test
13988 Parsoid-specific image handling - framed image with specific size and caption
13989 (size is ignored)
13990 !! options
13991 parsoid=wt2html,wt2wt,html2html
13992 !! wikitext
13993 [[File:Foobar.jpg|frame|500x50px|caption]]
13994 !! html/parsoid
13995 <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>
13996 !! end
13997
13998 !! test
13999 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14000 (size is ignored)
14001 !! options
14002 parsoid=wt2html,wt2wt,html2html
14003 !! wikitext
14004 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14005 !! html/parsoid
14006 <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>
14007 !! end
14008
14009 !! test
14010 Parsoid-specific image handling - frameless image with specific size, border, and caption
14011 !! wikitext
14012 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14013 !! html/parsoid
14014 <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>
14015 !! end
14016
14017 !! test
14018 Parsoid-specific image handling - simple image with a formatted caption
14019 !! wikitext
14020 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14021 !! html/parsoid
14022 <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>
14023 !! end
14024
14025 !! test
14026 Parsoid-specific image handling - caption with a template in it
14027 !! wikitext
14028 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14029 !! html/parsoid
14030 <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>
14031 !! end
14032
14033 !! test
14034 Parsoid-specific image handling - caption with unbalanced tags in it
14035 !! options
14036 parsoid=wt2html,wt2wt,html2html
14037 !! wikitext
14038 foo
14039 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14040 bar
14041 !! html/parsoid
14042 <p>foo</p>
14043 <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>
14044 <p>bar</p>
14045 !! end
14046
14047 !! test
14048 Parsoid-specific image handling - empty caption (1)
14049 !! options
14050 parsoid=wt2html,wt2wt
14051 !! wikitext
14052 [[File:Foobar.jpg|thumb|]]
14053 !! html/parsoid
14054 <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>
14055 !! end
14056
14057 # empty captions don't get serialized unless we're in the "round trip" case
14058 !! test
14059 Parsoid-specific image handling - empty caption (2)
14060 !! options
14061 parsoid=html2wt
14062 !! html/parsoid
14063 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14064 <a href="./File:Foobar.jpg">
14065 <img resource="./File:Foobar.jpg"
14066 src="//example.com/images/3/3a/Foobar.jpg"
14067 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14068 height="25" width="220"/>
14069 </a>
14070 <figcaption></figcaption>
14071 </figure>
14072 !! wikitext
14073 [[File:Foobar.jpg|thumb]]
14074 !! end
14075
14076 !! test
14077 Parsoid-specific image handling - whitespace caption
14078 !! wikitext
14079 [[File:Foobar.jpg|thumb| ]]
14080 !! html/parsoid
14081 <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>
14082 !! end
14083
14084 !! test
14085 Parsoid-specific image handling - lang option
14086 !! wikitext
14087 foo
14088 [[File:Foobar.svg|lang=de|caption]]
14089 bar
14090 !! html/parsoid
14091 <p>foo
14092 <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>
14093 bar</p>
14094 !! end
14095
14096 ## Edge case bugs in Parsoid from T93580
14097 !! test
14098 T93580: 1. Templated <ref> inside block images
14099 !! wikitext
14100 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14101
14102 <references />
14103 !! html/parsoid
14104 <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>
14105
14106 <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>
14107 !! end
14108
14109 !! test
14110 T93580: 2. <ref> inside inline images
14111 !! wikitext
14112 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14113
14114 <references />
14115 !! html/parsoid
14116 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &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>
14117
14118 <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>
14119 !! end
14120
14121 !! test
14122 T93580: 3. Templated <ref> inside inline images
14123 !! wikitext
14124 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14125
14126 <references />
14127 !! html/parsoid
14128 <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>
14129
14130 <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>
14131 !! end
14132
14133 ###
14134 ### Subpages
14135 ###
14136 !! article
14137 Subpage test/subpage
14138 !! text
14139 foo
14140 !! endarticle
14141
14142 !! test
14143 Subpage link
14144 !! options
14145 subpage title=[[Subpage test]]
14146 !! wikitext
14147 [[/subpage]]
14148 !! html
14149 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14150 </p>
14151 !! end
14152
14153 !! test
14154 Subpage noslash link
14155 !! options
14156 subpage title=[[Subpage test]]
14157 !! wikitext
14158 [[/subpage/]]
14159 !! html
14160 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14161 </p>
14162 !! end
14163
14164 !! article
14165 Subpage test/1/2/subpage
14166 !! text
14167 blah
14168 !! endarticle
14169
14170 !! test
14171 Relative subpage noslash link
14172 !! options
14173 parsoid=wt2wt,wt2html,html2html
14174 subpage title=[[Subpage test/1/2/3/4]]
14175 !! wikitext
14176 [[../../subpage/]]
14177
14178 [[../../subpage]]
14179 !! html/php
14180 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14181 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14182 </p>
14183 !! html/parsoid
14184 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14185 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14186 !! end
14187
14188 !! test
14189 Parsoid: dot-slash prefixed wikilinks
14190 !! wikitext
14191 [[./foo]]
14192
14193 [[././bar]]
14194
14195 [[././baz/]]
14196 !! html/php
14197 <p>[[./foo]]
14198 </p><p>[[././bar]]
14199 </p><p>[[././baz/]]
14200 </p>
14201 !! html/parsoid
14202 <p>[[./foo]]
14203 </p><p>[[././bar]]
14204 </p><p>[[././baz/]]
14205 </p>
14206 !! end
14207
14208 !! test
14209 Render invalid page names as plain text (bug 51090)
14210 !! wikitext
14211 [[./../foo|bar]]
14212 [[foo�|bar]]
14213 [[foo/.|bar]]
14214 [[foo/..|bar]]
14215 [[foo~~~bar]]
14216 [[foo>bar]]
14217 [[foo[bar]]
14218 [[.]]
14219 [[..]]
14220 [[foo././bar]]
14221
14222 [[{{echo|./../foo}}|bar]]
14223 [[{{echo|foo/.}}|bar]]
14224 [[{{echo|foo/..}}|bar]]
14225 [[{{echo|foo~~~~bar}}]]
14226 [[{{echo|foo>bar}}]]
14227 [[{{echo|foo././bar}}]]
14228 [[{{echo|foo{bar}}]]
14229 [[{{echo|foo}bar}}]]
14230 [[{{echo|foo[bar}}]]
14231 [[{{echo|foo]bar}}]]
14232 [[{{echo|foo<bar}}]]
14233 !!html/php
14234 <p>[[./../foo|bar]]
14235 [[foo�|bar]]
14236 [[foo/.|bar]]
14237 [[foo/..|bar]]
14238 [[foo~~~bar]]
14239 [[foo&gt;bar]]
14240 [[foo[bar]]
14241 [[.]]
14242 [[..]]
14243 [[foo././bar]]
14244 </p><p>[[./../foo|bar]]
14245 [[foo/.|bar]]
14246 [[foo/..|bar]]
14247 [[foo~~~~bar]]
14248 [[foo&gt;bar]]
14249 [[foo././bar]]
14250 [[foo{bar]]
14251 [[foo}bar]]
14252 [[foo[bar]]
14253 [[foo]bar]]
14254 [[foo&lt;bar]]
14255 </p>
14256 !!html/parsoid
14257 <p>[[./../foo|bar]]
14258 [[foo�|bar]]
14259 [[foo/.|bar]]
14260 [[foo/..|bar]]
14261 [[foo~~~bar]]
14262 [[foo>bar]]
14263 [[foo[bar]]
14264 [[.]]
14265 [[..]]
14266 [[foo././bar]]</p>
14267
14268 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14269 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14270 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14271 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14272 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14273 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14274 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14275 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14276 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14277 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14278 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
14279 !!end
14280
14281 !! test
14282 Disabled subpages
14283 !! wikitext
14284 [[/subpage]]
14285 !! html
14286 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14287 </p>
14288 !! end
14289
14290 !! test
14291 BUG 561: {{/Subpage}}
14292 !! options
14293 subpage title=[[Page]]
14294 !! wikitext
14295 {{/Subpage}}
14296 !! html
14297 <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>
14298 </p>
14299 !! end
14300
14301 ###
14302 ### Categories
14303 ###
14304 !! article
14305 Category:MediaWiki User's Guide
14306 !! text
14307 blah
14308 !! endarticle
14309
14310 !! test
14311 Link to category
14312 !! wikitext
14313 [[:Category:MediaWiki User's Guide]]
14314 !! html
14315 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14316 </p>
14317 !! end
14318
14319 !! test
14320 Simple category
14321 !! options
14322 cat
14323 !! wikitext
14324 [[Category:MediaWiki User's Guide]]
14325 !! html
14326 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14327 !! end
14328
14329 !! test
14330 PAGESINCATEGORY invalid title fatal (r33546 fix)
14331 !! wikitext
14332 {{PAGESINCATEGORY:<bogus>}}
14333 !! html
14334 <p>0
14335 </p>
14336 !! end
14337
14338 !! test
14339 Category with different sort key
14340 !! options
14341 cat
14342 !! wikitext
14343 [[Category:MediaWiki User's Guide|Foo]]
14344 !! html
14345 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14346 !! end
14347
14348 !! test
14349 Category with identical sort key
14350 !! options
14351 cat
14352 !! wikitext
14353 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14354 !! html
14355 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14356 !! end
14357
14358 !! test
14359 Category with empty sort key
14360 !! options
14361 cat
14362 pst
14363 !! wikitext
14364 [[Category:MediaWiki User's Guide|]]
14365 !! html/php
14366 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14367 !! end
14368
14369 !! test
14370 Category with empty sort key and parentheses
14371 !! options
14372 cat
14373 pst
14374 !! wikitext
14375 [[Category:Foo (bar)|]]
14376 !! html/php
14377 [[Category:Foo (bar)|Foo]]
14378 !! end
14379
14380 ## We used to, but no longer wt2wt this test since the default serializer
14381 ## will normalize all categories to serialize on their own line.
14382 ## This wikitext usage is going to be fairly uncommon in production and
14383 ## selser will take care of preserving formatting in those scenarios.
14384 !! test
14385 Category with link tail
14386 !! options
14387 cat
14388 pst
14389 parsoid=wt2html
14390 !! wikitext
14391 123[[Category:Foo]]456
14392 !! html/php
14393 123[[Category:Foo]]456
14394 !! html/parsoid
14395 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14396 !! end
14397
14398 !! test
14399 Category with template
14400 !! options
14401 cat
14402 pst
14403 !! wikitext
14404 [[Category:{{echo|Foo}}]]
14405 !! html/php
14406 [[Category:{{echo|Foo}}]]
14407 !! end
14408
14409 !! test
14410 Category with template in sort key
14411 !! options
14412 cat
14413 pst
14414 !! wikitext
14415 [[Category:Foo|{{echo|Bar}}]]
14416 !! html/php
14417 [[Category:Foo|{{echo|Bar}}]]
14418 !! end
14419
14420 !! test
14421 Category with template in sort key and title
14422 !! options
14423 cat
14424 pst
14425 !! wikitext
14426 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14427 !! html/php
14428 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14429 !! end
14430
14431 ## We used to, but no longer wt2wt this test since the default serializer
14432 ## will normalize all categories to serialize on their own line.
14433 ## This wikitext usage is going to be fairly uncommon in production and
14434 ## selser will take care of preserving formatting in those scenarios.
14435 !! test
14436 Category / paragraph interactions
14437 !! options
14438 parsoid=wt2html
14439 !! wikitext
14440 Foo [[Category:Baz]] Bar
14441
14442 Foo [[Category:Baz]]
14443 Bar
14444
14445 Foo
14446 [[Category:Baz]]
14447 Bar
14448
14449 Foo
14450 [[Category:Baz]] Bar
14451
14452 Foo
14453 [[Category:Baz]]
14454 [[Category:Baz]]
14455 [[Category:Baz]]
14456 Bar
14457
14458 [[Category:Baz]]
14459 [[Category:Baz]]
14460 [[Category:Baz]]
14461
14462 [[Category:Baz]]
14463 {{echo|[[Category:Baz]]}}
14464 [[Category:Baz]]
14465 !! html/php
14466 <p>Foo Bar
14467 </p><p>Foo
14468 Bar
14469 </p><p>Foo
14470 Bar
14471 </p><p>Foo Bar
14472 </p><p>Foo
14473 Bar
14474 </p>
14475 !! html/parsoid
14476 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14477 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14478 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14479 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14480 <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>
14481 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14482 !! end
14483
14484 ## We used to, but no longer wt2wt this test since the default serializer
14485 ## will normalize all categories to serialize on their own line.
14486 ## This wikitext usage is going to be fairly uncommon in production and
14487 ## selser will take care of preserving formatting in those scenarios.
14488 ##
14489 ## The whitespace on the empty line is part of the test. Please do not delete
14490 !! test
14491 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14492 !! options
14493 parsoid=wt2html
14494 !! wikitext
14495 This
14496
14497 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14498
14499 {{echo|[[Category:Foo]] and so should this!}}
14500 !! html/php
14501 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14502 </p>
14503 !! html/parsoid
14504 <p>This
14505
14506 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14507
14508 <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>
14509 !! end
14510
14511 ## Parsoid will not try to wt2wt this while preserving newlines because
14512 ## it suppresses excess newlines within list items -- and we don't want to
14513 ## introduce a special case just for categories, which is, in reality somewhat
14514 ## odd behavior -- categories are unlikely to be used in list items like this
14515 ## in top-level pages and are only likely to show up in template-generated
14516 ## list items where this RT-ing is a non-issue.
14517 ##
14518 ## The whitespace on the empty line is part of the test. Please do not delete
14519 !! test
14520 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14521 !! options
14522 parsoid=wt2html
14523 !! wikitext
14524 * This
14525
14526 [[Category:Foo]] and this should be part of the same list item
14527 * So should this
14528
14529 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14530 !! html
14531 <ul><li>This and this should be part of the same list item</li>
14532 <li>So should this and this should be part of the same list item</li></ul>
14533 !! html/parsoid
14534 <ul>
14535 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14536 <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>
14537 </ul>
14538 !! end
14539
14540 ## Newlines and categories that follow the last item of a list
14541 ## are treated differently because this (list followed by categories)
14542 ## is an extremely common pattern on wikis.
14543 !! test
14544 3. Categories and newlines: newline suppression for last list item should RT properly
14545 !! wikitext
14546 * a
14547 * b
14548
14549 [[Category:Foo]]
14550
14551 [[Category:Bar]]
14552 [[Category:Baz]]
14553 !! html/parsoid
14554 <ul><li> a</li>
14555 <li> b</li></ul>
14556
14557 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14558
14559 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14560 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14561 !! end
14562
14563 !! test
14564 4. Categories and newlines: newline suppression for last list item should RT properly
14565 !! wikitext
14566 * a
14567 **** b
14568
14569 [[Category:Foo]]
14570 !! html/parsoid
14571 <ul><li> a
14572 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14573
14574 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14575 !! end
14576
14577 ## only wt2html for this to make sure the algo only applies to the rightmost path
14578 !! test
14579 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14580 !! options
14581 parsoid=wt2html
14582 !! wikitext
14583 * a
14584 ** b
14585 [[Category:Foo]]
14586 * c
14587 ** d
14588 [[Category:Foo]]
14589 !! html/parsoid
14590 <ul><li> a
14591 <ul><li> b
14592 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14593 <li> c
14594 <ul><li> d</li></ul></li></ul>
14595 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14596 !! end
14597
14598 ## We used to, but no longer wt2wt this test since the default serializer
14599 ## will normalize all categories to serialize on their own line.
14600 ## This wikitext usage is going to be fairly uncommon in production and
14601 ## selser will take care of preserving formatting in those scenarios.
14602 !! test
14603 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14604 !! options
14605 parsoid=wt2html
14606 !! wikitext
14607 * a [[Category:Foo]]
14608 !! html/parsoid
14609 <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>
14610 !! end
14611
14612 # This test also demonstrates because of newline+category tunneling
14613 # through the list hander, template wrapping doesn't expand to the
14614 # containing list when the list item swallows the category.
14615 !! test
14616 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14617 !! wikitext
14618 * {{echo|a
14619 [[Category:Foo]]}}
14620 !! html/parsoid
14621 <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
14622 </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>
14623 !! end
14624
14625 !! test
14626 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14627 !! wikitext
14628 * a
14629
14630 {{echo|[[Category:Foo]]
14631 [[Category:Bar]]}}
14632 [[Category:Baz]]
14633 !! html/parsoid
14634 <ul><li> a</li></ul>
14635
14636 <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">
14637 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14638 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14639 !! end
14640
14641 !! test
14642 Parsoid: Serialize link to category page with colon escape
14643 !! options
14644 parsoid
14645 !! wikitext
14646
14647 [[:Category:Foo]]
14648 [[:Category:Foo|Bar]]
14649 !! html
14650 <p>
14651 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14652 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14653 </p>
14654 !! end
14655
14656 # We used to, but no longer wt2wt this test since the default serializer
14657 # will normalize all categories to serialize on their own line.
14658 # This wikitext usage is going to be fairly uncommon in production and
14659 # selser will take care of preventing whitespace insertion if this
14660 # occurs in an article.
14661 #
14662 # html2html disabled for the same reason (whitespace insertion between
14663 # x and y).
14664 #
14665 # html2wt disabled because it localizes the "Category" namespace.
14666 !! test
14667 Link prefix/suffixes aren't applied to category links
14668 !! options
14669 parsoid=wt2html
14670 language=is
14671 !! wikitext
14672 x[[Category:Foo]]y
14673 !! html/php
14674 <p>xy
14675 </p>
14676 !! html/parsoid
14677 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14678 !! end
14679
14680 !! test
14681 Parsoid: Serialize link to file page with colon escape
14682 !! options
14683 parsoid
14684 !! wikitext
14685
14686 [[:File:Foo.png]]
14687 [[:File:Foo.png|Bar]]
14688 !! html
14689 <p>
14690 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14691 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14692 </p>
14693 !! end
14694
14695 !! test
14696 Parsoid: Serialize a genuine category link without colon escape
14697 !! options
14698 parsoid
14699 !! wikitext
14700 [[Category:Foo]]
14701 [[Category:Foo|Bar]]
14702 !! html
14703 <link rel="mw:PageProp/Category" href="./Category:Foo">
14704 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14705 !! end
14706
14707 !! test
14708 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14709 !! options
14710 parsoid=html2wt
14711 !! html/parsoid
14712 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14713 !! wikitext
14714 [[Category:Toxine bactérienne]]
14715 !! end
14716
14717 !! test
14718 Parsoid: Defaultsort
14719 !! wikitext
14720 {{DEFAULTSORT:Foo}}
14721 !! html/parsoid
14722 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14723 !! end
14724
14725 !! test
14726 Parsoid: Defaultsort (template-generated)
14727 !! wikitext
14728 {{{{echo|DEFAULTSORT}}:Foo}}
14729 !! html/parsoid
14730 <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}}]}'/>
14731 !! end
14732
14733 ###
14734 ### Inter-language links
14735 ###
14736 !! test
14737 Interlanguage links
14738 !! options
14739 ill
14740 !! wikitext
14741 [[es:Alimento]]
14742 [[fr:Nourriture]]
14743 [[zh:食品]]
14744 !! html/php
14745 es:Alimento fr:Nourriture zh:食品
14746 !! html/parsoid
14747 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14748 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14749 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14750 !! end
14751
14752 !! test
14753 Duplicate interlanguage links (bug 24502)
14754 !! options
14755 ill
14756 !! wikitext
14757 [[es:1]]
14758 [[es:2]]
14759 [[fr:1]]
14760 [[fr:2]]
14761 !! html/php
14762 es:1 fr:1
14763 !! html/parsoid
14764 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14765 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14766 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14767 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14768 !! end
14769
14770 ###
14771 ### Sections
14772 ###
14773 !! test
14774 Basic section headings
14775 !! wikitext
14776 == Headline 1 ==
14777 Some text
14778
14779 ==Headline 2==
14780 More
14781 ===Smaller headline===
14782 Blah blah
14783 !! html
14784 <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>
14785 <p>Some text
14786 </p>
14787 <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>
14788 <p>More
14789 </p>
14790 <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>
14791 <p>Blah blah
14792 </p>
14793 !! end
14794
14795 !! test
14796 Section headings with TOC
14797 !! wikitext
14798 == Headline 1 ==
14799 === Subheadline 1 ===
14800 ===== Skipping a level =====
14801 ====== Skipping a level ======
14802
14803 == Headline 2 ==
14804 Some text
14805 ===Another headline===
14806 !! html
14807 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14808 <ul>
14809 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14810 <ul>
14811 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14812 <ul>
14813 <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>
14814 <ul>
14815 <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>
14816 </ul>
14817 </li>
14818 </ul>
14819 </li>
14820 </ul>
14821 </li>
14822 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14823 <ul>
14824 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14825 </ul>
14826 </li>
14827 </ul>
14828 </div>
14829
14830 <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>
14831 <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>
14832 <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>
14833 <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>
14834 <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>
14835 <p>Some text
14836 </p>
14837 <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>
14838
14839 !! end
14840
14841 !! test
14842 TOC anchors don't collide
14843 !! wikitext
14844 __FORCETOC__
14845 == Headline 2 ==
14846 == Headline ==
14847 == Headline 2 ==
14848 == Headline ==
14849 !! html/php
14850 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14851 <ul>
14852 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14853 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14854 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14855 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14856 </ul>
14857 </div>
14858
14859 <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>
14860 <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>
14861 <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>
14862 <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>
14863
14864 !! end
14865
14866 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14867 !! test
14868 Handling of sections up to level 6 and beyond
14869 !! wikitext
14870 = Level 1 Heading=
14871 == Level 2 Heading==
14872 === Level 3 Heading===
14873 ==== Level 4 Heading====
14874 ===== Level 5 Heading=====
14875 ====== Level 6 Heading======
14876 ======= Level 7 Heading=======
14877 ======== Level 8 Heading========
14878 ========= Level 9 Heading=========
14879 ========== Level 10 Heading==========
14880 !! html
14881 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14882 <ul>
14883 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14884 <ul>
14885 <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>
14886 <ul>
14887 <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>
14888 <ul>
14889 <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>
14890 <ul>
14891 <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>
14892 <ul>
14893 <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>
14894 <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>
14895 <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>
14896 <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>
14897 <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>
14898 </ul>
14899 </li>
14900 </ul>
14901 </li>
14902 </ul>
14903 </li>
14904 </ul>
14905 </li>
14906 </ul>
14907 </li>
14908 </ul>
14909 </div>
14910
14911 <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>
14912 <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>
14913 <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>
14914 <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>
14915 <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>
14916 <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>
14917 <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>
14918 <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>
14919 <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>
14920 <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>
14921
14922 !! end
14923
14924 !! test
14925 TOC regression (T11764)
14926 !! wikitext
14927 == title 1 ==
14928 === title 1.1 ===
14929 ==== title 1.1.1 ====
14930 === title 1.2 ===
14931 == title 2 ==
14932 === title 2.1 ===
14933 !! html
14934 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14935 <ul>
14936 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14937 <ul>
14938 <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>
14939 <ul>
14940 <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>
14941 </ul>
14942 </li>
14943 <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>
14944 </ul>
14945 </li>
14946 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14947 <ul>
14948 <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>
14949 </ul>
14950 </li>
14951 </ul>
14952 </div>
14953
14954 <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>
14955 <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>
14956 <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>
14957 <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>
14958 <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>
14959 <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>
14960
14961 !! end
14962
14963 !! test
14964 TOC for heading containing <span id="..."></span> (T96153)
14965 !! wikitext
14966 __FORCETOC__
14967 ==<span id="old-anchor"></span>New title==
14968 !! html/php
14969 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14970 <ul>
14971 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14972 </ul>
14973 </div>
14974
14975 <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>
14976
14977 !! end
14978
14979 !! test
14980 TOC with wgMaxTocLevel=3 (bug 6204)
14981 !! options
14982 wgMaxTocLevel=3
14983 !! wikitext
14984 == title 1 ==
14985 === title 1.1 ===
14986 ==== title 1.1.1 ====
14987 === title 1.2 ===
14988 == title 2 ==
14989 === title 2.1 ===
14990 !! html
14991 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14992 <ul>
14993 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14994 <ul>
14995 <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>
14996 <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>
14997 </ul>
14998 </li>
14999 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15000 <ul>
15001 <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>
15002 </ul>
15003 </li>
15004 </ul>
15005 </div>
15006
15007 <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>
15008 <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>
15009 <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>
15010 <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>
15011 <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>
15012 <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>
15013
15014 !! end
15015
15016 !! test
15017 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15018 !! options
15019 wgMaxTocLevel=3
15020 !! wikitext
15021 ==Section 1==
15022 ===Section 1.1===
15023 ====Section 1.1.1====
15024 ====Section 1.1.1.1====
15025 ==Section 2==
15026 !! html
15027 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15028 <ul>
15029 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15030 <ul>
15031 <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>
15032 </ul>
15033 </li>
15034 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15035 </ul>
15036 </div>
15037
15038 <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>
15039 <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>
15040 <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>
15041 <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>
15042 <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>
15043
15044 !! end
15045
15046
15047 !! test
15048 Resolving duplicate section names
15049 !! wikitext
15050 == Foo bar ==
15051 == Foo bar ==
15052 !! html
15053 <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>
15054 <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>
15055
15056 !! end
15057
15058 !! test
15059 Resolving duplicate section names with differing case (bug 10721)
15060 !! wikitext
15061 == Foo bar ==
15062 == Foo Bar ==
15063 !! html
15064 <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>
15065 <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>
15066
15067 !! end
15068
15069 !! article
15070 Template:sections
15071 !! text
15072 ===Section 1===
15073 ==Section 2==
15074 !! endarticle
15075
15076 !! test
15077 Template with sections, __NOTOC__
15078 !! wikitext
15079 __NOTOC__
15080 ==Section 0==
15081 {{sections}}
15082 ==Section 4==
15083 !! html
15084 <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>
15085 <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>
15086 <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>
15087 <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>
15088
15089 !! end
15090
15091 !! test
15092 __NOEDITSECTION__ keyword
15093 !! wikitext
15094 __NOEDITSECTION__
15095 ==Section 1==
15096 ==Section 2==
15097 !! html
15098 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15099 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15100
15101 !! end
15102
15103 !! test
15104 Link inside a section heading
15105 !! wikitext
15106 ==Section with a [[Main Page|link]] in it==
15107 !! html
15108 <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>
15109
15110 !! end
15111
15112 !! test
15113 TOC regression (T14077)
15114 !! wikitext
15115 __TOC__
15116 == title 1 ==
15117 === title 1.1 ===
15118 == title 2 ==
15119 !! html
15120 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15121 <ul>
15122 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15123 <ul>
15124 <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>
15125 </ul>
15126 </li>
15127 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15128 </ul>
15129 </div>
15130
15131 <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>
15132 <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>
15133 <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>
15134
15135 !! end
15136
15137 !! test
15138 BUG 1219 URL next to image (good)
15139 !! wikitext
15140 http://example.com [[File:Foobar.jpg]]
15141 !! html/php
15142 <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>
15143 </p>
15144 !! html/parsoid
15145 <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>
15146 !!end
15147
15148 !! test
15149 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15150 !! wikitext
15151 ===
15152 The line above must have a trailing space!
15153 === <!--
15154 --> <!-- -->
15155 But just in case it doesn't...
15156 !! html
15157 <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>
15158 <p>The line above must have a trailing space!
15159 </p>
15160 <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>
15161 <p>But just in case it doesn't...
15162 </p>
15163 !! end
15164
15165 !! test
15166 Header with special characters (bug 25462)
15167 !! wikitext
15168 The tooltips shall not show entities to the user (ie. be double escaped)
15169
15170 == text > text ==
15171 section 1
15172
15173 == text < text ==
15174 section 2
15175
15176 == text & text ==
15177 section 3
15178
15179 == text ' text ==
15180 section 4
15181
15182 == text " text ==
15183 section 5
15184 !! html
15185 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15186 </p>
15187 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15188 <ul>
15189 <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>
15190 <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>
15191 <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>
15192 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15193 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15194 </ul>
15195 </div>
15196
15197 <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>
15198 <p>section 1
15199 </p>
15200 <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>
15201 <p>section 2
15202 </p>
15203 <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>
15204 <p>section 3
15205 </p>
15206 <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>
15207 <p>section 4
15208 </p>
15209 <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>
15210 <p>section 5
15211 </p>
15212 !! end
15213
15214 !! test
15215 Header with space, plus and underscore as entity
15216 !! wikitext
15217 Id should not contain + for spaces
15218
15219 == Space between Text ==
15220 section 1
15221
15222 == Space-Entity&#32;between&#32;Text ==
15223 section 2
15224
15225 == Plus+between+Text ==
15226 section 3
15227
15228 == Plus-Entity&#43;between&#43;Text ==
15229 section 4
15230
15231 == Underscore_between_Text ==
15232 section 5
15233
15234 == Underscore-Entity&#95;between&#95;Text ==
15235 section 6
15236
15237 [[#Space between Text]]
15238 [[#Space-Entity&#32;between&#32;Text]]
15239 [[#Plus+between+Text]]
15240 [[#Plus-Entity&#43;between&#43;Text]]
15241 [[#Underscore_between_Text]]
15242 [[#Underscore-Entity&#95;between&#95;Text]]
15243 !! html
15244 <p>Id should not contain + for spaces
15245 </p>
15246 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15247 <ul>
15248 <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>
15249 <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>
15250 <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>
15251 <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>
15252 <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>
15253 <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>
15254 </ul>
15255 </div>
15256
15257 <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>
15258 <p>section 1
15259 </p>
15260 <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>
15261 <p>section 2
15262 </p>
15263 <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>
15264 <p>section 3
15265 </p>
15266 <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>
15267 <p>section 4
15268 </p>
15269 <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>
15270 <p>section 5
15271 </p>
15272 <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>
15273 <p>section 6
15274 </p><p><a href="#Space_between_Text">#Space between Text</a>
15275 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15276 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15277 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15278 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15279 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15280 </p>
15281 !! end
15282
15283 !! test
15284 Headers with excess '=' characters
15285 (Are similar tests necessary beyond the 1st level?)
15286 !! wikitext
15287 =foo==
15288 ==foo=
15289 =''italic'' heading==
15290 ==''italic'' heading=
15291 !! html
15292 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15293 <ul>
15294 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15295 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15296 <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>
15297 <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>
15298 </ul>
15299 </div>
15300
15301 <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>
15302 <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>
15303 <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>
15304 <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>
15305
15306 !! end
15307
15308 !! test
15309 HTML headers vs TOC (bug 23393)
15310 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15311 !! wikitext
15312 <h1>Header 1</h1>
15313 == Header 1.1 ==
15314 == Header 1.2 ==
15315
15316 <h1>Header 2
15317 </h1>
15318 == Header 2.1 ==
15319 == Header 2.2 ==
15320 __NOEDITSECTION__
15321 !! html
15322 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15323 <ul>
15324 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15325 <ul>
15326 <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>
15327 <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>
15328 </ul>
15329 </li>
15330 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15331 <ul>
15332 <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>
15333 <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>
15334 </ul>
15335 </li>
15336 </ul>
15337 </div>
15338
15339 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15340 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15341 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15342 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15343 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15344 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15345
15346 !! end
15347
15348 !! test
15349 Single-line or multiline-comments can follow headings
15350 !! options
15351 parsoid=wt2html,wt2wt
15352 !! wikitext
15353 ==foo==<!---->
15354 ==bar==<!--c1-->
15355 ==baz==<!--
15356 c2
15357 c3-->
15358 !! html
15359 <h2><span class="mw-headline" id="foo">foo</span></h2>
15360 <h2><span class="mw-headline" id="bar">bar</span></h2>
15361 <h2><span class="mw-headline" id="baz">baz</span></h2>
15362
15363 !! end
15364
15365 !! test
15366 BUG 1219 URL next to image (broken)
15367 !! wikitext
15368 http://example.com[[File:Foobar.jpg]]
15369 !! html/php
15370 <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>
15371 </p>
15372 !! html/parsoid
15373 <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>
15374 !!end
15375
15376 !! test
15377 Bug 1186 news: in the middle of text
15378 !! wikitext
15379 http://en.wikinews.org/wiki/Wikinews:Workplace
15380 !! html
15381 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15382 </p>
15383 !!end
15384
15385
15386 !! test
15387 Namespaced link must have a title
15388 !! wikitext
15389 [[Project:]]
15390 !! html
15391 <p>[[Project:]]
15392 </p>
15393 !!end
15394
15395 !! test
15396 Namespaced link must have a title (bad fragment version)
15397 !! wikitext
15398 [[Project:#fragment]]
15399 !! html
15400 <p>[[Project:#fragment]]
15401 </p>
15402 !!end
15403
15404
15405 ###
15406 ### HTML tags and HTML attributes
15407 ###
15408
15409 !! test
15410 div with no attributes
15411 !! wikitext
15412 <div>HTML rocks</div>
15413 !! html
15414 <div>HTML rocks</div>
15415
15416 !! end
15417
15418 !! test
15419 div with double-quoted attribute
15420 !! wikitext
15421 <div id="rock">HTML rocks</div>
15422 !! html
15423 <div id="rock">HTML rocks</div>
15424
15425 !! end
15426
15427 !! test
15428 div with single-quoted attribute
15429 !! wikitext
15430 <div id='rock'>HTML rocks</div>
15431 !! html
15432 <div id="rock">HTML rocks</div>
15433
15434 !! end
15435
15436 !! test
15437 div with unquoted attribute
15438 !! wikitext
15439 <div id=rock>HTML rocks</div>
15440 !! html
15441 <div id="rock">HTML rocks</div>
15442
15443 !! end
15444
15445 !! test
15446 div with illegal double attributes
15447 !! wikitext
15448 <div id="a" id="b">HTML rocks</div>
15449 !! html
15450 <div id="b">HTML rocks</div>
15451
15452 !!end
15453
15454 # FIXME: produce empty string instead of "class" in the PHP parser, following
15455 # the HTML5 spec.
15456 !! test
15457 div with empty attribute value, space before equals
15458 !! options
15459 parsoid
15460 !! wikitext
15461 <div class =>HTML rocks</div>
15462 !! html
15463 <div class="">HTML rocks</div>
15464
15465 !! end
15466
15467 !! test
15468 div with multiple empty attribute values
15469 !! options
15470 parsoid
15471 !! wikitext
15472 <div id= title=>HTML rocks</div>
15473 !! html
15474 <div id="" title="">HTML rocks</div>
15475
15476 !! end
15477
15478 !! test
15479 table with multiple empty attribute values
15480 !! options
15481 parsoid
15482 !! wikitext
15483 {| title= id=
15484 | hi
15485 |}
15486 !! html
15487 <table title="" id="">
15488 <tbody><tr><td> hi</td></tr>
15489 </tbody></table>
15490 !! end
15491
15492 !! test
15493 div with braces in attribute value
15494 !! wikitext
15495 <div title="{}">Foo</div>
15496 !! html/php
15497 <div title="&#123;}">Foo</div>
15498
15499 !! html/parsoid
15500 <div title="{}">Foo</div>
15501 !! end
15502
15503 # This it very inconsistent in the PHP parser: it returns
15504 # class="class" if there is a space between the name and the equal sign (see
15505 # 'div with empty attribute value, space before equals'), but strips the
15506 # attribute completely if the space is missing. We hope that not much content
15507 # depends on this, so are implementing the behavior below in Parsoid for
15508 # consistencies' sake.
15509 # FIXME: fix this behavior in the PHP parser?
15510 !! test
15511 div with empty attribute value, no space before equals
15512 !! options
15513 parsoid=wt2html,html2html
15514 !! wikitext
15515 <div class=>HTML rocks</div>
15516 !! html/php
15517 <div>HTML rocks</div>
15518
15519 !! html/parsoid
15520 <div class="">HTML rocks</div>
15521 !! end
15522
15523 !! test
15524 HTML multiple attributes correction
15525 !! wikitext
15526 <p class="error" class="awesome">Awesome!</p>
15527 !! html
15528 <p class="awesome">Awesome!</p>
15529
15530 !!end
15531
15532 !! test
15533 Table multiple attributes correction
15534 !! wikitext
15535 {|
15536 !+ class="error" class="awesome"| status
15537 |}
15538 !! html
15539 <table>
15540 <tr>
15541 <th class="awesome"> status
15542 </th></tr></table>
15543
15544 !!end
15545
15546 !! test
15547 DIV IN UPPERCASE
15548 !! wikitext
15549 <DIV ID="x">HTML ROCKS</DIV>
15550 !! html
15551 <div id="x">HTML ROCKS</div>
15552
15553 !!end
15554
15555 !! test
15556 Non-ASCII pseudo-tags are rendered as text
15557 !! wikitext
15558 <khyô>
15559 !! html
15560 <p>&lt;khyô&gt;
15561 </p>
15562 !! end
15563
15564 !! test
15565 Pseudo-tag with URL 'name' renders as url link
15566 !! wikitext
15567 <http://example.com/>
15568 !! html
15569 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15570 </p>
15571 !! end
15572
15573 !! test
15574 text with amp in the middle of nowhere
15575 !! wikitext
15576 Remember AT&T?
15577 !! html
15578 <p>Remember AT&amp;T?
15579 </p>
15580 !! end
15581
15582 !! test
15583 text with character entity: eacute
15584 !! wikitext
15585 I always thought &eacute; was a cute letter.
15586 !! html
15587 <p>I always thought &#233; was a cute letter.
15588 </p>
15589 !! html+tidy
15590 <p>I always thought é was a cute letter.</p>
15591 !! end
15592
15593 !! test
15594 text with entity-escaped character entity-like string: eacute
15595 !! wikitext
15596 I always thought &amp;eacute; was a cute letter.
15597 !! html
15598 <p>I always thought &amp;eacute; was a cute letter.
15599 </p>
15600 !! end
15601
15602 !! test
15603 text with undefined character entity: xacute
15604 !! wikitext
15605 I always thought &xacute; was a cute letter.
15606 !! html
15607 <p>I always thought &amp;xacute; was a cute letter.
15608 </p>
15609 !! end
15610
15611 !! test
15612 HTML5 tags
15613 !! wikitext
15614 <data value="5">five</data>
15615 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15616 <mark>This highlighted text</mark>
15617 !! html
15618 <p><data value="5">five</data>
15619 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15620 <mark>This highlighted text</mark>
15621 </p>
15622 !! end
15623
15624 !! test
15625 HTML tag with leading space is parsed as text
15626 !! wikitext
15627 < div>foo< /div>
15628 !! html
15629 <p>&lt; div&gt;foo&lt; /div&gt;
15630 </p>
15631 !! end
15632
15633 ###
15634 ### Nesting tests (see bug 41545, 50604, 51081)
15635 ###
15636
15637 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15638 # Note that html2wt is considerably more difficult if we use <b> in
15639 # the test case, instead of <big>
15640 !! test
15641 Ensure that HTML adoption agency algorithm is properly implemented.
15642 !! wikitext
15643 <big>X<big>Y</big>Z</big>
15644 !! html
15645 <p><big>X<big>Y</big>Z</big>
15646 </p>
15647 !! end
15648
15649 # This was bug 41545 in the PHP parser.
15650 # Note that tidy doesn't handle this correctly.
15651 !! test
15652 Nesting of <kbd>
15653 !! wikitext
15654 <kbd>X<kbd>Y</kbd>Z</kbd>
15655 !! html
15656 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15657 </p>
15658 !! end
15659
15660 # The following cases were bug 51081 in the PHP parser.
15661 # Note that there are some other nestable tags (b, i, etc) which are
15662 # not covered; see bug 51081 for discussion.
15663
15664 # Note that tidy doesn't handle this correctly.
15665 !! test
15666 Nesting of <em>
15667 !! wikitext
15668 <em>X<em>Y</em>Z</em>
15669 !! html
15670 <p><em>X<em>Y</em>Z</em>
15671 </p>
15672 !! end
15673
15674 # Note that tidy doesn't handle this correctly.
15675 !! test
15676 Nesting of <strong>
15677 !! wikitext
15678 <strong>X<strong>Y</strong>Z</strong>
15679 !! html
15680 <p><strong>X<strong>Y</strong>Z</strong>
15681 </p>
15682 !! end
15683
15684 !! test
15685 Nesting of <q>
15686 !! wikitext
15687 <q>X<q>Y</q>Z</q>
15688 !! html+tidy
15689 <p><q>X<q>Y</q>Z</q></p>
15690 !! end
15691
15692 # Note that tidy doesn't handle this correctly.
15693 !! test
15694 Nesting of <ruby>
15695 !! wikitext
15696 <ruby>X<ruby>Y</ruby>Z</ruby>
15697 !! html
15698 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15699 </p>
15700 !! end
15701
15702 # Note that tidy doesn't handle this correctly.
15703 !! test
15704 Nesting of <bdo>
15705 !! wikitext
15706 <bdo>X<bdo>Y</bdo>Z</bdo>
15707 !! html
15708 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15709 </p>
15710 !! end
15711
15712
15713 ###
15714 ### Media links
15715 ###
15716
15717 !! test
15718 Media link
15719 !! wikitext
15720 [[Media:Foobar.jpg]]
15721 !! html
15722 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15723 </p>
15724 !! end
15725
15726 !! test
15727 Media link with text
15728 !! wikitext
15729 [[Media:Foobar.jpg|A neat file to look at]]
15730 !! html
15731 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15732 </p>
15733 !! end
15734
15735 # FIXME: this is still bad HTML tag nesting
15736 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15737 !! test
15738 Media link with nasty text
15739 !! wikitext
15740 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15741 !! html
15742 <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>
15743
15744 !! html+tidy
15745 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15746 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15747 !! end
15748
15749 !! test
15750 Media link to nonexistent file (bug 1702)
15751 !! wikitext
15752 [[Media:No such.jpg]]
15753 !! html
15754 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15755 </p>
15756 !! end
15757
15758 !! test
15759 Image link to nonexistent file (bug 1850 - good)
15760 !! wikitext
15761 [[File:No_such.jpg]]
15762 !! html/php
15763 <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>
15764 </p>
15765 !! html/parsoid
15766 <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>
15767 !! end
15768
15769 !! test
15770 :Image link to nonexistent file (bug 1850 - bad)
15771 !! wikitext
15772 [[:Image:No such.jpg]]
15773 !! html/php
15774 <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>
15775 </p>
15776 !! html/parsoid
15777 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15778 !! end
15779
15780
15781
15782 !! test
15783 Character reference normalization in link text (bug 1938)
15784 !! wikitext
15785 [[Main Page|this&that]]
15786 !! html
15787 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15788 </p>
15789 !!end
15790
15791 !! article
15792 אַ
15793 !! text
15794 Test for unicode normalization
15795
15796 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15797 !! endarticle
15798
15799 !! test
15800 (bug 19451) Links should refer to the normalized form.
15801 !! wikitext
15802 [[&#xFB2E;]]
15803 [[&#x5d0;&#x5b7;]]
15804 [[&#x5d0;ַ]]
15805 [[א&#x5b7;]]
15806 [[אַ]]
15807 !! html
15808 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15809 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15810 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15811 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15812 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15813 </p>
15814 !! end
15815
15816 !! test
15817 Empty attribute crash test (bug 2067)
15818 !! wikitext
15819 <font color="">foo</font>
15820 !! html
15821 <p><font color="">foo</font>
15822 </p>
15823 !! end
15824
15825 !! test
15826 Empty attribute crash test single-quotes (bug 2067)
15827 !! wikitext
15828 <font color=''>foo</font>
15829 !! html
15830 <p><font color="">foo</font>
15831 </p>
15832 !! end
15833
15834 !! test
15835 Attribute test: equals, then nothing
15836 !! wikitext
15837 <font color=>foo</font>
15838 !! html
15839 <p><font>foo</font>
15840 </p>
15841 !! end
15842
15843 !! test
15844 Attribute test: unquoted value
15845 !! wikitext
15846 <font color=x>foo</font>
15847 !! html
15848 <p><font color="x">foo</font>
15849 </p>
15850 !! end
15851
15852 !! test
15853 Attribute test: unquoted but illegal value (hash)
15854 !! wikitext
15855 <font color=#x>foo</font>
15856 !! html
15857 <p><font color="#x">foo</font>
15858 </p>
15859 !! end
15860
15861 # Parsoid does not serialize to empty attribute syntax,
15862 # so wt2wt and html2wt cases are skipped
15863 !! test
15864 Attribute test: no value (T54330)
15865 !! options
15866 parsoid=wt2html,html2html
15867 !! wikitext
15868 <font color>foo</font>
15869 !! html/php
15870 <p><font color="">foo</font>
15871 </p>
15872 !! html/parsoid
15873 <p><font color="">foo</font></p>
15874 !! end
15875
15876 !! test
15877 Bug 2095: link with three closing brackets
15878 !! wikitext
15879 [[Main Page]]]
15880 !! html/php
15881 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15882 </p>
15883 !! html/parsoid
15884 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15885 !! end
15886
15887 !! test
15888 Bug 2095: link with pipe and three closing brackets
15889 !! wikitext
15890 [[Main Page|link]]]
15891 !! html/php
15892 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15893 </p>
15894 !! html/parsoid
15895 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15896 !! end
15897
15898 !! test
15899 Bug 2095: link with pipe and three closing brackets, version 2
15900 !! wikitext
15901 [[Main Page|[http://example.com/]]]
15902 !! html/php
15903 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15904 </p>
15905 !! html/parsoid
15906 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15907 !! end
15908
15909
15910 ###
15911 ### Safety
15912 ###
15913
15914 !! article
15915 Template:Dangerous attribute
15916 !! text
15917 " onmouseover="alert(document.cookie)
15918 !! endarticle
15919
15920 !! article
15921 Template:Dangerous style attribute
15922 !! text
15923 border-size: expression(alert(document.cookie))
15924 !! endarticle
15925
15926 !! article
15927 Template:Div style
15928 !! text
15929 <div style="float: right; {{{1}}}">Magic div</div>
15930 !! endarticle
15931
15932 !! test
15933 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15934 !! wikitext
15935 <div title="{{test}}"></div>
15936 !! html
15937 <div title="This is a test template"></div>
15938
15939 !! end
15940
15941 # Parsoid has enough context to handle this case
15942 !! test
15943 Bug 2304: HTML attribute safety (dangerous template; 2309)
15944 !! wikitext
15945 <div title="{{dangerous attribute}}"></div>
15946 !! html/php
15947 <div title=""></div>
15948
15949 !! html/parsoid
15950 <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>
15951 !! end
15952
15953 !! test
15954 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15955 !! wikitext
15956 <div style="{{dangerous style attribute}}"></div>
15957 !! html
15958 <div style="/* insecure input */"></div>
15959
15960 !! end
15961
15962 !! test
15963 Bug 2304: HTML attribute safety (safe parameter; 2309)
15964 !! wikitext
15965 {{div style|width: 200px}}
15966 !! html
15967 <div style="float: right; width: 200px">Magic div</div>
15968
15969 !! end
15970
15971 !! test
15972 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15973 !! wikitext
15974 {{div style|width: expression(alert(document.cookie))}}
15975 !! html
15976 <div style="/* insecure input */">Magic div</div>
15977
15978 !! end
15979
15980 !! test
15981 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15982 !! wikitext
15983 {{div style|"><script>alert(document.cookie)</script>}}
15984 !! html
15985 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15986
15987 !! end
15988
15989 !! test
15990 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15991 !! wikitext
15992 {{div style|" ><script>alert(document.cookie)</script>}}
15993 !! html
15994 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15995
15996 !! end
15997
15998 !! test
15999 Bug 2304: HTML attribute safety (link)
16000 !! wikitext
16001 <div title="[[Main Page]]"></div>
16002 !! html
16003 <div title="&#91;&#91;Main Page]]"></div>
16004
16005 !! end
16006
16007 !! test
16008 Bug 2304: HTML attribute safety (italics)
16009 !! wikitext
16010 <div title="''foobar''"></div>
16011 !! html
16012 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16013
16014 !! end
16015
16016 !! test
16017 Bug 2304: HTML attribute safety (bold)
16018 !! wikitext
16019 <div title="'''foobar'''"></div>
16020 !! html
16021 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16022
16023 !! end
16024
16025
16026 !! test
16027 Bug 2304: HTML attribute safety (ISBN)
16028 !! wikitext
16029 <div title="ISBN 1234567890"></div>
16030 !! html
16031 <div title="&#73;SBN 1234567890"></div>
16032
16033 !! end
16034
16035 !! test
16036 Bug 2304: HTML attribute safety (RFC)
16037 !! wikitext
16038 <div title="RFC 1234"></div>
16039 !! html
16040 <div title="&#82;FC 1234"></div>
16041
16042 !! end
16043
16044 !! test
16045 Bug 2304: HTML attribute safety (PMID)
16046 !! wikitext
16047 <div title="PMID 1234567890"></div>
16048 !! html
16049 <div title="&#80;MID 1234567890"></div>
16050
16051 !! end
16052
16053 !! test
16054 Bug 2304: HTML attribute safety (web link)
16055 !! wikitext
16056 <div title="http://example.com/"></div>
16057 !! html
16058 <div title="http&#58;//example.com/"></div>
16059
16060 !! end
16061
16062 !! test
16063 Bug 2304: HTML attribute safety (named web link)
16064 !! wikitext
16065 <div title="[http://example.com/ link]"></div>
16066 !! html
16067 <div title="&#91;http&#58;//example.com/ link]"></div>
16068
16069 !! end
16070
16071 !! test
16072 Bug 3244: HTML attribute safety (extension; safe)
16073 !! wikitext
16074 <div style="<nowiki>background:blue</nowiki>"></div>
16075 !! html
16076 <div style="background:blue"></div>
16077
16078 !! end
16079
16080 !! test
16081 Bug 3244: HTML attribute safety (extension; unsafe)
16082 !! wikitext
16083 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16084 !! html
16085 <div style="/* insecure input */"></div>
16086
16087 !! end
16088
16089 # More MSIE fun discovered by Tom Gilder
16090
16091 !! test
16092 MSIE CSS safety test: spurious slash
16093 !! wikitext
16094 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16095 !! html
16096 <div style="/* insecure input */">evil</div>
16097
16098 !! end
16099
16100 !! test
16101 MSIE CSS safety test: hex code
16102 !! wikitext
16103 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16104 !! html
16105 <div style="/* insecure input */">evil</div>
16106
16107 !! end
16108
16109 !! test
16110 MSIE CSS safety test: comment in url
16111 !! wikitext
16112 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16113 !! html
16114 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16115
16116 !! end
16117
16118 !! test
16119 MSIE CSS safety test: comment in expression
16120 !! wikitext
16121 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16122 !! html
16123 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16124
16125 !! end
16126
16127 !! test
16128 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16129 !! wikitext
16130 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16131 !! html
16132 <p style="/* invalid control char */">A</p>
16133
16134 !! end
16135
16136 !! test
16137 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16138 !! wikitext
16139 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16140 <div style="top:EXPRESSION(alert())">B</div>
16141 !! html
16142 <p style="/* insecure input */">A</p>
16143 <div style="/* insecure input */">B</div>
16144
16145 !! end
16146
16147 !! test
16148 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16149 !! wikitext
16150 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16151 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16152 !! html
16153 <div style="/* insecure input */">A</div>
16154 <p style="/* insecure input */">B</p>
16155
16156 !! end
16157
16158 !! test
16159 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16160 !! wikitext
16161 <div style="background-image:url⁽javascript:alert())">A</div>
16162 <div style="background-image:url₍javascript:alert())">B</div>
16163 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16164 !! html
16165 <div style="/* insecure input */">A</div>
16166 <div style="/* insecure input */">B</div>
16167 <p style="/* insecure input */">C</p>
16168
16169 !! end
16170
16171 # FIXME: Parsoid fails to sanitize this! See T58846.
16172 !! test
16173 Opera -o-link CSS
16174 !! wikitext
16175 <div
16176 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;"
16177 style="-o-link:attr(title);-o-link-source:current">X</div>
16178 !! html
16179 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16180
16181 !! end
16182
16183 !! test
16184 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16185 !! wikitext
16186 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16187 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16188 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16189 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16190 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16191 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16192 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16193 !! html
16194 <p style="/* insecure input */">A</p>
16195 <p style="/* insecure input */">B</p>
16196 <p style="/* insecure input */">C</p>
16197 <p style="/* insecure input */">D</p>
16198 <p style="/* insecure input */">E</p>
16199 <p style="/* insecure input */">F</p>
16200 <p style="/* insecure input */">G</p>
16201
16202 !! end
16203
16204 !! test
16205 Table attribute legitimate extension
16206 !! wikitext
16207 {|
16208 !+ style="<nowiki>color:blue</nowiki>"| status
16209 |}
16210 !! html
16211 <table>
16212 <tr>
16213 <th style="color:blue"> status
16214 </th></tr></table>
16215
16216 !!end
16217
16218 !! test
16219 Table attribute safety
16220 !! wikitext
16221 {|
16222 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16223 |}
16224 !! html
16225 <table>
16226 <tr>
16227 <th style="/* insecure input */"> status
16228 </th></tr></table>
16229
16230 !! end
16231
16232 !! test
16233 CSS line continuation 1
16234 !! wikitext
16235 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16236 !! html
16237 <div style="/* insecure input */"></div>
16238
16239 !! end
16240
16241 !! test
16242 CSS line continuation 2
16243 !! wikitext
16244 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16245 !! html
16246 <div style="/* invalid control char */"></div>
16247
16248 !! end
16249
16250 !! article
16251 Template:Identity
16252 !! text
16253 {{{1}}}
16254 !! endarticle
16255
16256 !! test
16257 Expansion of multi-line templates in attribute values (bug 6255)
16258 !! wikitext
16259 <div style="background: {{identity|#00FF00}}">-</div>
16260 !! html
16261 <div style="background: #00FF00">-</div>
16262
16263 !! end
16264
16265
16266 !! test
16267 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16268 !! wikitext
16269 <div style="background:
16270 #00FF00">-</div>
16271 !! html/php
16272 <div style="background: #00FF00">-</div>
16273
16274 !! html/parsoid
16275 <div style="background:
16276 #00FF00">-</div>
16277 !! end
16278
16279 !! test
16280 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16281 !! wikitext
16282 <div style="background: &#10;#00FF00">-</div>
16283 !! html
16284 <div style="background: &#10;#00FF00">-</div>
16285
16286 !! end
16287
16288 !! test
16289 evil <math>-wiki-tags without Extension:Math enabled
16290 !! wikitext
16291 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16292 !! html+tidy
16293 <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>
16294 !! end
16295
16296 ###
16297 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16298 ###
16299 !! test
16300 Parser hook: empty input
16301 !! wikitext
16302 <tag></tag>
16303 !! html/php
16304 <pre>
16305 ''
16306 array (
16307 )
16308 </pre>
16309
16310 !! html/parsoid
16311 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16312 !! end
16313
16314 ## Don't expect parsoid to rt this form.
16315 !! test
16316 Parser hook: empty input using terminated empty elements
16317 !! options
16318 parsoid=wt2html,html2html
16319 !! wikitext
16320 <tag/>
16321 !! html/php
16322 <pre>
16323 NULL
16324 array (
16325 )
16326 </pre>
16327
16328 !! html/parsoid
16329 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16330 !! end
16331
16332 !! test
16333 Parser hook: empty input using terminated empty elements (space before)
16334 !! wikitext
16335 <tag />
16336 !! html/php
16337 <pre>
16338 NULL
16339 array (
16340 )
16341 </pre>
16342
16343 !! html/parsoid
16344 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16345 !! end
16346
16347 !! test
16348 Parser hook: basic input
16349 !! wikitext
16350 <tag>input</tag>
16351 !! html/php
16352 <pre>
16353 'input'
16354 array (
16355 )
16356 </pre>
16357
16358 !! html/parsoid
16359 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16360 !! end
16361
16362 ## Don't expect parsoid to rt this form.
16363 !! test
16364 Parser hook: case insensitive
16365 !! options
16366 parsoid=wt2html,html2html
16367 !! wikitext
16368 <TAG>input</TAG>
16369 !! html/php
16370 <pre>
16371 'input'
16372 array (
16373 )
16374 </pre>
16375
16376 !! html/parsoid
16377 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16378 !! end
16379
16380 ## Don't expect parsoid to rt this form.
16381 !! test
16382 Parser hook: case insensitive, redux
16383 !! options
16384 parsoid=wt2html,html2html
16385 !! wikitext
16386 <TaG>input</TAg>
16387 !! html/php
16388 <pre>
16389 'input'
16390 array (
16391 )
16392 </pre>
16393
16394 !! html/parsoid
16395 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16396 !! end
16397
16398 !! test
16399 Parser hook: nested tags
16400 !! options
16401 noxml
16402 !! wikitext
16403 <tag><tag></tag></tag>
16404 !! html/php
16405 <pre>
16406 '<tag>'
16407 array (
16408 )
16409 </pre>&lt;/tag&gt;
16410
16411 !! html/parsoid
16412 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16413 !! end
16414
16415 !! test
16416 Parser hook: basic arguments
16417 !! wikitext
16418 <tag width="200" height="100" depth="50" square=""></tag>
16419 !! html/php
16420 <pre>
16421 ''
16422 array (
16423 'width' => '200',
16424 'height' => '100',
16425 'depth' => '50',
16426 'square' => '',
16427 )
16428 </pre>
16429
16430 !! html/parsoid
16431 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16432 !! end
16433
16434 ## Don't expect parsoid to rt this form.
16435 !! test
16436 Parser hook: basic arguments, variations
16437 !! options
16438 parsoid=wt2html,html2html
16439 !! wikitext
16440 <tag width=200 height = "100" depth = '50' square></tag>
16441 !! html/php
16442 <pre>
16443 ''
16444 array (
16445 'width' => '200',
16446 'height' => '100',
16447 'depth' => '50',
16448 'square' => '',
16449 )
16450 </pre>
16451
16452 !! html/parsoid
16453 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16454 !! end
16455
16456 !! test
16457 Parser hook: argument containing a forward slash (bug 5344)
16458 !! wikitext
16459 <tag filename="/tmp/bla"></tag>
16460 !! html/php
16461 <pre>
16462 ''
16463 array (
16464 'filename' => '/tmp/bla',
16465 )
16466 </pre>
16467
16468 !! html/parsoid
16469 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16470 !! end
16471
16472 ## Don't expect parsoid to rt this form.
16473 !! test
16474 Parser hook: empty input using terminated empty elements (bug 2374)
16475 !! options
16476 parsoid=wt2html,html2html
16477 !! wikitext
16478 <tag foo=bar/>text
16479 !! html/php
16480 <pre>
16481 NULL
16482 array (
16483 'foo' => 'bar',
16484 )
16485 </pre>text
16486
16487 !! html/parsoid
16488 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16489 !! end
16490
16491 # </tag> should be output literally since there is no matching tag that begins it
16492 !! test
16493 Parser hook: basic arguments using terminated empty elements (bug 2374)
16494 !! wikitext
16495 <tag width=200 height = "100" depth = '50' square/>
16496 other stuff
16497 </tag>
16498 !! html/php
16499 <pre>
16500 NULL
16501 array (
16502 'width' => '200',
16503 'height' => '100',
16504 'depth' => '50',
16505 'square' => '',
16506 )
16507 </pre>
16508 <p>other stuff
16509 &lt;/tag&gt;
16510 </p>
16511 !! end
16512
16513 ###
16514 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16515 ###
16516
16517 !! test
16518 Parser hook: static parser hook not inside a comment
16519 !! wikitext
16520 <statictag>hello, world</statictag>
16521
16522 <statictag action="flush" />
16523 !! html/php
16524 <p><br />
16525 hello, world
16526 </p>
16527 !! html/parsoid
16528 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16529 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16530 !! end
16531
16532 !! test
16533 Parser hook: static parser hook inside a comment
16534 !! wikitext
16535 <!-- <statictag>hello, world</statictag> -->
16536 <statictag action="flush" />
16537 !! html/php
16538 <p><br />
16539 </p>
16540 !! html/parsoid
16541 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16542 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16543 !! end
16544
16545 # Nested template calls; this case was broken by Parser.php rev 1.506,
16546 # since reverted.
16547
16548 !! article
16549 Template:One-parameter
16550 !! text
16551 (My parameter is: {{{1}}})
16552 !! endarticle
16553
16554 !! article
16555 Template:Map-one-parameter
16556 !! text
16557 {{{{{1}}}|{{{2}}}}}
16558 !! endarticle
16559
16560 !! test
16561 Nested template calls
16562 !! wikitext
16563 {{Map-one-parameter|One-parameter|param}}
16564 !! html
16565 <p>(My parameter is: param)
16566 </p>
16567 !! end
16568
16569
16570 ###
16571 ### Sanitizer
16572 ###
16573
16574 # HTML+Tidy effectively strips out the empty tags completely
16575 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16576 # which Tidy would have done for the PHP parser had there been content inside it.
16577 !! test
16578 Sanitizer: Closing of open tags
16579 !! wikitext
16580 <s></s><table></table>
16581 !! html
16582 <s></s><table></table>
16583
16584 !! html/parsoid
16585 <p><s></s></p><table></table>
16586 !! end
16587
16588 !! test
16589 Sanitizer: Closing of open but not closed tags
16590 !! wikitext
16591 <s>foo
16592 !! html
16593 <p><s>foo</s>
16594 </p>
16595 !! end
16596
16597 !! test
16598 Sanitizer: Closing of closed but not open tags
16599 !! options
16600 parsoid=wt2html
16601 !! wikitext
16602 </s>
16603 !! html/php+tidy
16604 !! html/parsoid
16605 !! end
16606
16607 !! test
16608 Sanitizer: Closing of closed but not open table tags
16609 !! options
16610 parsoid=wt2html
16611 !! wikitext
16612 Table not started</td></tr></table>
16613 !! html/php+tidy
16614 <p>Table not started</p>
16615 !! html/parsoid
16616 <p>Table not started</p>
16617 !! end
16618
16619 !! test
16620 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16621 !! wikitext
16622 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16623 !! html
16624 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16625 </p>
16626 !! end
16627
16628 # In HTML5, the restrictions are that id must contain at least one character,
16629 # and must not contain any space characters.
16630 !! test
16631 Sanitizer: Validating the contents of the id attribute (bug 4515)
16632 !! options
16633 disabled
16634 !! wikitext
16635 <br id="" /><br id="a space" />
16636 !! html
16637 Something ...
16638 !! end
16639
16640 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16641 !! test
16642 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16643 !! options
16644 disabled
16645 !! wikitext
16646 <br id="foo" /><br id="foo" />
16647 !! html
16648 Something need to be done. foo-2 ?
16649 !! end
16650
16651 !! test
16652 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16653 !! wikitext
16654 <div itemscope>
16655 <meta itemprop="hello" content="world">
16656 <meta http-equiv="refresh" content="5">
16657 <meta itemprop="hello" http-equiv="refresh" content="5">
16658 <link itemprop="hello" href="{{SERVER}}">
16659 <link rel="stylesheet" href="{{SERVER}}">
16660 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16661 </div>
16662 !! html
16663 <div itemscope="">
16664 <p> <meta itemprop="hello" content="world" />
16665 &lt;meta http-equiv="refresh" content="5"&gt;
16666 <meta itemprop="hello" content="5" />
16667 </p>
16668 <link itemprop="hello" href="http&#58;//example.org" />
16669 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16670 <link itemprop="hello" href="http&#58;//example.org" />
16671 </div>
16672
16673 !! end
16674
16675 !! test
16676 Language converter: output gets cut off unexpectedly (bug 5757)
16677 !! options
16678 language=zh
16679 !! wikitext
16680 this bit is safe: }-
16681
16682 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16683
16684 then we get cut off here: }-
16685
16686 all additional text is vanished
16687 !! html
16688 <p>this bit is safe: }-
16689 </p><p>but if we add a conversion instance: xxx
16690 </p><p>then we get cut off here: }-
16691 </p><p>all additional text is vanished
16692 </p>
16693 !! end
16694
16695 !! test
16696 Self closed html pairs (bug 5487)
16697 !! options
16698 !! wikitext
16699 <center><font id="bug" />Centered text</center>
16700 <div><font id="bug2" />In div text</div>
16701 !! html
16702 <center>&lt;font id="bug" /&gt;Centered text</center>
16703 <div>&lt;font id="bug2" /&gt;In div text</div>
16704
16705 !! end
16706
16707 #
16708 #
16709 #
16710
16711 !! test
16712 Punctuation: nbsp before exclamation
16713 !! wikitext
16714 C'est grave !
16715 !! html
16716 <p>C'est grave&#160;!
16717 </p>
16718 !! end
16719
16720 !! test
16721 Punctuation: CSS !important (bug 11874)
16722 !! wikitext
16723 <div style="width:50% !important">important</div>
16724 !! html
16725 <div style="width:50% !important">important</div>
16726
16727 !!end
16728
16729 !! test
16730 Punctuation: CSS ! important (bug 11874; with space after)
16731 !! wikitext
16732 <div style="width:50% ! important">important</div>
16733 !! html
16734 <div style="width:50% ! important">important</div>
16735
16736 !!end
16737
16738 !! test
16739 HTML bullet list, closed tags (bug 5497)
16740 !! wikitext
16741 <ul>
16742 <li>One</li>
16743 <li>Two</li>
16744 </ul>
16745 !! html/php
16746 <ul>
16747 <li>One</li>
16748 <li>Two</li>
16749 </ul>
16750
16751 !! html/parsoid
16752 <ul data-parsoid='{"stx":"html"}'>
16753 <li data-parsoid='{"stx":"html"}'>One</li>
16754 <li data-parsoid='{"stx":"html"}'>Two</li>
16755 </ul>
16756
16757 !! end
16758
16759 !! test
16760 HTML bullet list, unclosed tags (bug 5497)
16761 !! wikitext
16762 <ul>
16763 <li>One
16764 <li>Two
16765 </ul>
16766 !! html/php+tidy
16767 <ul>
16768 <li>One</li>
16769 <li>Two</li>
16770 </ul>
16771 !! html/parsoid
16772 <ul data-parsoid='{"stx":"html"}'>
16773 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16774 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16775 </ul>
16776
16777 !! end
16778
16779 !! test
16780 HTML ordered list, closed tags (bug 5497)
16781 !! wikitext
16782 <ol>
16783 <li>One</li>
16784 <li>Two</li>
16785 </ol>
16786 !! html/php
16787 <ol>
16788 <li>One</li>
16789 <li>Two</li>
16790 </ol>
16791
16792 !! html/parsoid
16793 <ol data-parsoid='{"stx":"html"}'>
16794 <li data-parsoid='{"stx":"html"}'>One</li>
16795 <li data-parsoid='{"stx":"html"}'>Two</li>
16796 </ol>
16797
16798 !! end
16799
16800 !! test
16801 HTML ordered list, unclosed tags (bug 5497)
16802 !! options
16803 !! wikitext
16804 <ol>
16805 <li>One
16806 <li>Two
16807 </ol>
16808 !! html/php+tidy
16809 <ol>
16810 <li>One</li>
16811 <li>Two</li>
16812 </ol>
16813 !! html/parsoid
16814 <ol data-parsoid='{"stx":"html"}'>
16815 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16816 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16817 </ol>
16818
16819 !! end
16820
16821 !! test
16822 HTML nested bullet list, closed tags (bug 5497)
16823 !! wikitext
16824 <ul>
16825 <li>One</li>
16826 <li>Two:
16827 <ul>
16828 <li>Sub-one</li>
16829 <li>Sub-two</li>
16830 </ul>
16831 </li>
16832 </ul>
16833 !! html
16834 <ul>
16835 <li>One</li>
16836 <li>Two:
16837 <ul>
16838 <li>Sub-one</li>
16839 <li>Sub-two</li>
16840 </ul>
16841 </li>
16842 </ul>
16843
16844 !! end
16845
16846 !! test
16847 HTML nested bullet list, open tags (bug 5497)
16848 !! wikitext
16849 <ul>
16850 <li>One
16851 <li>Two:
16852 <ul>
16853 <li>Sub-one
16854 <li>Sub-two
16855 </ul>
16856 </ul>
16857 !! html/php+tidy
16858 <ul>
16859 <li>One</li>
16860 <li>Two:
16861 <ul>
16862 <li>Sub-one</li>
16863 <li>Sub-two</li>
16864 </ul>
16865 </li>
16866 </ul>
16867 !! html/parsoid
16868 <ul>
16869 <li>One
16870 </li>
16871 <li>Two:
16872 <ul>
16873 <li>Sub-one
16874 </li>
16875 <li>Sub-two
16876 </li>
16877 </ul>
16878 </li>
16879 </ul>
16880
16881 !! end
16882
16883 !! test
16884 HTML nested ordered list, closed tags (bug 5497)
16885 !! wikitext
16886 <ol>
16887 <li>One</li>
16888 <li>Two:
16889 <ol>
16890 <li>Sub-one</li>
16891 <li>Sub-two</li>
16892 </ol>
16893 </li>
16894 </ol>
16895 !! html
16896 <ol>
16897 <li>One</li>
16898 <li>Two:
16899 <ol>
16900 <li>Sub-one</li>
16901 <li>Sub-two</li>
16902 </ol>
16903 </li>
16904 </ol>
16905
16906 !! end
16907
16908 !! test
16909 HTML nested ordered list, open tags (bug 5497)
16910 !! wikitext
16911 <ol>
16912 <li>One
16913 <li>Two:
16914 <ol>
16915 <li>Sub-one
16916 <li>Sub-two
16917 </ol>
16918 </ol>
16919 !! html/php
16920 <ol>
16921 <li>One
16922 <li>Two:
16923 <ol>
16924 <li>Sub-one
16925 <li>Sub-two
16926 </ol>
16927 </ol>
16928
16929 !! html/parsoid
16930 <ol>
16931 <li>One
16932 </li>
16933 <li>Two:
16934 <ol>
16935 <li>Sub-one
16936 </li>
16937 <li>Sub-two
16938 </li>
16939 </ol>
16940 </li>
16941 </ol>
16942
16943 !! end
16944
16945 !! test
16946 HTML ordered list item with parameters oddity
16947 !! wikitext
16948 <ol><li id="fragment">One</li>
16949 </ol>
16950 !! html
16951 <ol><li id="fragment">One</li>
16952 </ol>
16953
16954 !! end
16955
16956 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16957 !!test
16958 bug 5918: autonumbering
16959 !! wikitext
16960 [http://first/] [http://second] [ftp://ftp]
16961
16962 ftp://inlineftp
16963
16964 [mailto:enclosed@mail.tld With target]
16965
16966 [mailto:enclosed@mail.tld]
16967
16968 mailto:inline@mail.tld
16969 !! html/php
16970 <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>
16971 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16972 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16973 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16974 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16975 </p>
16976 !! html/parsoid
16977 <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>
16978 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16979 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16980 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16981 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16982 !! end
16983
16984
16985 #
16986 # Security and HTML correctness
16987 # From Nick Jenkins' fuzz testing
16988 #
16989
16990 !! test
16991 Fuzz testing: Parser13
16992 !! wikitext
16993 {|
16994 | http://a|
16995 !! html
16996 <table>
16997 <tr>
16998 <td>
16999 </td>
17000 </tr>
17001 </table>
17002
17003 !! end
17004
17005 !! test
17006 Fuzz testing: Parser14
17007 !! wikitext
17008 == onmouseover= ==
17009 http://__TOC__
17010 !! html
17011 <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>
17012 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17013 <ul>
17014 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17015 </ul>
17016 </div>
17017
17018
17019 !! html+tidy
17020 <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>
17021 <p>http://</p>
17022 <div id="toc" class="toc">
17023 <div id="toctitle">
17024 <h2>Contents</h2>
17025 </div>
17026 <ul>
17027 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17028 </ul>
17029 </div>
17030 <p></p>
17031 !! end
17032
17033 !! test
17034 Fuzz testing: Parser14-table
17035 !! wikitext
17036 ==a==
17037 {| STYLE=__TOC__
17038 !! html
17039 <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>
17040 <table style="&#95;_TOC&#95;_">
17041 <tr><td></td></tr>
17042 </table>
17043
17044 !! html+tidy
17045 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17046 <table style="__TOC__">
17047 <tr>
17048 <td></td>
17049 </tr>
17050 </table>
17051 !! end
17052
17053 # Known to produce bogus xml (extra </td>)
17054 !! test
17055 Fuzz testing: Parser16
17056 !! options
17057 noxml
17058 !! wikitext
17059 {|
17060 !https://||||||
17061 !! html
17062 <table>
17063 <tr>
17064 <th>https://</th>
17065 <th></th>
17066 <th></th>
17067 <th>
17068 </td>
17069 </tr>
17070 </table>
17071
17072 !! html+tidy
17073 <table>
17074 <tr>
17075 <th>https://</th>
17076 <th></th>
17077 <th></th>
17078 <th></th>
17079 </tr>
17080 </table>
17081 !! end
17082
17083 !! test
17084 Fuzz testing: Parser21
17085 !! wikitext
17086 {|
17087 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17088 |
17089 !! html
17090 <table>
17091 <tr>
17092 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17093 </th>
17094 <td>
17095 </td>
17096 </tr>
17097 </table>
17098
17099 !! end
17100
17101 !! test
17102 Fuzz testing: Parser22
17103 !! wikitext
17104 http://===r:::https://b
17105
17106 {|
17107 !! html
17108 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17109 </p>
17110 <table>
17111 <tr><td></td></tr>
17112 </table>
17113
17114 !! end
17115
17116 # Known to produce bad XML for now
17117 !! test
17118 Fuzz testing: Parser24
17119 !! options
17120 noxml
17121 !! wikitext
17122 {|
17123 {{{|
17124 <u CLASS=
17125 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17126 <br style="onmouseover='alert(document.cookie);' " />
17127
17128 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17129 |
17130 !! html
17131 <table>
17132 {{{|
17133 <u class="&#124;">}}}} &gt;
17134 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17135
17136 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17137 <tr>
17138 <td></u>
17139 </td>
17140 </tr>
17141 </table>
17142
17143 !! end
17144
17145 # Note: the current result listed for this is not what the original one was,
17146 # but the original bug was JavaScript injection, which is fixed in any case.
17147 # It's not clear that the original result listed was any more correct than the
17148 # current one. Original result:
17149 # <p>{{{|
17150 # </p>
17151 # <li class="&#124;&#124;">
17152 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17153 !!test
17154 Fuzz testing: Parser25 (bug 6055)
17155 !! wikitext
17156 {{{
17157 |
17158 <LI CLASS=||
17159 >
17160 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17161 !! html
17162 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17163 </p>
17164 !! end
17165
17166 !!test
17167 Fuzz testing: URL adjacent extension (with space, clean)
17168 !! wikitext
17169 http://example.com <nowiki>junk</nowiki>
17170 !! html/php
17171 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17172 </p>
17173 !! html/parsoid
17174 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17175 !! end
17176
17177 !!test
17178 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17179 !! wikitext
17180 http://example.com<nowiki>junk</nowiki>
17181 !! html/php
17182 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17183 </p>
17184 !! html/parsoid
17185 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17186 !! end
17187
17188 !!test
17189 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17190 !! wikitext
17191 http://example.com<pre>junk</pre>
17192 !! html/php
17193 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17194
17195 !! html/php+tidy
17196 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17197 <pre>
17198 junk
17199 </pre>
17200 !! html/parsoid
17201 <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>
17202 !!end
17203
17204 !!test
17205 Fuzz testing: image with bogus manual thumbnail
17206 !! wikitext
17207 [[Image:foobar.jpg|thumbnail= ]]
17208 !! html/php
17209 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17210
17211 !! html/parsoid
17212 <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>
17213 !!end
17214
17215 !! test
17216 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17217 !! wikitext
17218 <pre dir="&#10;"></pre>
17219 !! html
17220 <pre dir="&#10;"></pre>
17221
17222 !! end
17223
17224 !! test
17225 Parsing optional HTML elements (Bug 6171)
17226 !! options
17227 !! wikitext
17228 <table>
17229 <tr>
17230 <td> Some tabular data</td>
17231 <td> More tabular data ...
17232 <td> And yet som tabular data</td>
17233 </tr>
17234 </table>
17235 !! html
17236 <table>
17237 <tr>
17238 <td> Some tabular data</td>
17239 <td> More tabular data ...
17240 </td><td> And yet som tabular data</td>
17241 </tr>
17242 </table>
17243
17244 !! end
17245
17246 !! test
17247 Correct handling of <td>, <tr> (Bug 6171)
17248 !! options
17249 !! wikitext
17250 <table>
17251 <tr>
17252 <td> Some tabular data</td>
17253 <td> More tabular data ...</td>
17254 <td> And yet som tabular data</td>
17255 </tr>
17256 </table>
17257 !! html
17258 <table>
17259 <tr>
17260 <td> Some tabular data</td>
17261 <td> More tabular data ...</td>
17262 <td> And yet som tabular data</td>
17263 </tr>
17264 </table>
17265
17266 !! end
17267
17268
17269 !! test
17270 Parsing crashing regression (fr:JavaScript)
17271 !! wikitext
17272 </body></x>
17273 !! html
17274 <p>&lt;/body&gt;&lt;/x&gt;
17275 </p>
17276 !! end
17277
17278 !! test
17279 Inline wiki vs wiki block nesting
17280 !! wikitext
17281 '''Bold paragraph
17282
17283 New wiki paragraph
17284 !! html
17285 <p><b>Bold paragraph</b>
17286 </p><p>New wiki paragraph
17287 </p>
17288 !! end
17289
17290 # FIXME: The current php output is documented
17291 # and desired output is the parsoid target.
17292 !! test
17293 Inline HTML vs wiki block nesting
17294 !! wikitext
17295 <b>Bold paragraph
17296
17297 New wiki paragraph
17298 !! html/php
17299 <p><b>Bold paragraph
17300 </p><p>New wiki paragraph</b>
17301 </p>
17302 !! html/parsoid
17303 <p><b>Bold paragraph</b>
17304 </p><p>New wiki paragraph
17305 </p>
17306 !! end
17307
17308 # Original result was this:
17309 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17310 # </p>
17311 # While that might be marginally more intuitive, maybe, the six-apostrophe
17312 # construct is clearly pathological and the result stated here (which is what
17313 # the parser actually does) is about as reasonable as anything.
17314 !!test
17315 Mixing markup for italics and bold
17316 !! options
17317 !! wikitext
17318 '''bold''''''bold''bolditalics'''''
17319 !! html
17320 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17321 </p>
17322 !! end
17323
17324
17325 !! article
17326 Xyzzyx
17327 !! text
17328 Article for special page transclusion test
17329 !! endarticle
17330
17331 !! test
17332 Special page transclusion
17333 !! options
17334 !! wikitext
17335 {{Special:Prefixindex/Xyzzyx}}
17336 !! html
17337 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17338 </ul>
17339
17340 !! end
17341
17342 !! test
17343 Special page transclusion twice (bug 5021)
17344 !! options
17345 !! wikitext
17346 {{Special:Prefixindex/Xyzzyx}}
17347 {{Special:Prefixindex/Xyzzyx}}
17348 !! html
17349 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17350 </ul>
17351 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17352 </ul>
17353
17354 !! end
17355
17356 !! test
17357 Transclusion of default MediaWiki message
17358 !! wikitext
17359 {{MediaWiki:Mainpage}}
17360 !! html
17361 <p>Main Page
17362 </p>
17363 !! end
17364
17365 !! test
17366 Transclusion of nonexistent MediaWiki message
17367 !! wikitext
17368 {{MediaWiki:Mainpagexxx}}
17369 !! html
17370 <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>
17371 </p>
17372 !! end
17373
17374 !! test
17375 Transclusion of MediaWiki message with underscore
17376 !! wikitext
17377 {{MediaWiki:history_short}}
17378 !! html
17379 <p>History
17380 </p>
17381 !! end
17382
17383 !! test
17384 Transclusion of MediaWiki message with space
17385 !! wikitext
17386 {{MediaWiki:history short}}
17387 !! html
17388 <p>History
17389 </p>
17390 !! end
17391
17392 !! test
17393 Invalid header with following text
17394 !! wikitext
17395 = x = y
17396 !! html
17397 <p>= x = y
17398 </p>
17399 !! end
17400
17401
17402 !! test
17403 Section extraction test (section 0)
17404 !! options
17405 section=0
17406 !! wikitext
17407 start
17408 ==a==
17409 ===aa===
17410 ====aaa====
17411 ==b==
17412 ===ba===
17413 ===bb===
17414 ====bba====
17415 ===bc===
17416 ==c==
17417 ===ca===
17418 !! html/php
17419 start
17420 !! end
17421
17422 !! test
17423 Section extraction test (section 1)
17424 !! options
17425 section=1
17426 !! wikitext
17427 start
17428 ==a==
17429 ===aa===
17430 ====aaa====
17431 ==b==
17432 ===ba===
17433 ===bb===
17434 ====bba====
17435 ===bc===
17436 ==c==
17437 ===ca===
17438 !! html/php
17439 ==a==
17440 ===aa===
17441 ====aaa====
17442 !! end
17443
17444 !! test
17445 Section extraction test (section 2)
17446 !! options
17447 section=2
17448 !! wikitext
17449 start
17450 ==a==
17451 ===aa===
17452 ====aaa====
17453 ==b==
17454 ===ba===
17455 ===bb===
17456 ====bba====
17457 ===bc===
17458 ==c==
17459 ===ca===
17460 !! html/php
17461 ===aa===
17462 ====aaa====
17463 !! end
17464
17465 !! test
17466 Section extraction test (section 3)
17467 !! options
17468 section=3
17469 !! wikitext
17470 start
17471 ==a==
17472 ===aa===
17473 ====aaa====
17474 ==b==
17475 ===ba===
17476 ===bb===
17477 ====bba====
17478 ===bc===
17479 ==c==
17480 ===ca===
17481 !! html/php
17482 ====aaa====
17483 !! end
17484
17485 !! test
17486 Section extraction test (section 4)
17487 !! options
17488 section=4
17489 !! wikitext
17490 start
17491 ==a==
17492 ===aa===
17493 ====aaa====
17494 ==b==
17495 ===ba===
17496 ===bb===
17497 ====bba====
17498 ===bc===
17499 ==c==
17500 ===ca===
17501 !! html/php
17502 ==b==
17503 ===ba===
17504 ===bb===
17505 ====bba====
17506 ===bc===
17507 !! end
17508
17509 !! test
17510 Section extraction test (section 5)
17511 !! options
17512 section=5
17513 !! wikitext
17514 start
17515 ==a==
17516 ===aa===
17517 ====aaa====
17518 ==b==
17519 ===ba===
17520 ===bb===
17521 ====bba====
17522 ===bc===
17523 ==c==
17524 ===ca===
17525 !! html/php
17526 ===ba===
17527 !! end
17528
17529 !! test
17530 Section extraction test (section 6)
17531 !! options
17532 section=6
17533 !! wikitext
17534 start
17535 ==a==
17536 ===aa===
17537 ====aaa====
17538 ==b==
17539 ===ba===
17540 ===bb===
17541 ====bba====
17542 ===bc===
17543 ==c==
17544 ===ca===
17545 !! html/php
17546 ===bb===
17547 ====bba====
17548 !! end
17549
17550 !! test
17551 Section extraction test (section 7)
17552 !! options
17553 section=7
17554 !! wikitext
17555 start
17556 ==a==
17557 ===aa===
17558 ====aaa====
17559 ==b==
17560 ===ba===
17561 ===bb===
17562 ====bba====
17563 ===bc===
17564 ==c==
17565 ===ca===
17566 !! html/php
17567 ====bba====
17568 !! end
17569
17570 !! test
17571 Section extraction test (section 8)
17572 !! options
17573 section=8
17574 !! wikitext
17575 start
17576 ==a==
17577 ===aa===
17578 ====aaa====
17579 ==b==
17580 ===ba===
17581 ===bb===
17582 ====bba====
17583 ===bc===
17584 ==c==
17585 ===ca===
17586 !! html/php
17587 ===bc===
17588 !! end
17589
17590 !! test
17591 Section extraction test (section 9)
17592 !! options
17593 section=9
17594 !! wikitext
17595 start
17596 ==a==
17597 ===aa===
17598 ====aaa====
17599 ==b==
17600 ===ba===
17601 ===bb===
17602 ====bba====
17603 ===bc===
17604 ==c==
17605 ===ca===
17606 !! html/php
17607 ==c==
17608 ===ca===
17609 !! end
17610
17611 !! test
17612 Section extraction test (section 10)
17613 !! options
17614 section=10
17615 !! wikitext
17616 start
17617 ==a==
17618 ===aa===
17619 ====aaa====
17620 ==b==
17621 ===ba===
17622 ===bb===
17623 ====bba====
17624 ===bc===
17625 ==c==
17626 ===ca===
17627 !! html/php
17628 ===ca===
17629 !! end
17630
17631 !! test
17632 Section extraction test (nonexistent section 11)
17633 !! options
17634 section=11
17635 !! wikitext
17636 start
17637 ==a==
17638 ===aa===
17639 ====aaa====
17640 ==b==
17641 ===ba===
17642 ===bb===
17643 ====bba====
17644 ===bc===
17645 ==c==
17646 ===ca===
17647 !! html/php
17648 !! end
17649
17650 !! test
17651 Section extraction test with bogus heading (section 1)
17652 !! options
17653 section=1
17654 !! wikitext
17655 ==a==
17656 ==bogus== not a legal section
17657 ==b==
17658 !! html/php
17659 ==a==
17660 ==bogus== not a legal section
17661 !! end
17662
17663 !! test
17664 Section extraction test with bogus heading (section 2)
17665 !! options
17666 section=2
17667 !! wikitext
17668 ==a==
17669 ==bogus== not a legal section
17670 ==b==
17671 !! html/php
17672 ==b==
17673 !! end
17674
17675 !! test
17676 Section extraction test with comment after heading (section 1)
17677 !! options
17678 section=1
17679 !! wikitext
17680 ==a==
17681 ==b== <!-- -->
17682 ==c==
17683 !! html/php
17684 ==a==
17685 !! end
17686
17687 !! test
17688 Section extraction test with comment after heading (section 2)
17689 !! options
17690 section=2
17691 !! wikitext
17692 ==a==
17693 ==b== <!-- -->
17694 ==c==
17695 !! html/php
17696 ==b== <!-- -->
17697 !! end
17698
17699 !! test
17700 Section extraction test with bogus <nowiki> heading (section 1)
17701 !! options
17702 section=1
17703 !! wikitext
17704 ==a==
17705 ==bogus== <nowiki>not a legal section</nowiki>
17706 ==b==
17707 !! html/php
17708 ==a==
17709 ==bogus== <nowiki>not a legal section</nowiki>
17710 !! end
17711
17712 !! test
17713 Section extraction test with bogus <nowiki> heading (section 2)
17714 !! options
17715 section=2
17716 !! wikitext
17717 ==a==
17718 ==bogus== <nowiki>not a legal section</nowiki>
17719 ==b==
17720 !! html/php
17721 ==b==
17722 !! end
17723
17724 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17725 # instead of respecting commented sections
17726 !! test
17727 Section extraction prefixed by comment (section 1)
17728 !! options
17729 section=1
17730 !! wikitext
17731 <!-- -->==sec1==
17732 ==sec2==
17733 !! html/php
17734 ==sec2==
17735 !!end
17736
17737 !! test
17738 Section extraction prefixed by comment (section 2)
17739 !! options
17740 section=2
17741 !! wikitext
17742 <!-- -->==sec1==
17743 ==sec2==
17744 !! html/php
17745
17746 !!end
17747
17748 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17749 # instead of respecting HTML-style headings
17750 !! test
17751 Section extraction, mixed wiki and html (section 1)
17752 !! options
17753 section=1
17754 !! wikitext
17755 <h2>unmarked</h2>
17756 unmarked
17757 ==1==
17758 one
17759 ==2==
17760 two
17761 !! html/php
17762 ==1==
17763 one
17764 !! end
17765
17766 !! test
17767 Section extraction, mixed wiki and html (section 2)
17768 !! options
17769 section=2
17770 !! wikitext
17771 <h2>unmarked</h2>
17772 unmarked
17773 ==1==
17774 one
17775 ==2==
17776 two
17777 !! html/php
17778 ==2==
17779 two
17780 !! end
17781
17782
17783 # Formerly testing for bug 3342
17784 !! test
17785 Section extraction, heading surrounded by <noinclude>
17786 !! options
17787 section=1
17788 !! wikitext
17789 <noinclude>==unmarked==</noinclude>
17790 ==marked==
17791 !! html/php
17792 ==marked==
17793 !!end
17794
17795 # Test behavior of bug 19910
17796 !! test
17797 Sectiion with all-equals
17798 !! options
17799 section=2
17800 !! wikitext
17801 ===
17802 The line above must have a trailing space
17803 === <!--
17804 --> <!-- -->
17805 But just in case it doesn't...
17806 !! html/php
17807 === <!--
17808 --> <!-- -->
17809 But just in case it doesn't...
17810 !! end
17811
17812 !! test
17813 Section replacement test (section 0)
17814 !! options
17815 replace=0,"xxx"
17816 !! wikitext
17817 start
17818 ==a==
17819 ===aa===
17820 ====aaa====
17821 ==b==
17822 ===ba===
17823 ===bb===
17824 ====bba====
17825 ===bc===
17826 ==c==
17827 ===ca===
17828 !! html/php
17829 xxx
17830
17831 ==a==
17832 ===aa===
17833 ====aaa====
17834 ==b==
17835 ===ba===
17836 ===bb===
17837 ====bba====
17838 ===bc===
17839 ==c==
17840 ===ca===
17841 !! end
17842
17843 !! test
17844 Section replacement test (section 1)
17845 !! options
17846 replace=1,"xxx"
17847 !! wikitext
17848 start
17849 ==a==
17850 ===aa===
17851 ====aaa====
17852 ==b==
17853 ===ba===
17854 ===bb===
17855 ====bba====
17856 ===bc===
17857 ==c==
17858 ===ca===
17859 !! html/php
17860 start
17861 xxx
17862
17863 ==b==
17864 ===ba===
17865 ===bb===
17866 ====bba====
17867 ===bc===
17868 ==c==
17869 ===ca===
17870 !! end
17871
17872 !! test
17873 Section replacement test (section 2)
17874 !! options
17875 replace=2,"xxx"
17876 !! wikitext
17877 start
17878 ==a==
17879 ===aa===
17880 ====aaa====
17881 ==b==
17882 ===ba===
17883 ===bb===
17884 ====bba====
17885 ===bc===
17886 ==c==
17887 ===ca===
17888 !! html/php
17889 start
17890 ==a==
17891 xxx
17892
17893 ==b==
17894 ===ba===
17895 ===bb===
17896 ====bba====
17897 ===bc===
17898 ==c==
17899 ===ca===
17900 !! end
17901
17902 !! test
17903 Section replacement test (section 3)
17904 !! options
17905 replace=3,"xxx"
17906 !! wikitext
17907 start
17908 ==a==
17909 ===aa===
17910 ====aaa====
17911 ==b==
17912 ===ba===
17913 ===bb===
17914 ====bba====
17915 ===bc===
17916 ==c==
17917 ===ca===
17918 !! html/php
17919 start
17920 ==a==
17921 ===aa===
17922 xxx
17923
17924 ==b==
17925 ===ba===
17926 ===bb===
17927 ====bba====
17928 ===bc===
17929 ==c==
17930 ===ca===
17931 !! end
17932
17933 !! test
17934 Section replacement test (section 4)
17935 !! options
17936 replace=4,"xxx"
17937 !! wikitext
17938 start
17939 ==a==
17940 ===aa===
17941 ====aaa====
17942 ==b==
17943 ===ba===
17944 ===bb===
17945 ====bba====
17946 ===bc===
17947 ==c==
17948 ===ca===
17949 !! html/php
17950 start
17951 ==a==
17952 ===aa===
17953 ====aaa====
17954 xxx
17955
17956 ==c==
17957 ===ca===
17958 !! end
17959
17960 !! test
17961 Section replacement test (section 5)
17962 !! options
17963 replace=5,"xxx"
17964 !! wikitext
17965 start
17966 ==a==
17967 ===aa===
17968 ====aaa====
17969 ==b==
17970 ===ba===
17971 ===bb===
17972 ====bba====
17973 ===bc===
17974 ==c==
17975 ===ca===
17976 !! html/php
17977 start
17978 ==a==
17979 ===aa===
17980 ====aaa====
17981 ==b==
17982 xxx
17983
17984 ===bb===
17985 ====bba====
17986 ===bc===
17987 ==c==
17988 ===ca===
17989 !! end
17990
17991 !! test
17992 Section replacement test (section 6)
17993 !! options
17994 replace=6,"xxx"
17995 !! wikitext
17996 start
17997 ==a==
17998 ===aa===
17999 ====aaa====
18000 ==b==
18001 ===ba===
18002 ===bb===
18003 ====bba====
18004 ===bc===
18005 ==c==
18006 ===ca===
18007 !! html/php
18008 start
18009 ==a==
18010 ===aa===
18011 ====aaa====
18012 ==b==
18013 ===ba===
18014 xxx
18015
18016 ===bc===
18017 ==c==
18018 ===ca===
18019 !! end
18020
18021 !! test
18022 Section replacement test (section 7)
18023 !! options
18024 replace=7,"xxx"
18025 !! wikitext
18026 start
18027 ==a==
18028 ===aa===
18029 ====aaa====
18030 ==b==
18031 ===ba===
18032 ===bb===
18033 ====bba====
18034 ===bc===
18035 ==c==
18036 ===ca===
18037 !! html/php
18038 start
18039 ==a==
18040 ===aa===
18041 ====aaa====
18042 ==b==
18043 ===ba===
18044 ===bb===
18045 xxx
18046
18047 ===bc===
18048 ==c==
18049 ===ca===
18050 !! end
18051
18052 !! test
18053 Section replacement test (section 8)
18054 !! options
18055 replace=8,"xxx"
18056 !! wikitext
18057 start
18058 ==a==
18059 ===aa===
18060 ====aaa====
18061 ==b==
18062 ===ba===
18063 ===bb===
18064 ====bba====
18065 ===bc===
18066 ==c==
18067 ===ca===
18068 !! html/php
18069 start
18070 ==a==
18071 ===aa===
18072 ====aaa====
18073 ==b==
18074 ===ba===
18075 ===bb===
18076 ====bba====
18077 xxx
18078
18079 ==c==
18080 ===ca===
18081 !!end
18082
18083 !! test
18084 Section replacement test (section 9)
18085 !! options
18086 replace=9,"xxx"
18087 !! wikitext
18088 start
18089 ==a==
18090 ===aa===
18091 ====aaa====
18092 ==b==
18093 ===ba===
18094 ===bb===
18095 ====bba====
18096 ===bc===
18097 ==c==
18098 ===ca===
18099 !! html/php
18100 start
18101 ==a==
18102 ===aa===
18103 ====aaa====
18104 ==b==
18105 ===ba===
18106 ===bb===
18107 ====bba====
18108 ===bc===
18109 xxx
18110 !! end
18111
18112 !! test
18113 Section replacement test (section 10)
18114 !! options
18115 replace=10,"xxx"
18116 !! wikitext
18117 start
18118 ==a==
18119 ===aa===
18120 ====aaa====
18121 ==b==
18122 ===ba===
18123 ===bb===
18124 ====bba====
18125 ===bc===
18126 ==c==
18127 ===ca===
18128 !! html/php
18129 start
18130 ==a==
18131 ===aa===
18132 ====aaa====
18133 ==b==
18134 ===ba===
18135 ===bb===
18136 ====bba====
18137 ===bc===
18138 ==c==
18139 xxx
18140 !! end
18141
18142 !! test
18143 Section replacement test with initial whitespace (bug 13728)
18144 !! options
18145 replace=2,"xxx"
18146 !! wikitext
18147 Preformatted initial line
18148 ==a==
18149 ===a===
18150 !! html/php
18151 Preformatted initial line
18152 ==a==
18153 xxx
18154 !! end
18155
18156
18157 !! test
18158 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18159 !! options
18160 section=1
18161 !! wikitext
18162 ==a==
18163 a
18164 !! html/php
18165 ==a==
18166 a
18167 !! end
18168
18169 !! test
18170 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18171 !! options
18172 section=1
18173 !! wikitext
18174 ==a==
18175 a
18176 !! html/php
18177 ==a==
18178 a
18179 !! end
18180
18181
18182 !! test
18183 Section extraction, <pre> around bogus header (bug 10309)
18184 !! options
18185 noxml section=2
18186 !! wikitext
18187 == Section One ==
18188 <pre>
18189 =======
18190 </pre>
18191
18192 == Section Two ==
18193 stuff
18194 !! html/php
18195 == Section Two ==
18196 stuff
18197 !! end
18198
18199 !! test
18200 Section replacement, <pre> around bogus header (bug 10309)
18201 !! options
18202 noxml replace=2,"xxx"
18203 !! wikitext
18204 == Section One ==
18205 <pre>
18206 =======
18207 </pre>
18208
18209 == Section Two ==
18210 stuff
18211 !! html/php
18212 == Section One ==
18213 <pre>
18214 =======
18215 </pre>
18216
18217 xxx
18218 !! end
18219
18220
18221 !! test
18222 Handling of &#x0A; in URLs
18223 !! wikitext
18224 ** irc://&#x0A;a
18225 !! html/php
18226 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18227
18228 !! html/parsoid
18229 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18230 a">irc://
18231 a</a></li></ul></li></ul>
18232 !! end
18233
18234 !! test
18235 Handling of %0A in URLs
18236 !! wikitext
18237 ** irc://%0Aa
18238 !! html/php
18239 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18240
18241 !! html/parsoid
18242 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18243 !! end
18244
18245
18246 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18247 !! test
18248 5 quotes, code coverage +1 line
18249 !! options
18250 parsoid=wt2html
18251 !! wikitext
18252 '''''
18253 !! html/php
18254 !! html/parsoid
18255 <p><b><i></i></b></p>
18256 !! end
18257
18258 # same html as previous, but wikitext adjusted to match parsoid html2wt
18259 # note that wt2html and html2html will put the <i> before the <b>
18260 !! test
18261 5 quotes, code coverage +1 line w/ nowiki (1)
18262 !! options
18263 parsoid=wt2wt,html2wt
18264 !! wikitext
18265 '''''<nowiki/>'''''
18266 !! html/php
18267 <p><i></i>
18268 </p>
18269 !! html/parsoid
18270 <p><b><i></i></b></p>
18271 !! end
18272
18273 # same as previous, just swapping the <i> and <b>
18274 !! test
18275 5 quotes, code coverage +1 line w/ nowiki (2)
18276 !! wikitext
18277 '''''<nowiki/>'''''
18278 !! html/php
18279 <p><i></i>
18280 </p>
18281 !! html/parsoid
18282 <p><i><b></b></i></p>
18283 !! end
18284
18285 !! test
18286 Special:Search page linking.
18287 !! wikitext
18288 {{Special:search}}
18289 !! html
18290 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18291 </p>
18292 !! end
18293
18294 !! test
18295 {{!}} is a magic word
18296 !! wikitext
18297 {{!}} is a magic word there and {{!}} is still a magic word here
18298 | is not a magic word here but {{!}} is still a magic word here
18299 !! html/php
18300 <p>| 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 </p>
18303 !! html/parsoid
18304 <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
18305 | 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>
18306
18307 !! end
18308
18309 !! test
18310 Say the magic word
18311 !! options
18312 title=[[Parser test]]
18313 !! wikitext
18314 * {{PAGENAME}}
18315 * {{PAGENAMEE}}
18316 * {{FULLPAGENAME}}
18317 * {{FULLPAGENAMEE}}
18318 * {{BASEPAGENAME}}
18319 * {{BASEPAGENAMEE}}
18320 * {{SUBPAGENAME}}
18321 * {{SUBPAGENAMEE}}
18322 * {{ROOTPAGENAME}}
18323 * {{ROOTPAGENAMEE}}
18324 * {{TALKPAGENAME}}
18325 * {{TALKPAGENAMEE}}
18326 * {{SUBJECTPAGENAME}}
18327 * {{SUBJECTPAGENAMEE}}
18328 * {{NAMESPACEE}}
18329 * {{NAMESPACE}}
18330 * {{NAMESPACENUMBER}}
18331 * {{TALKSPACE}}
18332 * {{TALKSPACEE}}
18333 * {{SUBJECTSPACE}}
18334 * {{SUBJECTSPACEE}}
18335 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18336 !! html
18337 <ul><li> Parser test</li>
18338 <li> Parser_test</li>
18339 <li> Parser test</li>
18340 <li> Parser_test</li>
18341 <li> Parser test</li>
18342 <li> Parser_test</li>
18343 <li> Parser test</li>
18344 <li> Parser_test</li>
18345 <li> Parser test</li>
18346 <li> Parser_test</li>
18347 <li> Talk:Parser test</li>
18348 <li> Talk:Parser_test</li>
18349 <li> Parser test</li>
18350 <li> Parser_test</li>
18351 <li> </li>
18352 <li> </li>
18353 <li> 0</li>
18354 <li> Talk</li>
18355 <li> Talk</li>
18356 <li> </li>
18357 <li> </li>
18358 <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>
18359
18360 !! end
18361 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18362
18363 !! test
18364 Gallery
18365 !! wikitext
18366 <gallery>
18367 image1.png |
18368 image2.gif|||||
18369
18370 image3|
18371 image4 |300px| centre
18372 image5.svg| http://///////
18373 [[x|xx]]]]
18374 * image6
18375 </gallery>
18376 !! html
18377 <ul class="gallery mw-gallery-traditional">
18378 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18379 <div class="thumb" style="height: 150px;">Image1.png</div>
18380 <div class="gallerytext">
18381 </div>
18382 </div></li>
18383 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18384 <div class="thumb" style="height: 150px;">Image2.gif</div>
18385 <div class="gallerytext">
18386 </div>
18387 </div></li>
18388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18389 <div class="thumb" style="height: 150px;">Image3</div>
18390 <div class="gallerytext">
18391 </div>
18392 </div></li>
18393 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18394 <div class="thumb" style="height: 150px;">Image4</div>
18395 <div class="gallerytext">
18396 <pre>centre
18397 </pre>
18398 </div>
18399 </div></li>
18400 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18401 <div class="thumb" style="height: 150px;">Image5.svg</div>
18402 <div class="gallerytext">
18403 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18404 </p>
18405 </div>
18406 </div></li>
18407 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18408 <div class="thumb" style="height: 150px;">* image6</div>
18409 <div class="gallerytext">
18410 </div>
18411 </div></li>
18412 </ul>
18413
18414 !! end
18415
18416 !! test
18417 Gallery (with options)
18418 !! wikitext
18419 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18420 File:Nonexistent.jpg|caption
18421 File:Nonexistent.jpg
18422 image:foobar.jpg|some '''caption''' [[Main Page]]
18423 image:foobar.jpg
18424 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18425 </gallery>
18426 !! html
18427 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18428 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18429 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18430 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18431 <div class="gallerytext">
18432 <p>caption
18433 </p>
18434 </div>
18435 </div></li>
18436 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18437 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18438 <div class="gallerytext">
18439 </div>
18440 </div></li>
18441 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18442 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
18443 <div class="gallerytext">
18444 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18445 </p>
18446 </div>
18447 </div></li>
18448 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18449 <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>
18450 <div class="gallerytext">
18451 </div>
18452 </div></li>
18453 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18454 <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>
18455 <div class="gallerytext">
18456 <p>blabla.
18457 </p>
18458 </div>
18459 </div></li>
18460 </ul>
18461
18462 !! end
18463
18464 !! test
18465 Gallery with link that has fragment
18466 !! wikitext
18467 <gallery>
18468 image:foobar.jpg|link=Main_Page
18469 image:foobar.jpg|link=Main_Page#section
18470 image:foobar.jpg|link=Main Page#section|caption
18471 </gallery>
18472 !! html
18473 <ul class="gallery mw-gallery-traditional">
18474 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18475 <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>
18476 <div class="gallerytext">
18477 </div>
18478 </div></li>
18479 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18480 <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>
18481 <div class="gallerytext">
18482 </div>
18483 </div></li>
18484 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18485 <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>
18486 <div class="gallerytext">
18487 <p>caption
18488 </p>
18489 </div>
18490 </div></li>
18491 </ul>
18492
18493 !! end
18494
18495 !! test
18496 Gallery with wikitext inside caption
18497 !! wikitext
18498 <gallery>
18499 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18500 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18501 </gallery>
18502 !! html
18503 <ul class="gallery mw-gallery-traditional">
18504 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18505 <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>
18506 <div class="gallerytext">
18507 <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>
18508 </p>
18509 </div>
18510 </div></li>
18511 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18512 <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>
18513 <div class="gallerytext">
18514 <p>This is a test template
18515 </p>
18516 </div>
18517 </div></li>
18518 </ul>
18519
18520 !! end
18521
18522 !! test
18523 gallery (with showfilename option)
18524 !! wikitext
18525 <gallery showfilename>
18526 File:Nonexistent.jpg|caption
18527 File:Nonexistent.jpg
18528 image:foobar.jpg|some '''caption''' [[Main Page]]
18529 File:Foobar.jpg
18530 </gallery>
18531 !! html
18532 <ul class="gallery mw-gallery-traditional">
18533 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18534 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18535 <div class="gallerytext">
18536 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18537 caption
18538 </p>
18539 </div>
18540 </div></li>
18541 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18542 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18543 <div class="gallerytext">
18544 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18545 </p>
18546 </div>
18547 </div></li>
18548 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18549 <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>
18550 <div class="gallerytext">
18551 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18552 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18553 </p>
18554 </div>
18555 </div></li>
18556 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18557 <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>
18558 <div class="gallerytext">
18559 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18560 </p>
18561 </div>
18562 </div></li>
18563 </ul>
18564
18565 !! end
18566
18567 !! test
18568 Gallery (with namespace-less filenames)
18569 !! wikitext
18570 <gallery>
18571 File:Nonexistent.jpg
18572 Nonexistent.jpg
18573 image:foobar.jpg
18574 foobar.jpg
18575 </gallery>
18576 !! html
18577 <ul class="gallery mw-gallery-traditional">
18578 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18579 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18580 <div class="gallerytext">
18581 </div>
18582 </div></li>
18583 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18584 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18585 <div class="gallerytext">
18586 </div>
18587 </div></li>
18588 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18589 <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>
18590 <div class="gallerytext">
18591 </div>
18592 </div></li>
18593 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18594 <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>
18595 <div class="gallerytext">
18596 </div>
18597 </div></li>
18598 </ul>
18599
18600 !! end
18601
18602 !! test
18603 HTML Hex character encoding (spells the word "JavaScript")
18604 !! options
18605 parsoid=wt2html,wt2wt,html2html
18606 !! wikitext
18607 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18608 !! html/php
18609 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18610 </p>
18611 !! html/php+tidy
18612 <p>JavaScript</p>
18613 !! html/parsoid
18614 <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>
18615 !! end
18616
18617 !! test
18618 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18619 !! wikitext
18620 &#xsee;&#XSEE;
18621 !! html/php
18622 <p>&amp;#xsee;&amp;#XSEE;
18623 </p>
18624 !! html/parsoid
18625 <p>&amp;#xsee;&amp;#XSEE;</p>
18626 !! end
18627
18628 !! test
18629 HTML Hex character encoding mixed case
18630 !! options
18631 parsoid=wt2html,wt2wt,html2html
18632 !! wikitext
18633 &#xEE;&#Xee;
18634 !! html/php
18635 <p>&#xee;&#xee;
18636 </p>
18637 !! html/php+tidy
18638 <p>îî</p>
18639 !! html/parsoid
18640 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18641 !! end
18642
18643 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18644 # Note that U+000C (form feed) is not a valid XML character, so
18645 # it is banned even though allowed in HTML5.
18646 !! test
18647 Illegal character references (T106578)
18648 !! wikitext
18649 ; Null: &#00;
18650 ; FF: &#xC;
18651 ; CR: &#xD;
18652 ; Control (low): &#8;
18653 ; Control (high): &#x7F; &#x9F;
18654 ; Surrogate: &#xD83D;&#xDCA9;
18655 ; This is an okay astral character: &#x1F4A9;
18656 !! html+tidy
18657 <dl>
18658 <dt>Null</dt>
18659 <dd>&amp;#00;</dd>
18660 <dt>FF</dt>
18661 <dd>&amp;#xC;</dd>
18662 <dt>CR</dt>
18663 <dd>&amp;#xD;</dd>
18664 <dt>Control (low)</dt>
18665 <dd>&amp;#8;</dd>
18666 <dt>Control (high)</dt>
18667 <dd>&amp;#x7F; &amp;#x9F;</dd>
18668 <dt>Surrogate</dt>
18669 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18670 <dt>This is an okay astral character</dt>
18671 <dd>💩</dd>
18672 </dl>
18673 !! end
18674
18675 !! test
18676 __FORCETOC__ override
18677 !! wikitext
18678 __NEWSECTIONLINK__
18679 __FORCETOC__
18680 !! html/php
18681 <p><br />
18682 </p>
18683 !! end
18684
18685 !! test
18686 ISBN code coverage
18687 !! wikitext
18688 ISBN 978-0-1234-56&#x20;789
18689 !! html
18690 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18691 </p>
18692 !! html+tidy
18693 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18694 !! html/parsoid
18695 <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>
18696 !! end
18697
18698 !! test
18699 ISBN followed by 5 spaces
18700 !! wikitext
18701 ISBN
18702 !! html
18703 <p>ISBN
18704 </p>
18705 !! end
18706
18707 !! test
18708 Double ISBN
18709 !! wikitext
18710 ISBN ISBN 1234567890
18711 !! html/php
18712 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18713 </p>
18714 !! html/parsoid
18715 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18716 !! end
18717
18718 # Uppercase X and lowercase x as well
18719 !! test
18720 ISBN with an X
18721 !! wikitext
18722 ISBN 3-462-04561-X
18723 ISBN 3-462-04561-x
18724 ISBN 080442957X
18725 ISBN 080442957x
18726 ISBN 978080442957X
18727 ISBN 978080442957x
18728 !! html/php
18729 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18730 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18731 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18732 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18733 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18734 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18735 </p>
18736 !! html/parsoid
18737 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18738 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18739 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18740 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18741 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18742 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18743 !! end
18744
18745 !! test
18746 ISBN with empty prefix (parsoid test)
18747 !! wikitext
18748 ISBN 1234567890
18749 !! html/php
18750 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18751 </p>
18752 !! html/parsoid
18753 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18754 !! end
18755
18756 !! test
18757 Bug 22905: <abbr> followed by ISBN followed by </a>
18758 !! wikitext
18759 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18760 !! html/php
18761 <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>
18762 </p>
18763 !! html/parsoid
18764 <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>
18765 !! end
18766
18767 !! test
18768 Double RFC
18769 !! wikitext
18770 RFC RFC 1234
18771 !! html
18772 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18773 </p>
18774 !! end
18775
18776 !! test
18777 Double RFC with a wiki link
18778 !! wikitext
18779 RFC [[RFC 1234]]
18780 !! html
18781 <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>
18782 </p>
18783 !! end
18784
18785 !! test
18786 RFC code coverage
18787 !! wikitext
18788 RFC 983&#x20;987
18789 !! html
18790 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18791 </p>
18792 !! html+tidy
18793 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18794 !! end
18795
18796 !! test
18797 Centre-aligned image
18798 !! wikitext
18799 [[Image:foobar.jpg|centre]]
18800 !! html
18801 <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>
18802
18803 !!end
18804
18805 !! test
18806 None-aligned image
18807 !! wikitext
18808 [[Image:foobar.jpg|none]]
18809 !! html
18810 <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>
18811
18812 !!end
18813
18814 !! test
18815 Width + Height sized image (using px) (height is ignored)
18816 !! wikitext
18817 [[Image:foobar.jpg|640x480px]]
18818 !! html
18819 <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>
18820 </p>
18821 !!end
18822
18823 !! test
18824 Width-sized image (using px, no following whitespace)
18825 !! wikitext
18826 [[Image:foobar.jpg|640px]]
18827 !! html
18828 <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>
18829 </p>
18830 !!end
18831
18832 !! test
18833 Width-sized image (using px, with following whitespace - test regression from r39467)
18834 !! wikitext
18835 [[Image:foobar.jpg|640px ]]
18836 !! html
18837 <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>
18838 </p>
18839 !!end
18840
18841 !! test
18842 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18843 !! wikitext
18844 [[Image:foobar.jpg| 640px]]
18845 !! html
18846 <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>
18847 </p>
18848 !!end
18849
18850 !! test
18851 Image with page parameter
18852 !! options
18853 djvu
18854 !! wikitext
18855 [[File:LoremIpsum.djvu|page=2]]
18856 !! html/php
18857 <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>
18858 </p>
18859 !! html/parsoid
18860 <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>
18861 !! end
18862
18863 !! test
18864 Another italics / bold test
18865 !! wikitext
18866 ''' ''x'
18867 !! html
18868 <pre>'<i> </i>x'
18869 </pre>
18870 !!end
18871
18872 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18873 !! test
18874 dt/dd/dl test
18875 !! wikitext
18876 :;;;::
18877 !! html/php
18878 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18879
18880 !! html/parsoid
18881 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18882
18883 !!end
18884
18885
18886 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18887 !! test
18888 Images with the "|" character in the comment
18889 !! wikitext
18890 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18891 !! html/php
18892 <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>
18893
18894 !! html/parsoid
18895 <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>
18896 !! end
18897
18898 !! test
18899 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18900 !! wikitext
18901 <html><script>alert(1);</script></html>
18902 !! html
18903 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18904 </p>
18905 !! end
18906
18907 !! test
18908 HTML with raw HTML ($wgRawHtml==true)
18909 !! options
18910 wgRawHtml=1
18911 !! wikitext
18912 <html><script>alert(1);</script></html>
18913 !! html
18914 <p><script>alert(1);</script>
18915 </p>
18916 !! end
18917
18918 !! test
18919 Parents of subpages, one level up
18920 !! options
18921 subpage title=[[Subpage test/L1/L2/L3]]
18922 !! wikitext
18923 [[../|L2]]
18924 !! html
18925 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
18926 </p>
18927 !! end
18928
18929
18930 !! test
18931 Parents of subpages, one level up, not named
18932 !! options
18933 subpage title=[[Subpage test/L1/L2/L3]]
18934 !! wikitext
18935 [[../]]
18936 !! html
18937 <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>
18938 </p>
18939 !! end
18940
18941
18942
18943 !! test
18944 Parents of subpages, two levels up
18945 !! options
18946 subpage title=[[Subpage test/L1/L2/L3]]
18947 !! wikitext
18948 [[../../|L1]]2
18949
18950 [[../../|L1]]l
18951 !! html
18952 <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
18953 </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>
18954 </p>
18955 !! end
18956
18957 !! test
18958 Parents of subpages, two levels up, without trailing slash or name.
18959 !! options
18960 subpage title=[[Subpage test/L1/L2/L3]]
18961 !! wikitext
18962 [[../..]]
18963 !! html
18964 <p>[[../..]]
18965 </p>
18966 !! end
18967
18968 !! test
18969 Parents of subpages, two levels up, with lots of extra trailing slashes.
18970 !! options
18971 subpage title=[[Subpage test/L1/L2/L3]]
18972 !! wikitext
18973 [[../../////]]
18974 !! html
18975 <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>
18976 </p>
18977 !! end
18978
18979 !! article
18980 Subpage test/L1/L2/L3Sibling
18981 !! text
18982 Sibling article
18983 !! endarticle
18984
18985 !! test
18986 Transclusion of a sibling page (one level up)
18987 !! options
18988 subpage title=[[Subpage test/L1/L2/L3]]
18989 !! wikitext
18990 {{../L3Sibling}}
18991 !! html
18992 <p>Sibling article
18993 </p>
18994 !! end
18995
18996 !! test
18997 Transclusion of a child page
18998 !! options
18999 subpage title=[[Subpage test/L1/L2]]
19000 !! wikitext
19001 {{/L3Sibling}}
19002 !! html
19003 <p>Sibling article
19004 </p>
19005 !! end
19006
19007 !! test
19008 Non-transclusion because of too many up levels
19009 !! options
19010 subpage title=[[Subpage test/L1/L2/L3]]
19011 !! wikitext
19012 {{../../../../More than parent}}
19013 !! html
19014 <p>{{../../../../More than parent}}
19015 </p>
19016 !! end
19017
19018 !! test
19019 Definition list code coverage
19020 !! wikitext
19021 ; title : def
19022 ; title : def
19023 ;title: def
19024 !! html/php
19025 <dl><dt> title &#160;</dt>
19026 <dd> def</dd>
19027 <dt> title&#160;</dt>
19028 <dd> def</dd>
19029 <dt>title</dt>
19030 <dd> def</dd></dl>
19031
19032 !! html/parsoid
19033 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19034 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19035 <dt>title</dt><dd> def</dd></dl>
19036 !! end
19037
19038 !! test
19039 Don't fall for the self-closing div
19040 !! wikitext
19041 <div>hello world</div/>
19042 !! html
19043 <div>hello world</div>
19044
19045 !! end
19046
19047 !! test
19048 MSGNW magic word
19049 !! wikitext
19050 {{MSGNW:msg}}
19051 !! html/php
19052 <p>&#91;&#91;:Template:Msg&#93;&#93;
19053 </p>
19054 !! end
19055
19056 !! test
19057 RAW magic word
19058 !! wikitext
19059 {{RAW:QUERTY}}
19060 !! html
19061 <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>
19062 </p>
19063 !! end
19064
19065 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19066 !! test
19067 Always escape literal '>' in output, not just after '<'
19068 !! wikitext
19069 ><>
19070 !! html
19071 <p>&gt;&lt;&gt;
19072 </p>
19073 !! end
19074
19075 !! test
19076 Template caching
19077 !! wikitext
19078 {{Test}}
19079 {{Test}}
19080 !! html
19081 <p>This is a test template
19082 This is a test template
19083 </p>
19084 !! end
19085
19086
19087 !! article
19088 MediaWiki:Fake
19089 !! text
19090 ==header==
19091 !! endarticle
19092
19093 !! test
19094 Inclusion of !userCanEdit() content
19095 !! wikitext
19096 {{MediaWiki:Fake}}
19097 !! html
19098 <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>
19099
19100 !! end
19101
19102
19103 !! test
19104 Out-of-order TOC heading levels
19105 !! wikitext
19106 ==2==
19107 ======6======
19108 ===3===
19109 =1=
19110 =====5=====
19111 ==2==
19112 !! html
19113 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19114 <ul>
19115 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19116 <ul>
19117 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19118 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19119 </ul>
19120 </li>
19121 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19122 <ul>
19123 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19124 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19125 </ul>
19126 </li>
19127 </ul>
19128 </div>
19129
19130 <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>
19131 <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>
19132 <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>
19133 <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>
19134 <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>
19135 <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>
19136
19137 !! end
19138
19139
19140 !! test
19141 ISBN with a dummy number
19142 !! wikitext
19143 ISBN ---
19144 !! html
19145 <p>ISBN ---
19146 </p>
19147 !! end
19148
19149
19150 !! test
19151 ISBN with space-delimited number
19152 !! wikitext
19153 ISBN 92 9017 032 8
19154 !! html
19155 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19156 </p>
19157 !! end
19158
19159
19160 !! test
19161 ISBN with multiple spaces, no number
19162 !! wikitext
19163 ISBN foo
19164 !! html
19165 <p>ISBN foo
19166 </p>
19167 !! end
19168
19169
19170 !! test
19171 ISBN length
19172 !! wikitext
19173 ISBN 123456789
19174
19175 ISBN 1234567890
19176
19177 ISBN 12345678901
19178 !! html
19179 <p>ISBN 123456789
19180 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19181 </p><p>ISBN 12345678901
19182 </p>
19183 !! end
19184
19185
19186 !! test
19187 ISBN with trailing year (bug 8110)
19188 !! wikitext
19189 ISBN 1-234-56789-0 - 2006
19190
19191 ISBN 1 234 56789 0 - 2006
19192 !! html
19193 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19194 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19195 </p>
19196 !! end
19197
19198
19199 !! test
19200 anchorencode
19201 !! wikitext
19202 {{anchorencode:foo bar©#%n}}
19203 !! html
19204 <p>foo_bar.C2.A9.23.25n
19205 </p>
19206 !! end
19207
19208 !! test
19209 anchorencode trims spaces
19210 !! wikitext
19211 {{anchorencode: __pretty__please__}}
19212 !! html
19213 <p>pretty_please
19214 </p>
19215 !! end
19216
19217 !! test
19218 anchorencode deals with links
19219 !! wikitext
19220 {{anchorencode: [[hello|world]] [[hi]]}}
19221 !! html
19222 <p>world_hi
19223 </p>
19224 !! end
19225
19226 !! test
19227 anchorencode deals with templates
19228 !! wikitext
19229 {{anchorencode: {{Foo}} }}
19230 !! html
19231 <p>FOO
19232 </p>
19233 !! end
19234
19235 !! test
19236 anchorencode encodes like the TOC generator: (bug 18431)
19237 !! wikitext
19238 === _ +:.3A%3A&&amp;]] ===
19239 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19240 __NOEDITSECTION__
19241 !! html
19242 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19243 <p>.2B:.3A.253A.26.26.5D.5D
19244 </p>
19245 !! end
19246
19247 !! test
19248 Bug 6200: blockquotes and paragraph formatting
19249 !! wikitext
19250 <blockquote>
19251 foo
19252 </blockquote>
19253
19254 bar
19255
19256 baz
19257 !! html
19258 <blockquote>
19259 <p>foo
19260 </p>
19261 </blockquote>
19262 <p>bar
19263 </p>
19264 <pre>baz
19265 </pre>
19266 !! end
19267
19268 !! test
19269 Bug 8293: Use of center tag ruins paragraph formatting
19270 !! wikitext
19271 <center>
19272 foo
19273 </center>
19274
19275 bar
19276
19277 baz
19278 !! html
19279 <center>
19280 <p>foo
19281 </p>
19282 </center>
19283 <p>bar
19284 </p>
19285 <pre>baz
19286 </pre>
19287 !! end
19288
19289 !!test
19290 Parsing of overlapping (improperly nested) inline html tags
19291 !! wikitext
19292 <span><s>x</span></s>
19293 !! html/php
19294 <p><span><s>x&lt;/span&gt;</s></span>
19295 </p>
19296 !! html/parsoid
19297 <p><span><s>x</s></span>
19298 </p>
19299 !!end
19300
19301 ###
19302 ### Language variants related tests
19303 ###
19304 !! test
19305 Self-link in language variants
19306 !! options
19307 title=[[Dunav]] language=sr
19308 !! wikitext
19309 Both [[Dunav]] and [[Дунав]] are names for this river.
19310 !! html
19311 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19312 </p>
19313 !!end
19314
19315 !! article
19316 Дуна
19317 !! text
19318 content
19319 !! endarticle
19320
19321 !! test
19322 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19323 !! options
19324 title=[[Duna]] language=sr
19325 !! wikitext
19326 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19327 !! html
19328 <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.
19329 </p>
19330 !! end
19331
19332 !! test
19333 Link to a section of a variant of this title shouldn't be parsed as self-link
19334 !! options
19335 title=[[Duna]] language=sr
19336 !! wikitext
19337 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19338 !! html
19339 <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.
19340 </p>
19341 !! end
19342
19343 !! test
19344 Link to pages in language variants
19345 !! options
19346 language=sr
19347 !! wikitext
19348 Main Page can be written as [[Маин Паге]]
19349 !! html
19350 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19351 </p>
19352 !!end
19353
19354
19355 !! test
19356 Multiple links to pages in language variants
19357 !! options
19358 language=sr
19359 !! wikitext
19360 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19361 !! html
19362 <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>.
19363 </p>
19364 !!end
19365
19366
19367 !! test
19368 Simple template in language variants
19369 !! options
19370 language=sr
19371 !! wikitext
19372 {{тест}}
19373 !! html
19374 <p>This is a test template
19375 </p>
19376 !! end
19377
19378
19379 !! test
19380 Template with explicit namespace in language variants
19381 !! options
19382 language=sr
19383 !! wikitext
19384 {{Template:тест}}
19385 !! html
19386 <p>This is a test template
19387 </p>
19388 !! end
19389
19390
19391 !! test
19392 Basic test for template parameter in language variants
19393 !! options
19394 language=sr
19395 !! wikitext
19396 {{парамтест|param=foo}}
19397 !! html
19398 <p>This is a test template with parameter foo
19399 </p>
19400 !! end
19401
19402
19403 !! test
19404 Simple category in language variants
19405 !! options
19406 language=sr cat
19407 !! wikitext
19408 [[Category:МедиаWики Усер'с Гуиде]]
19409 !! html
19410 <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>
19411 !! end
19412
19413
19414 !! article
19415 Category:分类
19416 !! text
19417 blah
19418 !! endarticle
19419
19420 !! article
19421 Category:分類
19422 !! text
19423 blah
19424 !! endarticle
19425
19426 ## We used to, but no longer wt2wt this test since the default serializer
19427 ## will normalize all categories to serialize on their own line.
19428 ## This wikitext usage is going to be fairly uncommon in production and
19429 ## selser will take care of preserving formatting in those scenarios.
19430 !! test
19431 Don't convert blue categorylinks to another variant (bug 33210)
19432 !! options
19433 cat
19434 language=zh
19435 parsoid=wt2html
19436 !! wikitext
19437 [[A]][[Category:分类]]
19438 !! html/php
19439 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19440 !! html/parsoid
19441 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19442 <link rel="mw:PageProp/Category" href="Category:分类"/>
19443 !! end
19444
19445 !! test
19446 Stripping -{}- tags (language variants)
19447 !! options
19448 language=sr
19449 !! wikitext
19450 Latin proverb: -{Ne nuntium necare}-
19451 !! html
19452 <p>Latin proverb: Ne nuntium necare
19453 </p>
19454 !! end
19455
19456
19457 !! test
19458 Prevent conversion with -{}- tags (language variants)
19459 !! options
19460 language=sr variant=sr-ec
19461 !! wikitext
19462 Latinski: -{Ne nuntium necare}-
19463 !! html
19464 <p>Латински: Ne nuntium necare
19465 </p>
19466 !! end
19467
19468
19469 !! test
19470 Prevent conversion of text with -{}- tags (language variants)
19471 !! options
19472 language=sr variant=sr-ec
19473 !! wikitext
19474 Latinski: -{Ne nuntium necare}-
19475 !! html
19476 <p>Латински: Ne nuntium necare
19477 </p>
19478 !! end
19479
19480
19481 !! test
19482 Prevent conversion of links with -{}- tags (language variants)
19483 !! options
19484 language=sr variant=sr-ec
19485 !! wikitext
19486 -{[[Main Page]]}-
19487 !! html
19488 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19489 </p>
19490 !! end
19491
19492
19493 !! test
19494 -{}- tags within headlines (within html for parserConvert())
19495 !! options
19496 language=sr variant=sr-ec
19497 !! wikitext
19498 == -{Naslov}- ==
19499 !! html
19500 <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>
19501
19502 !! end
19503
19504
19505 !! test
19506 Explicit definition of language variant alternatives
19507 !! options
19508 language=zh variant=zh-tw
19509 !! wikitext
19510 -{zh:China;zh-tw:Taiwan}-, not China
19511 !! html
19512 <p>Taiwan, not China
19513 </p>
19514 !! end
19515
19516
19517 !! test
19518 Conversion around HTML tags
19519 !! options
19520 language=sr variant=sr-ec
19521 !! wikitext
19522 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19523 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19524 !! html
19525 <p>
19526 <span title="ЛаCтин">ски</span>
19527 </p>
19528 !! end
19529
19530
19531 !! test
19532 Explicit session-wise language variant mapping (A flag and - flag)
19533 !! options
19534 language=zh variant=zh-tw
19535 !! wikitext
19536 Taiwan is not China.
19537 But -{A|zh:China;zh-tw:Taiwan}- is China,
19538 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19539 and -{China}- is China.
19540 !! html
19541 <p>Taiwan is not China.
19542 But Taiwan is Taiwan,
19543 (This should be stripped!)
19544 and China is China.
19545 </p>
19546 !! end
19547
19548 !! test
19549 Explicit session-wise language variant mapping (H flag for hide)
19550 !! options
19551 language=zh variant=zh-tw
19552 !! wikitext
19553 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19554 Taiwan is China.
19555 !! html
19556 <p>(This should be stripped!)
19557 Taiwan is Taiwan.
19558 </p>
19559 !! end
19560
19561 !! test
19562 Adding explicit conversion rule for title (T flag)
19563 !! options
19564 language=zh variant=zh-tw showtitle
19565 !! wikitext
19566 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19567 !! html
19568 Taiwan
19569 <p>Should be stripped!
19570 </p>
19571 !! end
19572
19573 !! test
19574 Testing that changing the language variant here in the tests actually works
19575 !! options
19576 language=zh variant=zh showtitle
19577 !! wikitext
19578 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19579 !! html
19580 China
19581 <p>Should be stripped!
19582 </p>
19583 !! end
19584
19585 !! test
19586 Recursive conversion of alt and title attrs shouldn't clear converter state
19587 !! options
19588 language=zh variant=zh-cn showtitle
19589 !! wikitext
19590 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19591 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19592 !! html
19593 China
19594 <p>
19595 Should be stripped<span title="Exclamation">!</span>
19596 </p>
19597 !! end
19598
19599 !! test
19600 Bug 24072: more test on conversion rule for title
19601 !! options
19602 language=zh variant=zh-tw showtitle
19603 !! wikitext
19604 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19605 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19606 !! html
19607 Taiwan
19608 <p>This should be stripped!
19609 This won't take interferes with the title rule.
19610 </p>
19611 !! end
19612
19613 !! test
19614 Partly disable title conversion if variant == main language code
19615 !! options
19616 language=zh variant=zh title=[[ZH]] showtitle
19617 !! wikitext
19618 -{T|zh-cn:CN;zh-tw:TW}-
19619 !! html
19620 ZH
19621 <p>
19622 </p>
19623 !! end
19624
19625 !! test
19626 Partly disable title conversion if variant == main language code, more
19627 !! options
19628 language=zh variant=zh title=[[ZH]] showtitle
19629 !! wikitext
19630 -{T|TW}-
19631 !! html
19632 ZH
19633 <p>
19634 </p>
19635 !! end
19636
19637 !! test
19638 Raw output of variant escape tags (R flag)
19639 !! options
19640 language=zh variant=zh-tw
19641 !! wikitext
19642 Raw: -{R|zh:China;zh-tw:Taiwan}-
19643 !! html
19644 <p>Raw: zh:China;zh-tw:Taiwan
19645 </p>
19646 !! end
19647
19648 !! test
19649 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19650 !! options
19651 language=zh variant=zh-cn
19652 !! input
19653 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19654 !! result
19655 <p>0
19656 </p>
19657 !! end
19658
19659 !! test
19660 Conversion rules from [numeric-only string] to [something else] (T48634)
19661 !! options
19662 language=zh variant=zh-cn
19663 !! input
19664 -{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
19665 !! result
19666 <p>D12345EE12345
19667 </p>
19668 !! end
19669
19670 !! test
19671 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19672 !! options
19673 language=zh variant=zh-cn
19674 !! input
19675 -{H|zh-cn:foo;zh-tw:;}-foobar
19676 !! result
19677 <p>foobar
19678 </p>
19679 !! end
19680
19681 !! test
19682 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19683 !! options
19684 language=zh variant=zh-cn
19685 !! input
19686 -{H|=>zh-cn:foo;}-foobar
19687 !! result
19688 <p>foobar
19689 </p>
19690 !! end
19691
19692 !! test
19693 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19694 !! options
19695 language=zh variant=zh-cn
19696 !! input
19697 -{H|}-foobar
19698 !! result
19699 <p>foobar
19700 </p>
19701 !! end
19702
19703 !! test
19704 Nested using of manual convert syntax
19705 !! options
19706 language=zh variant=zh-hk
19707 !! wikitext
19708 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19709 !! html
19710 <p>Nested: Hello Hong Kong!
19711 </p>
19712 !! end
19713
19714 !! test
19715 Proper conversion of text in external links
19716 !! options
19717 language=sr variant=sr-ec
19718 !! wikitext
19719 http://www.google.com
19720 gopher://www.google.com
19721 [http://www.google.com http://www.google.com]
19722 [gopher://www.google.com gopher://www.google.com]
19723 [https://www.google.com irc://www.google.com]
19724 [ftp://www.google.com www.google.com/ftp://dir]
19725 [//www.google.com www.google.com]
19726 !! html
19727 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19728 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19729 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19730 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19731 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19732 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19733 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19734 </p>
19735 !! end
19736
19737 !! test
19738 Do not convert roman numbers to language variants
19739 !! options
19740 language=sr variant=sr-ec
19741 !! wikitext
19742 Fridrih IV je car.
19743 !! html
19744 <p>Фридрих IV је цар.
19745 </p>
19746 !! end
19747
19748 !! test
19749 Unclosed language converter markup "-{"
19750 !! options
19751 language=sr
19752 !! wikitext
19753 -{T|hello
19754 !! html
19755 <p>-{T|hello
19756 </p>
19757 !! end
19758
19759 !! test
19760 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19761 !! options
19762 language=sr
19763 !! wikitext
19764 -{R|=&gt;}-
19765 !! html
19766 <p>=&gt;
19767 </p>
19768 !!end
19769
19770 !! test
19771 Don't break link parsing if language converter markup is in the caption.
19772 !! options
19773 language=sr variant=sr-ec
19774 !! wikitext
19775 [[Main Page|-{R|main page}-]]
19776 !! html
19777 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19778 </p>
19779 !! end
19780
19781 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19782 !! test
19783 Don't break image parsing if language converter markup is in the caption.
19784 !! options
19785 language=sr
19786 !! wikitext
19787 [[File:Foobar.jpg|-{R|caption}-]]
19788 !! html/parsoid
19789 <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>
19790 </p>
19791 !! end
19792
19793 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19794 !! test
19795 Don't break list handling if language converter markup is in the item.
19796 !! options
19797 language=zh variant=zh-cn
19798 !! wikitext
19799 ;-{zh-cn:AAA;zh-tw:BBB}-
19800 !! html/php
19801 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19802
19803 !! html/parsoid
19804 <dl><dt>AAA
19805 </dt></dl>
19806 !! end
19807
19808 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19809 !! test
19810 Don't break table handling if language converter markup is in the cell.
19811 !! options
19812 language=sr variant=sr-ec
19813 !! wikitext
19814 {|
19815 |-
19816 | -{R|B}-
19817 |}
19818 !! html/php
19819 <table>
19820
19821 <tr>
19822 <td>Б}-
19823 </td></tr></table>
19824
19825 !! html/parsoid
19826 <table>
19827
19828 <tr>
19829 <td> B
19830 </td></tr></table>
19831
19832 !! end
19833
19834 !! test
19835 Bug 529: Uncovered bullet
19836 !! wikitext
19837 * Foo {{bullet}}
19838 !! html
19839 <ul><li> Foo </li>
19840 <li> Bar</li></ul>
19841
19842 !! end
19843
19844 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19845 # Templates in Wikipedia rely on this behavior, as tidy has always been
19846 # enabled there. These tests are normally run *without* tidy, so specify the
19847 # full output here.
19848 # To test realistic parsing behavior, apply a tidy-like transformation to both
19849 # the expected output and your parser's output.
19850 !! test
19851 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19852 !! wikitext
19853 ******* Foo {{bullet}}
19854 !! html
19855 <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>
19856 <li> Bar</li></ul>
19857
19858 !! end
19859
19860 !! test
19861 Bug 529: Uncovered table already at line-start
19862 !! wikitext
19863 x
19864
19865 {{table}}
19866 y
19867 !! html
19868 <p>x
19869 </p>
19870 <table>
19871 <tr>
19872 <td> 1 </td>
19873 <td> 2
19874 </td></tr>
19875 <tr>
19876 <td> 3 </td>
19877 <td> 4
19878 </td></tr></table>
19879 <p>y
19880 </p>
19881 !! end
19882
19883 !! test
19884 Bug 529: Uncovered bullet in parser function result
19885 !! wikitext
19886 * Foo {{lc:{{bullet}} }}
19887 !! html
19888 <ul><li> Foo </li>
19889 <li> bar</li></ul>
19890
19891 !! end
19892
19893 !! test
19894 Bug 5678: Double-parsed template argument
19895 !! wikitext
19896 {{lc:{{{1}}}|hello}}
19897 !! html
19898 <p>{{{1}}}
19899 </p>
19900 !! end
19901
19902 !! test
19903 Bug 5678: Double-parsed template invocation
19904 !! wikitext
19905 {{lc:{{paramtest {{!}} param = hello }} }}
19906 !! html
19907 <p>{{paramtest | param = hello }}
19908 </p>
19909 !! end
19910
19911 !! test
19912 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19913 !! options
19914 language=cs
19915 title=[[Main Page]]
19916 !! wikitext
19917 {{PRVNÍVELKÉ:ěščř}}
19918 {{prvnívelké:ěščř}}
19919 {{PRVNÍMALÉ:ěščř}}
19920 {{prvnímalé:ěščř}}
19921 {{MALÁ:ěščř}}
19922 {{malá:ěščř}}
19923 {{VELKÁ:ěščř}}
19924 {{velká:ěščř}}
19925 !! html
19926 <p>Ěščř
19927 Ěščř
19928 ěščř
19929 ěščř
19930 ěščř
19931 ěščř
19932 ĚŠČŘ
19933 ĚŠČŘ
19934 </p>
19935 !! end
19936
19937 !! test
19938 Morwen/13: Unclosed link followed by heading
19939 !! wikitext
19940 [[link
19941 ==heading==
19942 !! html
19943 <p>[[link
19944 </p>
19945 <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>
19946
19947 !! end
19948
19949 !! test
19950 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19951 !! wikitext
19952 {{foo|
19953 =heading=
19954 !! html
19955 <p>{{foo|
19956 </p>
19957 <h1><span class="mw-headline" id="heading">heading</span></h1>
19958
19959 !! end
19960
19961 !! test
19962 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19963 !! wikitext
19964 {{foo|
19965 ==heading==
19966 !! html
19967 <p>{{foo|
19968 </p>
19969 <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>
19970
19971 !! end
19972
19973 !! test
19974 Tildes in comments
19975 !! options
19976 pst
19977 !! wikitext
19978 <!-- ~~~~ -->
19979 !! html/php
19980 <!-- ~~~~ -->
19981 !! end
19982
19983 !! test
19984 Paragraphs inside divs (no extra line breaks)
19985 !! wikitext
19986 <div>Line one
19987
19988 Line two</div>
19989 !! html
19990 <div>Line one
19991 Line two</div>
19992
19993 !! end
19994
19995 !! test
19996 Paragraphs inside divs (extra line break on open)
19997 !! wikitext
19998 <div>
19999 Line one
20000
20001 Line two</div>
20002 !! html
20003 <div>
20004 <p>Line one
20005 </p>
20006 Line two</div>
20007
20008 !! end
20009
20010 !! test
20011 Paragraphs inside divs (extra line break on close)
20012 !! wikitext
20013 <div>Line one
20014
20015 Line two
20016 </div>
20017 !! html
20018 <div>Line one
20019 <p>Line two
20020 </p>
20021 </div>
20022
20023 !! end
20024
20025 !! test
20026 Paragraphs inside divs (extra line break on open and close)
20027 !! wikitext
20028 <div>
20029 Line one
20030
20031 Line two
20032 </div>
20033 !! html
20034 <div>
20035 <p>Line one
20036 </p><p>Line two
20037 </p>
20038 </div>
20039
20040 !! end
20041
20042 !! test
20043 Nesting tags, paragraphs on lines which begin with <div>
20044 !! wikitext
20045 <div></div><strong>A
20046 B</strong>
20047 !! html/php+tidy
20048 <p><strong>A</strong></p>
20049 <p><strong>B</strong></p>
20050 !! html/parsoid
20051 <div></div>
20052 <p><strong>A
20053 B</strong>
20054 </p>
20055 !! end
20056
20057 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20058 !! test
20059 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20060 !! wikitext
20061 <blockquote>Line one
20062
20063 Line two</blockquote>
20064 !! html
20065 <blockquote>Line one
20066 Line two</blockquote>
20067
20068 !! html+tidy
20069 <blockquote>
20070 <p>Line one Line two</p>
20071 </blockquote>
20072 !! end
20073
20074 !! test
20075 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20076 !! wikitext
20077 <blockquote>
20078 Line one
20079
20080 Line two</blockquote>
20081 !! html
20082 <blockquote>
20083 <p>Line one
20084 </p>
20085 Line two</blockquote>
20086
20087 !! html+tidy
20088 <blockquote>
20089 <p>Line one</p>
20090 Line two</blockquote>
20091 !! end
20092
20093 !! test
20094 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20095 !! wikitext
20096 <blockquote>Line one
20097
20098 Line two
20099 </blockquote>
20100 !! html
20101 <blockquote>Line one
20102 <p>Line two
20103 </p>
20104 </blockquote>
20105
20106 !! html+tidy
20107 <blockquote>
20108 <p>Line one</p>
20109 <p>Line two</p>
20110 </blockquote>
20111 !! end
20112
20113 !! test
20114 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20115 !! wikitext
20116 <blockquote>
20117 Line one
20118
20119 Line two
20120 </blockquote>
20121 !! html
20122 <blockquote>
20123 <p>Line one
20124 </p><p>Line two
20125 </p>
20126 </blockquote>
20127
20128 !! html+tidy
20129 <blockquote>
20130 <p>Line one</p>
20131 <p>Line two</p>
20132 </blockquote>
20133 !! end
20134
20135 !! test
20136 Paragraphs inside blockquotes/divs (no extra line breaks)
20137 !! wikitext
20138 <blockquote><div>Line one
20139
20140 Line two</div></blockquote>
20141 !! html
20142 <blockquote><div>Line one
20143 Line two</div></blockquote>
20144
20145 !! end
20146
20147 !! test
20148 Paragraphs inside blockquotes/divs (extra line break on open)
20149 !! wikitext
20150 <blockquote><div>
20151 Line one
20152
20153 Line two</div></blockquote>
20154 !! html
20155 <blockquote><div>
20156 <p>Line one
20157 </p>
20158 Line two</div></blockquote>
20159
20160 !! end
20161
20162 !! test
20163 Paragraphs inside blockquotes/divs (extra line break on close)
20164 !! wikitext
20165 <blockquote><div>Line one
20166
20167 Line two
20168 </div></blockquote>
20169 !! html
20170 <blockquote><div>Line one
20171 <p>Line two
20172 </p>
20173 </div></blockquote>
20174
20175 !! end
20176
20177 !! test
20178 Paragraphs inside blockquotes/divs (extra line break on open and close)
20179 !! wikitext
20180 <blockquote><div>
20181 Line one
20182
20183 Line two
20184 </div></blockquote>
20185 !! html
20186 <blockquote><div>
20187 <p>Line one
20188 </p><p>Line two
20189 </p>
20190 </div></blockquote>
20191
20192 !! end
20193
20194 !! test
20195 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20196 !! options
20197 wgLinkHolderBatchSize=0
20198 !! wikitext
20199 [[meatball:1]]
20200 [[meatball:2]]
20201 [[meatball:3]]
20202 !! html
20203 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20204 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20205 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20206 </p>
20207 !! end
20208
20209 !! test
20210 Free external link invading image caption
20211 !! wikitext
20212 [[Image:Foobar.jpg|thumb|http://x|hello]]
20213 !! html
20214 <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>
20215
20216 !! end
20217
20218 !! test
20219 Bug 15196: localised external link numbers
20220 !! options
20221 language=fa
20222 !! wikitext
20223 [http://en.wikipedia.org/]
20224 !! html/php
20225 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20226 </p>
20227 !! html/parsoid
20228 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20229 !! end
20230
20231 !! test
20232 Multibyte character in padleft
20233 !! wikitext
20234 {{padleft:-Hello|7|Æ}}
20235 !! html
20236 <p>Æ-Hello
20237 </p>
20238 !! end
20239
20240 !! test
20241 Multibyte character in padright
20242 !! wikitext
20243 {{padright:Hello-|7|Æ}}
20244 !! html
20245 <p>Hello-Æ
20246 </p>
20247 !! end
20248
20249 !!test
20250 formatdate parser function
20251 !! wikitext
20252 {{#formatdate:2009-03-24}}
20253 !! html
20254 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20255 </p>
20256 !! end
20257
20258 !!test
20259 formatdate parser function, with default format
20260 !! wikitext
20261 {{#formatdate:2009-03-24|mdy}}
20262 !! html
20263 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20264 </p>
20265 !! end
20266
20267 !! test
20268 Spacing of numbers in formatted dates
20269 !! wikitext
20270 {{#formatdate:January 15}}
20271 !! html
20272 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20273 </p>
20274 !! end
20275
20276 !! test
20277 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
20278 !! options
20279 language=nl title=[[MediaWiki:Common.css]]
20280 !! wikitext
20281 {{#formatdate:2009-03-24|dmy}}
20282 !! html
20283 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20284 </p>
20285 !! end
20286
20287 #
20288 #
20289 #
20290
20291 #
20292 # Edit comments
20293 #
20294
20295 !! test
20296 Edit comment with link
20297 !! options
20298 comment
20299 !! wikitext
20300 I like the [[Main Page]] a lot
20301 !! html/php
20302 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20303 !!end
20304
20305 !! test
20306 Edit comment with link and link text
20307 !! options
20308 comment
20309 !! wikitext
20310 I like the [[Main Page|best pages]] a lot
20311 !! html/php
20312 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20313 !!end
20314
20315 !! test
20316 Edit comment with link and link text with suffix
20317 !! options
20318 comment
20319 !! wikitext
20320 I like the [[Main Page|best page]]s a lot
20321 !! html/php
20322 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20323 !!end
20324
20325 !! test
20326 Edit comment with section link (non-local, eg in history list)
20327 !! options
20328 comment title=[[Main Page]]
20329 !! wikitext
20330 /* External links */ removed bogus entries
20331 !! html/php
20332 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20333 !!end
20334
20335 !! test
20336 Edit comment with section link and text before it (non-local, eg in history list)
20337 !! options
20338 comment title=[[Main Page]]
20339 !! wikitext
20340 pre-comment text /* External links */ removed bogus entries
20341 !! html/php
20342 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>
20343 !!end
20344
20345 !! test
20346 Edit comment with section link (local, eg in diff view)
20347 !! options
20348 comment local title=[[Main Page]]
20349 !! wikitext
20350 /* External links */ removed bogus entries
20351 !! html/php
20352 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20353 !!end
20354
20355 !! test
20356 Edit comment with subpage link (bug 14080)
20357 !! options
20358 comment
20359 subpage
20360 title=[[Subpage test]]
20361 !! wikitext
20362 Poked at a [[/subpage]] here...
20363 !! html/php
20364 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20365 !!end
20366
20367 !! test
20368 Edit comment with subpage link and link text (bug 14080)
20369 !! options
20370 comment
20371 subpage
20372 title=[[Subpage test]]
20373 !! wikitext
20374 Poked at a [[/subpage|neat little page]] here...
20375 !! html/php
20376 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20377 !!end
20378
20379 !! test
20380 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20381 !! options
20382 comment
20383 title=[[Subpage test]]
20384 !! wikitext
20385 Poked at a [[/subpage]] here...
20386 !! html/php
20387 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...
20388 !!end
20389
20390 !! test
20391 Edit comment with bare anchor link (local, as on diff)
20392 !! options
20393 comment
20394 local
20395 title=[[Main Page]]
20396 !! wikitext
20397 [[#section]]
20398 !! html/php
20399 <a href="#section">#section</a>
20400 !! end
20401
20402 !! test
20403 Edit comment with bare anchor link (non-local, as on history)
20404 !! options
20405 comment
20406 title=[[Main Page]]
20407 !! wikitext
20408 [[#section]]
20409 !! html/php
20410 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20411 !! end
20412
20413 !! test
20414 Anchor starting with underscore
20415 !! options
20416 title=[[Foo]]
20417 !! wikitext
20418 [[#_ref|One]]
20419 !! html/php
20420 <p><a href="#_ref">One</a>
20421 </p>
20422 !! html/parsoid
20423 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20424 !! end
20425
20426 !! test
20427 Id starting with underscore
20428 !! wikitext
20429 <div id="_ref"></div>
20430 !! html/*
20431 <div id="_ref"></div>
20432
20433 !! end
20434
20435 !! test
20436 Space normalisation on autocomment (bug 22784)
20437 !! options
20438 comment
20439 title=[[Main Page]]
20440 !! wikitext
20441 /* __hello__world__ */
20442 !! html/php
20443 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20444 !! end
20445
20446 !! test
20447 percent-encoding and + signs in comments (Bug 26410)
20448 !! options
20449 comment
20450 !! wikitext
20451 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20452 !! html/php
20453 <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>
20454 !! end
20455
20456 # Parsoid doesn't support this yet: see bug 73581
20457 # but it *should* omit the 'src' attribute if the image is bad.
20458 # PHP side of tests was disabled in
20459 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20460 # because of issues in the PHP parserTests infrastructure
20461 # (but the output below is indeed what the PHP side emits)
20462 !! test
20463 Bad images - basic functionality
20464 !! wikitext
20465 [[File:Bad.jpg]]
20466 !! DISABLED/html/php
20467 !! html/parsoid
20468 <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>
20469 !! end
20470
20471 !! test
20472 Bad images - bug 16039: text after bad image disappears
20473 !! wikitext
20474 Foo bar
20475 [[File:Bad.jpg]]
20476 Bar foo
20477 !! DISABLED/html/php
20478 <p>Foo bar
20479 </p><p>Bar foo
20480 </p>
20481 !! html/parsoid
20482 <p>Foo bar
20483 <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>
20484 Bar foo</p>
20485 !! end
20486
20487 !! test
20488 Verify that displaytitle works (bug #22501) no displaytitle
20489 !! options
20490 showtitle
20491 !! config
20492 wgAllowDisplayTitle=true
20493 wgRestrictDisplayTitle=false
20494 !! wikitext
20495 this is not the the title
20496 !! html/php
20497 Parser test
20498 <p>this is not the the title
20499 </p>
20500 !! end
20501
20502 !! test
20503 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20504 !! options
20505 showtitle
20506 title=[[Screen]]
20507 !! config
20508 wgAllowDisplayTitle=true
20509 wgRestrictDisplayTitle=false
20510 !! wikitext
20511 this is not the the title
20512 {{DISPLAYTITLE:whatever}}
20513 !! html/php
20514 whatever
20515 <p>this is not the the title
20516 </p>
20517 !! end
20518
20519 !! test
20520 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20521 !! options
20522 showtitle
20523 title=[[Screen]]
20524 !! config
20525 wgAllowDisplayTitle=true
20526 wgRestrictDisplayTitle=true
20527 !! wikitext
20528 this is not the the title
20529 {{DISPLAYTITLE:whatever}}
20530 !! html/php
20531 Screen
20532 <p>this is not the the title
20533 </p>
20534 !! end
20535
20536 !! test
20537 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20538 !! options
20539 showtitle
20540 title=[[Screen]]
20541 !! config
20542 wgAllowDisplayTitle=true
20543 wgRestrictDisplayTitle=true
20544 !! wikitext
20545 this is not the the title
20546 {{DISPLAYTITLE:screen}}
20547 !! html/php
20548 screen
20549 <p>this is not the the title
20550 </p>
20551 !! end
20552
20553 !! test
20554 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20555 !! options
20556 showtitle
20557 title=[[Screen]]
20558 !! config
20559 wgAllowDisplayTitle=false
20560 !! wikitext
20561 this is not the the title
20562 {{DISPLAYTITLE:screen}}
20563 !! html/php
20564 Screen
20565 <p>this is not the the title
20566 <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>
20567 </p>
20568 !! end
20569
20570 !! test
20571 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20572 !! options
20573 showtitle
20574 title=[[Screen]]
20575 !! config
20576 wgAllowDisplayTitle=false
20577 !! wikitext
20578 this is not the the title
20579 !! html/php
20580 Screen
20581 <p>this is not the the title
20582 </p>
20583 !! end
20584
20585 !! test
20586 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20587 !! options
20588 showtitle
20589 title=[[Screen]]
20590 !! config
20591 wgAllowDisplayTitle=true
20592 wgRestrictDisplayTitle=true
20593 !! wikitext
20594 this is not the the title
20595 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20596 !! html/php
20597 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20598 <p>this is not the the title
20599 </p>
20600 !! end
20601
20602 !! test
20603 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20604 !! options
20605 showtitle
20606 title=[[Screen]]
20607 !! config
20608 wgAllowDisplayTitle=true
20609 wgRestrictDisplayTitle=true
20610 !! wikitext
20611 this is not the the title
20612 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20613 !! html/php
20614 <span style="color: red;">s</span>creen
20615 <p>this is not the the title
20616 </p>
20617 !! end
20618
20619 !! test
20620 Page status indicators: Empty name is invalid
20621 !! options
20622 showindicators
20623 !! wikitext
20624 <indicator name=" "></indicator>
20625 <indicator></indicator>
20626 !! html
20627 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20628 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20629 </p>
20630 !! end
20631
20632 !! test
20633 Page status indicators: Weird syntaxes that are okay
20634 !! options
20635 showindicators
20636 !! wikitext
20637 <indicator name="empty" />
20638 <indicator name="name"></indicator>
20639 !! html
20640 empty=
20641 name=
20642 <p><br />
20643 </p>
20644 !! end
20645
20646 !! test
20647 Page status indicators: Torture test
20648 !! options
20649 showindicators
20650 !! wikitext
20651 <indicator name="01">hello world</indicator>
20652 <indicator name="02">[[Main Page]]</indicator>
20653 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20654 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20655 <indicator name="05">* foo
20656 * bar</indicator>
20657 <indicator name="06"><nowiki>foo</nowiki></indicator>
20658 <indicator name="07"> Preformatted</indicator>
20659 <indicator name="08"><div>Broken tag</indicator>
20660 <indicator name="09">{| class=wikitable
20661 | cell
20662 |}</indicator>
20663 <indicator name="10">Two
20664
20665 paragraphs</indicator>
20666 !! html
20667 01=hello world
20668 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20669 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" />
20670 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>
20671 05=<ul><li> foo</li>
20672 <li> bar</li></ul>
20673
20674 06=foo
20675 07=<pre>Preformatted
20676 </pre>
20677 08=<div>Broken tag</div>
20678
20679 09=<table class="wikitable">
20680 <tr>
20681 <td> cell
20682 </td></tr></table>
20683
20684 10=<p>Two
20685 </p><p>paragraphs
20686 </p>
20687 <p><br />
20688 </p><p><br />
20689 </p><p><br />
20690 </p><p><br />
20691 </p><p><br />
20692 </p>
20693 !! end
20694
20695 !! test
20696 preload: check <noinclude> and <includeonly>
20697 !! options
20698 preload
20699 !! wikitext
20700 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20701 !! html/php
20702 Hello kind world.
20703 !! end
20704
20705 !! test
20706 preload: check <onlyinclude>
20707 !! options
20708 preload
20709 !! wikitext
20710 Goodbye <onlyinclude>Hello world</onlyinclude>
20711 !! html/php
20712 Hello world
20713 !! end
20714
20715 !! test
20716 preload: can pass tags through if we want to
20717 !! options
20718 preload
20719 !! wikitext
20720 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20721 !! html/php
20722 <includeonly>Hello world</includeonly>
20723 !! end
20724
20725 !! test
20726 preload: check that it doesn't try to do tricks
20727 !! options
20728 preload
20729 !! wikitext
20730 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20731 !! html/php
20732 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20733 !! end
20734
20735 !! test
20736 Play a bit with r67090 and bug 3158
20737 !! wikitext
20738 <div style="width:50% !important">&nbsp;</div>
20739 <div style="width:50%&nbsp;!important">&nbsp;</div>
20740 <div style="width:50%&#160;!important">&nbsp;</div>
20741 <div style="border : solid;">&nbsp;</div>
20742 !! html/php
20743 <div style="width:50% !important">&#160;</div>
20744 <div style="width:50% !important">&#160;</div>
20745 <div style="width:50% !important">&#160;</div>
20746 <div style="border&#160;: solid;">&#160;</div>
20747
20748 !! html/parsoid
20749 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20750 <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>
20751 <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>
20752 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20753
20754 !! end
20755
20756 !! test
20757 HTML5 data attributes
20758 !! wikitext
20759 <span data-foo="bar">Baz</span>
20760 <p data-abc-def_hij="">Quuz</p>
20761 !! html/php
20762 <p><span data-foo="bar">Baz</span>
20763 </p>
20764 <p data-abc-def_hij="">Quuz</p>
20765
20766 !! html/parsoid
20767 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20768 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20769 !! end
20770
20771 !! test
20772 Strip reserved data attributes
20773 !! wikitext
20774 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20775 !! html/php
20776 <div data-ok="fred">d</div>
20777
20778 !! html/parsoid
20779 <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>
20780 !! end
20781
20782 !! test
20783 percent-encoding and + signs in internal links (Bug 26410)
20784 !! wikitext
20785 [[User:+%]] [[Page+title%]]
20786 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20787 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20788 [[%33%45]] [[%33%45+]]
20789 !! html/php
20790 <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>
20791 <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>
20792 <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>
20793 <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>
20794 </p>
20795 !! html/parsoid
20796 <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>
20797 <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>
20798 <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>
20799 <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>
20800 !! end
20801
20802 !! test
20803 Special characters in embedded file links (bug 27679)
20804 !! wikitext
20805 [[File:Contains & ampersand.jpg]]
20806 [[File:Does not exist.jpg|Title with & ampersand]]
20807 !! html/php
20808 <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>
20809 <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>
20810 </p>
20811 !! html/parsoid
20812 <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>
20813 <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>
20814 !! end
20815
20816 !! test
20817 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20818 !! wikitext
20819 Text&apos;s been normalized?
20820 !! html
20821 <p>Text&#39;s been normalized?
20822 </p>
20823 !! end
20824
20825 !! test
20826 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20827 !! wikitext
20828 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20829 !! html
20830 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20831 </p>
20832 !! end
20833
20834 !! test
20835 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20836 !! wikitext
20837 [http://www.example.org/ ideograms]
20838 !! html
20839 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20840 </p>
20841 !! end
20842
20843 !! test
20844 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20845 !! wikitext
20846 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20847 !! html
20848 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20849 </p>
20850 !! end
20851
20852 !! article
20853 Mediawiki:loop1
20854 !! text
20855 {{Identical|A}}
20856 !! endarticle
20857
20858 !! article
20859 Mediawiki:loop2
20860 !! text
20861 {{Identical|B}}
20862 !! endarticle
20863
20864 !! article
20865 Template:Identical
20866 !! text
20867 {{int:loop1}}
20868 {{int:loop2}}
20869 !! endarticle
20870
20871 !! test
20872 Bug 31098 Template which includes system messages which includes the template
20873 !! wikitext
20874 {{Identical}}
20875 !! html
20876 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20877 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20878 </p>
20879 !! end
20880
20881 !! test
20882 Bug31490 Turkish: ucfirst 'blah'
20883 !! options
20884 language=tr
20885 !! wikitext
20886 {{ucfirst:blah}}
20887 !! html
20888 <p>Blah
20889 </p>
20890 !! end
20891
20892 !! test
20893 Bug31490 Turkish: ucfirst 'ix'
20894 !! options
20895 language=tr
20896 !! wikitext
20897 {{ucfirst:ix}}
20898 !! html
20899 <p>İx
20900 </p>
20901 !! end
20902
20903 !! test
20904 Bug31490 Turkish: lcfirst 'BLAH'
20905 !! options
20906 language=tr
20907 !! wikitext
20908 {{lcfirst:BLAH}}
20909 !! html
20910 <p>bLAH
20911 </p>
20912 !! end
20913
20914 !! test
20915 Bug31490 Turkish: ucfırst (with a dotless i)
20916 !! options
20917 language=tr
20918 !! wikitext
20919 {{ucfırst:blah}}
20920 !! html
20921 <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>
20922 </p>
20923 !! end
20924
20925 !! test
20926 Bug31490 ucfırst (with a dotless i) with English language
20927 !! options
20928 language=en
20929 !! wikitext
20930 {{ucfırst:blah}}
20931 !! html
20932 <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>
20933 </p>
20934 !! end
20935
20936 !! test
20937 Bug 26375: TOC with italics
20938 !! options
20939 title=[[Main Page]]
20940 !! wikitext
20941 __TOC__
20942 == ''Lost'' episodes ==
20943 !! html
20944 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20945 <ul>
20946 <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>
20947 </ul>
20948 </div>
20949
20950 <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>
20951
20952 !! end
20953
20954 !! test
20955 Bug 26375: TOC with bold
20956 !! options
20957 title=[[Main Page]]
20958 !! wikitext
20959 __TOC__
20960 == '''should be bold''' then normal text ==
20961 !! html
20962 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20963 <ul>
20964 <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>
20965 </ul>
20966 </div>
20967
20968 <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>
20969
20970 !! end
20971
20972 !! test
20973 Bug 33845: Headings become cursive in TOC when they contain an image
20974 !! options
20975 title=[[Main Page]]
20976 !! wikitext
20977 __TOC__
20978 == Image [[Image:foobar.jpg]] ==
20979 !! html
20980 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20981 <ul>
20982 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20983 </ul>
20984 </div>
20985
20986 <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>
20987
20988 !! end
20989
20990 !! test
20991 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20992 !! options
20993 title=[[Main Page]]
20994 !! wikitext
20995 __TOC__
20996 == <blockquote>Quote</blockquote> ==
20997 !! html
20998 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20999 <ul>
21000 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21001 </ul>
21002 </div>
21003
21004 <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>
21005
21006 !! html+tidy
21007 <p></p>
21008 <div id="toc" class="toc">
21009 <div id="toctitle">
21010 <h2>Contents</h2>
21011 </div>
21012 <ul>
21013 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21014 </ul>
21015 </div>
21016 <p></p>
21017 <h2><span class="mw-headline" id="Quote"></span></h2>
21018 <blockquote>
21019 <p><span class="mw-headline" id="Quote">Quote</span></p>
21020 </blockquote>
21021 <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>
21022 !! end
21023
21024 !! test
21025 Unclosed tags in TOC
21026 !! options
21027 title=[[Main Page]]
21028 !! wikitext
21029 __TOC__
21030 == Proof: 2 < 3 ==
21031 <small>Hanc marginis exiguitas non caperet.</small>
21032 QED
21033 !! html
21034 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21035 <ul>
21036 <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>
21037 </ul>
21038 </div>
21039
21040 <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>
21041 <p><small>Hanc marginis exiguitas non caperet.</small>
21042 QED
21043 </p>
21044 !! end
21045
21046 !! test
21047 Multiple tags in TOC
21048 !! wikitext
21049 __TOC__
21050 == <i>Foo</i> <b>Bar</b> ==
21051
21052 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21053 !! html
21054 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21055 <ul>
21056 <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>
21057 <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>
21058 </ul>
21059 </div>
21060
21061 <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>
21062 <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>
21063
21064 !! html+tidy
21065 <p></p>
21066 <div id="toc" class="toc">
21067 <div id="toctitle">
21068 <h2>Contents</h2>
21069 </div>
21070 <ul>
21071 <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>
21072 <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>
21073 </ul>
21074 </div>
21075 <p></p>
21076 <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>
21077 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21078 <blockquote>
21079 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21080 </blockquote>
21081 <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>
21082 !! end
21083
21084 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21085 # html5 tag parsing.
21086 !! test
21087 Tags with parameters in TOC
21088 !! options
21089 parsoid=wt2html
21090 !! wikitext
21091 __TOC__
21092 == <sup class="in-h2">Hello</sup> ==
21093
21094 == <sup class="a > b">Evilbye</sup> ==
21095 !! html/php
21096 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21097 <ul>
21098 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21099 <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>
21100 </ul>
21101 </div>
21102
21103 <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>
21104 <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>
21105
21106 !! html/parsoid
21107 <meta property="mw:PageProp/toc" />
21108 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21109
21110 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21111 !! end
21112
21113 !! test
21114 span tags with directionality in TOC
21115 !! wikitext
21116 __TOC__
21117 == <span dir="ltr">C++</span> ==
21118
21119 == <span dir="rtl">זבנג!</span> ==
21120
21121 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21122
21123 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21124
21125 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21126 !! html
21127 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21128 <ul>
21129 <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>
21130 <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>
21131 <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>
21132 <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>
21133 <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>
21134 </ul>
21135 </div>
21136
21137 <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>
21138 <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>
21139 <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>
21140 <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>
21141 <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>
21142
21143 !! end
21144
21145 !! test
21146 Bug 72884: bdi element in ToC
21147 !! wikitext
21148 __TOC__
21149 == <bdi>test</bdi> ==
21150 !! html
21151 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21152 <ul>
21153 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21154 </ul>
21155 </div>
21156
21157 <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>
21158
21159 !! end
21160
21161 # Note that the html output does not have the <p></p>, but the
21162 # html+tidy output *does*. This is because the empty <p></p> is
21163 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21164 !! test
21165 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21166 !! wikitext
21167 __TOC__
21168 == x ==
21169 !! html
21170 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21171 <ul>
21172 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21173 </ul>
21174 </div>
21175
21176 <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>
21177
21178 !! html+tidy
21179 <p></p>
21180 <div id="toc" class="toc">
21181 <div id="toctitle">
21182 <h2>Contents</h2>
21183 </div>
21184 <ul>
21185 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21186 </ul>
21187 </div>
21188 <p></p>
21189 <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>
21190 !! end
21191
21192 !! article
21193 MediaWiki:Bug32057
21194 !! text
21195 == {{int:headline_sample}} ==
21196 !! endarticle
21197
21198 !! test
21199 Bug 32057: Title needed when expanding <h> nodes.
21200 !! options
21201 title=[[Main Page]]
21202 !! wikitext
21203 {{int:Bug32057}}
21204 !! html
21205 <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>
21206
21207 !! end
21208
21209 !! test
21210 Strip marker in urlencode
21211 !! wikitext
21212 {{urlencode:x<nowiki/>y}}
21213 {{urlencode:x<nowiki/>y|wiki}}
21214 {{urlencode:x<nowiki/>y|path}}
21215 {{urlencode:x<pre id="one">two</pre>y}}
21216 !! html
21217 <p>xy
21218 xy
21219 xy
21220 xy
21221 </p>
21222 !! end
21223
21224 !! test
21225 Strip marker in lc
21226 !! wikitext
21227 {{lc:x<nowiki/>y}}
21228 !! html
21229 <p>xy
21230 </p>
21231 !! end
21232
21233 !! test
21234 Strip marker in uc
21235 !! wikitext
21236 {{uc:x<nowiki/>y}}
21237 !! html
21238 <p>XY
21239 </p>
21240 !! end
21241
21242 !! test
21243 Strip marker in formatNum
21244 !! wikitext
21245 {{formatnum:1<nowiki/>2}}
21246 {{formatnum:1<nowiki/>2|R}}
21247 !! html
21248 <p>12
21249 12
21250 </p>
21251 !! end
21252
21253 !! test
21254 Check noCommafy in formatNum
21255 !! options
21256 language=be-tarask
21257 !! wikitext
21258 {{formatnum:123456.78}}
21259 {{formatnum:123456.78|NOSEP}}
21260 !! html
21261 <p>123 456,78
21262 123456.78
21263 </p>
21264 !! end
21265
21266 !! test
21267 Wrong option for formatNum (bug 56199)
21268 !! wikitext
21269 {{formatnum:1,234.56|Random}}
21270 {{formatnum:1,234.56|EVERYTHING}}
21271 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21272 !! html
21273 <p>1,234.56
21274 1,234.56
21275 1,234.56
21276 </p>
21277 !! end
21278
21279 !! test
21280 Strip marker in grammar
21281 !! options
21282 language=fi
21283 !! wikitext
21284 {{grammar:elative|foo<nowiki/>bar}}
21285 !! html
21286 <p>foobarista
21287 </p>
21288 !! end
21289
21290 !! test
21291 Strip marker in padleft
21292 !! wikitext
21293 {{padleft:|2|x<nowiki/>y}}
21294 !! html
21295 <p>xy
21296 </p>
21297 !! end
21298
21299 !! test
21300 Strip marker in padright
21301 !! wikitext
21302 {{padright:|2|x<nowiki/>y}}
21303 !! html
21304 <p>xy
21305 </p>
21306 !! end
21307
21308 !! test
21309 Strip marker in anchorencode
21310 !! wikitext
21311 {{anchorencode:x<nowiki/>y}}
21312 !! html
21313 <p>xy
21314 </p>
21315 !! end
21316
21317 !! test
21318 nowiki inside link inside heading (bug 18295)
21319 !! wikitext
21320 ==[[foo|x<nowiki>y</nowiki>z]]==
21321 !! html
21322 <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>
21323
21324 !! end
21325
21326 !! test
21327 new support for bdi element (bug 31817)
21328 !! wikitext
21329 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21330 !! html
21331 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21332
21333 !!end
21334
21335 !! test
21336 Ignore pipe between table row attributes
21337 !! wikitext
21338 {|
21339 | quux
21340 |- id=foo | style='color: red'
21341 | bar
21342 |}
21343 !! html
21344 <table>
21345 <tr>
21346 <td> quux
21347 </td></tr>
21348 <tr id="foo" style="color: red">
21349 <td> bar
21350 </td></tr></table>
21351
21352 !! end
21353
21354 !!test
21355 Gallery override link with WikiLink (bug 34852)
21356 !! wikitext
21357 <gallery>
21358 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21359 </gallery>
21360 !! html
21361 <ul class="gallery mw-gallery-traditional">
21362 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21363 <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>
21364 <div class="gallerytext">
21365 <p>caption
21366 </p>
21367 </div>
21368 </div></li>
21369 </ul>
21370
21371 !! end
21372
21373 !!test
21374 Gallery override link with absolute external link (bug 34852)
21375 !! wikitext
21376 <gallery>
21377 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21378 </gallery>
21379 !! html
21380 <ul class="gallery mw-gallery-traditional">
21381 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21382 <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>
21383 <div class="gallerytext">
21384 <p>caption
21385 </p>
21386 </div>
21387 </div></li>
21388 </ul>
21389
21390 !! end
21391
21392 !!test
21393 Gallery override link with malicious javascript (bug 34852)
21394 !! wikitext
21395 <gallery>
21396 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21397 </gallery>
21398 !! html
21399 <ul class="gallery mw-gallery-traditional">
21400 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21401 <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>
21402 <div class="gallerytext">
21403 <p>caption
21404 </p>
21405 </div>
21406 </div></li>
21407 </ul>
21408
21409 !! end
21410
21411 !!test
21412 Gallery with invalid title as link (bug 43964)
21413 !! wikitext
21414 <gallery>
21415 File:foobar.jpg|link=<
21416 </gallery>
21417 !! html
21418 <ul class="gallery mw-gallery-traditional">
21419 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21420 <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>
21421 <div class="gallerytext">
21422 </div>
21423 </div></li>
21424 </ul>
21425
21426 !! end
21427
21428 !!test
21429 Language parser function
21430 !! wikitext
21431 {{#language:ar}}
21432 !! html
21433 <p>العربية
21434 </p>
21435 !! end
21436
21437 !!test
21438 Padleft and padright as substr
21439 !! wikitext
21440 {{padleft:|3|abcde}}
21441 {{padright:|3|abcde}}
21442 !! html
21443 <p>abc
21444 abc
21445 </p>
21446 !! end
21447
21448 !!test
21449 Special parser function
21450 !! wikitext
21451 {{#special:RandomPage}}
21452 {{#special:BaDtItLe}}
21453 {{#special:Foobar}}
21454 !! html
21455 <p>Special:Random
21456 Special:Badtitle
21457 Special:Foobar
21458 </p>
21459 !! end
21460
21461 !!test
21462 Bug 34939 - Case insensitive link parsing ([HttP://])
21463 !! wikitext
21464 [HttP://MediaWiki.Org/]
21465 !! html/php
21466 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21467 </p>
21468 !! html/parsoid
21469 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21470 !! end
21471
21472 !!test
21473 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21474 !! wikitext
21475 [HttP://MediaWiki.Org/ MediaWiki]
21476 !! html
21477 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21478 </p>
21479 !! end
21480
21481 !!test
21482 Bug 34939 - Case insensitive link parsing (HttP://)
21483 !! wikitext
21484 HttP://MediaWiki.Org/
21485 !! html/php
21486 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21487 </p>
21488 !! html/parsoid
21489 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21490 !! end
21491
21492 !!test
21493 Disable TOC
21494 !! options
21495 notoc
21496 !! wikitext
21497 Lead
21498 == Section 1 ==
21499 == Section 2 ==
21500 == Section 3 ==
21501 == Section 4 ==
21502 == Section 5 ==
21503 !! html
21504 <p>Lead
21505 </p>
21506
21507 <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>
21508 <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>
21509 <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>
21510 <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>
21511 <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>
21512
21513 !! end
21514
21515
21516 ###
21517 ### Parsoid-specific tests
21518 ### Parsoid-PHP parser incompatibilities
21519 ###
21520 !!test
21521 1. SOL-sensitive wikitext tokens as template-args
21522 !!options
21523 parsoid=wt2html,wt2wt
21524 !! wikitext
21525 {{echo|*a}}
21526 {{echo|#a}}
21527 {{echo|:a}}
21528 !! html
21529 <span about="#mwt1" typeof="mw:Transclusion">
21530 </span><ul about="#mwt1"><li>a</li>
21531 </ul>
21532 <span about="#mwt2" typeof="mw:Transclusion">
21533 </span><ol about="#mwt2"><li>a</li>
21534 </ol>
21535 <span about="#mwt3" typeof="mw:Transclusion">
21536 </span><dl about="#mwt3"><dd>a</dd>
21537 </dl>
21538 !!end
21539
21540 #### -----------------------------------------------------------------
21541 #### Parsoid-specific functionality tests
21542 #### -----------------------------------------------------------------
21543
21544 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21545 # We know wt2wt will fail, but we expect selser to pass.
21546 # Due to the nature of our testing, wt2wt and selser tests will enter the
21547 # blacklist and we'll catch selser regressions based on changes to the
21548 # blacklist entries for selser tests.
21549 !! test
21550 1. Bad treebuilder fixup of formatting elt is cleaned up
21551 !! options
21552 parsoid=wt2html,wt2wt
21553 !! wikitext
21554 {|
21555 |
21556 <small>
21557 [[Image:Foobar.jpg|right|Test]]
21558 </small>
21559 |}
21560 !! html/parsoid
21561 <table>
21562 <tbody><tr><td>
21563 <small>
21564 <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>
21565 </small>
21566 </td></tr>
21567 </tbody></table>
21568 !! end
21569
21570 !! test
21571 2. Bad treebuilder fixup of formatting elt is cleaned up
21572 !! options
21573 parsoid=wt2html,wt2wt
21574 !! wikitext
21575 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21576
21577 <small>[[Image:Foobar.jpg|right|300px]]</small>
21578 !! html/parsoid
21579
21580 <p><b>foo</b></p>
21581 <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>
21582 <p><b>bar</b></p>
21583 <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>
21584 !! end
21585
21586 !! test
21587 3. Bad treebuilder fixup of formatting elt is cleaned up
21588 !! options
21589 parsoid=wt2html,wt2wt
21590 !! wikitext
21591 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21592 !! html/parsoid
21593 <p><small><b>foo</b></small></p>
21594 <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>
21595 <p><small><b>bar</b></small></p>
21596 !! end
21597
21598 !! test
21599 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21600 !! options
21601 parsoid=wt2html,wt2wt
21602 !! wikitext
21603 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21604 !! html/parsoid
21605 <p><b><small></small></b></p>
21606 <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>
21607 <p></p>
21608 !! end
21609
21610 #### ----------------------------------------------------------------
21611 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21612 #### tags. Parsoid's output for these tags differs from that of the
21613 #### PHP parser.
21614 #### ----------------------------------------------------------------
21615
21616 !!test
21617 Ref: 1. ref-location should be replaced with an index span
21618 !! wikitext
21619 A <ref>foo</ref>
21620 B <ref name="x">foo</ref>
21621 C <ref name="y" />
21622 <references />
21623 !! html/parsoid
21624 <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>
21625 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>
21626 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>
21627 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21628 <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>
21629 <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>
21630 <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>
21631 </ol>
21632 !!end
21633
21634 !!test
21635 Ref: 2. ref-tags with identical names should all get the same index
21636 !! wikitext
21637 A <ref name="x">foo</ref>
21638 B <ref name="x" />
21639 <references />
21640 !! html/parsoid
21641 <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>
21642 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>
21643 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21644 <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>
21645 </ol>
21646 !!end
21647
21648 !!test
21649 Ref: 3. spaces in ref-names should be ignored
21650 !! wikitext
21651 A <ref name="x">foo</ref>
21652 B <ref name=" x " />
21653 C <ref name= x />
21654 <references />
21655 !! html/parsoid
21656 <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>
21657 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>
21658 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>
21659 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21660 <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>
21661 </ol>
21662 !!end
21663
21664 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21665 !!test
21666 Ref: 4. 'constructor' should be accepted as a valid ref-name
21667 !! wikitext
21668 A <ref name="constructor">foo</ref>
21669 <references />
21670 !! html/parsoid
21671 <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>
21672 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21673 <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>
21674 </ol>
21675 !!end
21676
21677 !!test
21678 Ref: 5. body should accept generic wikitext
21679 !! wikitext
21680 A <ref>
21681 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21682 </ref>
21683
21684 <references />
21685 !! html/parsoid
21686 <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>
21687
21688 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21689 <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>
21690 </span></li>
21691 </ol>
21692 !!end
21693
21694 !!test
21695 Ref: 6. indent-pres should not be output in ref-body
21696 !! wikitext
21697 A <ref>
21698 foo
21699 bar
21700 baz
21701 </ref>
21702
21703 <references />
21704 !! html/parsoid
21705 <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>
21706
21707 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21708 <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
21709 bar
21710 baz
21711 </span></li>
21712 </ol>
21713 !!end
21714
21715 !!test
21716 Ref: 7. No p-wrapping in ref-body
21717 !! wikitext
21718 A <ref>
21719 foo
21720
21721 bar
21722
21723
21724 baz
21725
21726
21727
21728 booz
21729 </ref>
21730
21731 <references />
21732 !! html/parsoid
21733 <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>
21734
21735 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21736 <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
21737
21738 bar
21739
21740
21741 baz
21742
21743
21744
21745 booz
21746 </span></li>
21747 </ol>
21748 !!end
21749
21750 !!test
21751 Ref: 8. transclusion wikitext has lower precedence
21752 !! wikitext
21753 A <ref> foo {{echo|</ref> B C}}
21754
21755 <references />
21756 !! html/parsoid
21757 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C<span typeof="mw:Nowiki">}}</span></p>
21758 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21759 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo {{echo|</span></li>
21760 </ol>
21761 !!end
21762
21763 !!test
21764 Ref: 9. unclosed comments should not leak out of ref-body
21765 !! wikitext
21766 A <ref> foo <!--</ref> B C
21767 <references />
21768 !! html/parsoid
21769 <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>
21770 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21771 <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>
21772 </ol>
21773 !!end
21774
21775 !!test
21776 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21777 !! wikitext
21778 A <ref> <b> foo </ref> B C
21779
21780 <references />
21781 !! html/parsoid
21782 <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>
21783
21784
21785 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21786 <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>
21787 </ol>
21788 !!end
21789
21790 !!test
21791 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21792 !! wikitext
21793 A <ref>foo</ref> B
21794 C <ref>bar</ref> D
21795 <references />
21796 !! html/parsoid
21797 <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
21798 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>
21799 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21800 <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>
21801 <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>
21802 </ol>
21803 !!end
21804
21805 !!test
21806 Ref: 12. ref-tags act as trailing newline migration barrier
21807 !! wikitext
21808 <!--the newline at the end of this line moves out of the p tag-->a
21809
21810 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21811 <ref />
21812
21813 c
21814 <references />
21815 !! html/parsoid
21816 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21817
21818
21819 <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>
21820 <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>
21821
21822 <p>c</p>
21823 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21824 <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>
21825 <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>
21826 !!end
21827
21828 !!test
21829 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21830 !! wikitext
21831 <ref>foo</ref> A
21832 <ref>bar
21833 </ref> B
21834 <references />
21835 !! html/parsoid
21836 <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
21837 <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>
21838 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21839 <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>
21840 <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
21841 </span></li>
21842 </ol>
21843 !!end
21844
21845 !!test
21846 Ref: 14. A nested ref-tag should be emitted as plain text
21847 !! wikitext
21848 <ref>foo <ref>bar</ref> baz</ref>
21849
21850 <references />
21851 !! html/parsoid
21852 <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>
21853 </p>
21854 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21855 <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>
21856 </ol>
21857 !!end
21858
21859 !!test
21860 Ref: 15. ref-tags with identical names should get identical indexes
21861 !! wikitext
21862 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21863 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21864
21865 <references />
21866 !! html/parsoid
21867 <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>
21868 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>
21869
21870 <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>
21871 </ol>
21872 !!end
21873
21874 ## We don't bother wt2wt-ing non-standard whitespace
21875 !!test
21876 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21877 !!options
21878 parsoid=wt2html
21879 !! wikitext
21880 A <ref >foo</ref >
21881
21882 <references />
21883 !! html/parsoid
21884 <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>
21885 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21886 <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>
21887 !!end
21888
21889 !!test
21890 Ref: 17. Generate valid HTML5 id/about attributes
21891 !!wikitext
21892 <ref name="a b">foo</ref>
21893
21894 <references />
21895 !!html/parsoid
21896 <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>
21897 </p>
21898
21899 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21900 <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>
21901 </ol>
21902 !!end
21903
21904 !!test
21905 Ref: 18. T58916: Extension attributes should be parsed as plain text
21906 !!wikitext
21907 <ref name="{{echo|a}}">foo</ref>
21908
21909 <references />
21910 !!html/parsoid
21911 <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>
21912 </p>
21913
21914 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21915 <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>
21916 </ol>
21917 !!end
21918
21919 !!test
21920 Ref: 19. ref-tags with identical name encodings should get identical indexes
21921 !! wikitext
21922 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21923
21924 <references />
21925 !! html/parsoid
21926 <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>
21927 </p>
21928 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21929 <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>
21930 </ol>
21931 !!end
21932
21933 !!test
21934 Ref: 20. ref-tags with identical names but different content should keep it
21935 !! wikitext
21936 A <ref name="foo">Foo one</ref>
21937 B <ref name="foo">Foo two</ref>
21938 C <ref name="foo" />
21939
21940 <references />
21941 !! html/parsoid
21942 <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>
21943 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>
21944 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>
21945
21946 <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>
21947 </ol>
21948 !!end
21949
21950 !!test
21951 References: 1. references tag without any refs should be handled properly
21952 !! wikitext
21953 <references />
21954 !! html/parsoid
21955 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21956 !!end
21957
21958 !!test
21959 References: 2. references tag with group only outputs references from that group
21960 !! wikitext
21961 A <ref group="a">foo</ref>
21962 B <ref group="b">bar</ref>
21963 C <ref>baz</ref>
21964
21965 <references group="a" />
21966 <references />
21967 <references group="b" />
21968 !! html/parsoid
21969 <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>
21970 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>
21971 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>
21972
21973 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21974 <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>
21975 </ol>
21976 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21977 <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>
21978 </ol>
21979 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21980 <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>
21981 </ol>
21982 !!end
21983
21984 !!test
21985 References: 3. ref list should be cleared after processing references
21986 !! wikitext
21987 A <ref>foo</ref>
21988
21989 <references />
21990
21991 B <ref>bar</ref>
21992
21993 <references />
21994 !! html/parsoid
21995 <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>
21996
21997 <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>
21998 </ol>
21999
22000 <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>
22001
22002 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22003 <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>
22004 </ol>
22005 !!end
22006
22007 !!test
22008 References: 4. only referenced group should be cleared after processing references
22009 !! wikitext
22010 A <ref group="a">afoo</ref>
22011 B <ref>bfoo</ref>
22012
22013 <references group="a" />
22014
22015 C <ref>cfoo</ref>
22016
22017 <references />
22018 !! html/parsoid
22019 <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>
22020 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>
22021
22022 <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>
22023 </ol>
22024
22025 <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>
22026
22027 <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>
22028 </ol>
22029 !!end
22030
22031 !!test
22032 References: 5. ref tags in references should be processed while ignoring all other content
22033 !! wikitext
22034 A <ref name="a" />
22035 B <ref name="b">bar</ref>
22036
22037 <references>
22038 <ref name="a">foo</ref>
22039 This should just get lost.
22040 </references>
22041 !! html/parsoid
22042 <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>
22043 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>
22044
22045
22046 <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>
22047 </ol>
22048 !!end
22049
22050 !!test
22051 References: 6. <references /> from a transclusion
22052 !! wikitext
22053 <ref>Foo</ref> {{echo|<references />}}
22054 !! html/parsoid
22055 <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>
22056 </ol>
22057 !!end
22058
22059 !! test
22060 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22061 !! wikitext
22062 A <ref>foo bar for a</ref>
22063 B <ref group="X" name="b" />
22064
22065 <references />
22066
22067 <references group="X">
22068 <ref name="b">foo</ref>
22069 </references>
22070 !! html/parsoid
22071 <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>
22072 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>
22073 </p>
22074
22075 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22076 <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>
22077 </ol>
22078
22079 <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"}}'>
22080 <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>
22081 </ol>
22082 !! end
22083
22084 !! test
22085 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22086 !! wikitext
22087 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22088 <references />
22089 !! html/parsoid
22090 <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>
22091 <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>
22092 </ol>
22093 !!end
22094
22095 # This test only works in wt2html now as the <references /> are always generated
22096 # unless selser is active. Once T72722 is fixed, we should add a changes test
22097 # here to ensure that unrelated changes don't add the new <references /> in
22098 # wt2wt.
22099 !! test
22100 References: 9. Generate missing references list at the end
22101 !! wikitext
22102 A <ref>foo</ref>
22103 B <ref group="inexistent">bar</ref>
22104 !! html/parsoid
22105 <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>
22106 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22107 <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>
22108 </ol>
22109 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22110 <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>
22111 </ol>
22112 !! end
22113
22114 !! test
22115 References: 10. New <references/> shouldn't be added for unrelated edits.
22116 !! options
22117 parsoid={
22118 "modes": ["selser"],
22119 "changes": [["#x", "remove"]],
22120 "selser": "noauto"
22121 }
22122 !! wikitext
22123 Unrelated text<span id="x"> that's going to disappear</span>.
22124 A <ref>foo</ref>
22125 !! wikitext/edited
22126 Unrelated text.
22127 A <ref>foo</ref>
22128 !!end
22129
22130 !! test
22131 Entities in ref name
22132 !! wikitext
22133 <ref name="test &amp; me">hi</ref>
22134 <references />
22135 !! html/parsoid
22136 <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>
22137 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22138 <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>
22139 </ol>
22140 !! end
22141
22142 # This test is wt2html only because we're permitting the serializer to produce
22143 # dirty diffs, normalizing the unclosed references to the self-closed version.
22144 !! test
22145 Generate references for unclosed references tag
22146 !! options
22147 parsoid=wt2html
22148 !! wikitext
22149 a<ref>foo</ref>
22150
22151 <references>
22152 !! html/parsoid
22153 <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>
22154 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22155 <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>
22156 !! end
22157
22158 !! test
22159 New reference serializes on its own line
22160 !! options
22161 parsoid=wt2wt,html2wt
22162 !! wikitext
22163 foo
22164 <references />
22165 !! html/parsoid
22166 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22167 !! end
22168
22169 #### ----------------------------------------------------------------
22170 #### Parsoid-only testing of Parsoid's impl of LST
22171 #### Not implemented yet, see
22172 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22173 #### ----------------------------------------------------------------
22174
22175 !! test
22176 LST Sections: 1. Simple section start and end
22177 !! options
22178 parsoid={ "suppressErrors": true }
22179 !! wikitext
22180 <section begin="2011-05-16" />
22181 <section end="2014-04-10 (MW 1.23wmf22)" />
22182 !! html/parsoid
22183 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22184 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22185 !! end
22186
22187 #--------- Test stripping of empty nodes in template content ----------
22188 !!test
22189 Empty LI and TR nodes should be stripped from template content
22190 !!wikitext
22191 {{EmptyLITest}}
22192 {{EmptyTRTest}}
22193 !!html/parsoid
22194 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22195 <li>a</li>
22196 <li>b</li>
22197 </ul>
22198 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22199 <tbody>
22200 <tr>
22201 <td>foo</td>
22202 </tr>
22203 <tr>
22204 <td>bar</td>
22205 </tr>
22206 </tbody>
22207 </table>
22208 !!end
22209
22210 !!test
22211 Empty LI and TR nodes should not be stripped from top-level content
22212 !!wikitext
22213 * a
22214 *
22215 * b
22216 {|
22217 |-
22218 |-
22219 |foo
22220 |}
22221 !!html/parsoid
22222 <ul>
22223 <li> a</li>
22224 <li></li>
22225 <li> b</li>
22226 </ul>
22227 <table>
22228 <tbody>
22229 <tr></tr>
22230 <tr>
22231 <td>foo</td>
22232 </tr>
22233 </tbody>
22234 </table>
22235 !!end
22236
22237 !!test
22238 Empty TR nodes should not be stripped if they have any attributes set
22239 !!wikitext
22240 {{EmptyTRWithHTMLAttrTest}}
22241 !!html/parsoid
22242 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22243 <tr align="center"></tr>
22244 <tr><td>foo</td></tr>
22245 <tr align="center"></tr>
22246 <tr><td>bar</td></tr>
22247 </table>
22248 !!end
22249
22250 #### ----------------------------------------------------------------
22251 #### The following section of tests are primarily to test
22252 #### wikitext escaping capabilities of Parsoid. Given that
22253 #### escaping can be done any number of ways, the wikitext (input)
22254 #### is always adjusted to reflect how Parsoid adds nowiki
22255 #### escape tags.
22256 ####
22257 #### We are marking several tests as parsoid-only since the
22258 #### HTML in the result section is different from what the
22259 #### PHP parser generates for it.
22260 #### ----------------------------------------------------------------
22261
22262
22263 #### --------------- Headings ---------------
22264 #### 0. Unnested
22265 #### 1. Nested inside html <h1>=foo=</h1>
22266 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22267 #### 3. Nested inside html with wikitext split by html tags
22268 #### 4. No escape needed
22269 #### 5. Empty headings <h1></h1>
22270 #### 6. Heading chars in SOL context
22271 #### ----------------------------------------
22272 !! test
22273 Headings: 0. Unnested
22274 !! options
22275 parsoid=html2wt
22276 !! html/parsoid
22277 <p>=foo=</p>
22278
22279 <p> =foo=
22280 <!--cmt-->
22281 =foo=</p>
22282
22283 <p>=foo<i>a</i>=</p>
22284 !! wikitext
22285 <nowiki>=foo=</nowiki>
22286
22287 <nowiki> </nowiki>=foo=
22288 <!--cmt-->
22289 <nowiki>=foo=</nowiki>
22290
22291 =foo''a''<nowiki>=</nowiki>
22292 !!end
22293
22294 # New headings and existing headings are handled differently
22295 !! test
22296 Headings: 1. Nested inside html
22297 !! options
22298 parsoid=html2wt
22299 !! html/parsoid
22300 <h1>=foo=</h1>
22301 <h2>=foo=</h2>
22302 <h3>=foo=</h3>
22303
22304 <h1 data-parsoid=''>=foo=</h1>
22305 <h2 data-parsoid=''>=foo=</h2>
22306 <h3 data-parsoid=''>=foo=</h3>
22307 <h4 data-parsoid=''>=foo=</h4>
22308 <h5 data-parsoid=''>=foo=</h5>
22309 <h6 data-parsoid=''>=foo=</h6>
22310 !! wikitext
22311 = =foo= =
22312
22313 == =foo= ==
22314
22315 === =foo= ===
22316
22317 =<nowiki>=foo=</nowiki>=
22318 ==<nowiki>=foo=</nowiki>==
22319 ===<nowiki>=foo=</nowiki>===
22320 ====<nowiki>=foo=</nowiki>====
22321 =====<nowiki>=foo=</nowiki>=====
22322 ======<nowiki>=foo=</nowiki>======
22323
22324 !!end
22325
22326 !! test
22327 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22328 !! options
22329 parsoid=html2wt
22330 !! html/parsoid
22331 <h1>foo</h1>*bar
22332 <h1>foo</h1>=bar
22333 <h1>foo</h1>=bar=
22334 !! wikitext
22335 = foo =
22336 <nowiki>*</nowiki>bar
22337
22338 = foo =
22339 =bar
22340
22341 = foo =
22342 <nowiki>=bar=</nowiki>
22343 !!end
22344
22345 !! test
22346 Headings: 3. Nested inside html with wikitext split by html tags
22347 !! options
22348 parsoid=html2wt
22349 !! html/parsoid
22350 <h1>=<b>bold</b>foo=</h1>
22351 !! wikitext
22352 = ='''bold'''<nowiki>foo=</nowiki> =
22353 !!end
22354
22355 !! test
22356 Headings: 4a. No escaping needed (testing just h1 and h2)
22357 !! options
22358 parsoid=html2wt
22359 !! html/parsoid
22360 <h1>=foo</h1>
22361 <h1>foo=</h1>
22362 <h1> =foo= </h1>
22363 <h1>=foo= bar</h1>
22364 <h2>=foo</h2>
22365 <h2>foo=</h2>
22366 <h1>=</h1>
22367 <h1><i>=</i>foo=</h1>
22368 !! wikitext
22369 = =foo =
22370
22371 = foo= =
22372
22373 = =foo= =
22374
22375 = =foo= bar =
22376
22377 == =foo ==
22378
22379 == foo= ==
22380
22381 = = =
22382
22383 = ''=''foo= =
22384 !!end
22385
22386 !! test
22387 Headings: 4b. No escaping needed (inside p-tags)
22388 !! options
22389 parsoid=html2wt
22390 !! html/parsoid
22391 <p>===
22392 =foo= x
22393 =foo= <s></s>
22394 </p>
22395 !! wikitext
22396 ===
22397 =foo= x
22398 =foo= <s></s>
22399 !!end
22400
22401 !! test
22402 Headings: 5. Empty headings
22403 !! options
22404 parsoid=html2wt
22405 !! html/parsoid
22406 <h1 data-parsoid='{}'></h1>
22407
22408 <h2 data-parsoid='{}'></h2>
22409
22410 <h3 data-parsoid='{}'></h3>
22411
22412 <h4 data-parsoid='{}'></h4>
22413
22414 <h5 data-parsoid='{}'></h5>
22415
22416 <h6 data-parsoid='{}'></h6>
22417 !! wikitext
22418 =<nowiki/>=
22419
22420 ==<nowiki/>==
22421
22422 ===<nowiki/>===
22423
22424 ====<nowiki/>====
22425
22426 =====<nowiki/>=====
22427
22428 ======<nowiki/>======
22429 !!end
22430
22431 !! test
22432 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22433 !! options
22434 parsoid=html2wt
22435 !! html/parsoid
22436 <p>=a=</p>
22437
22438 <p>=a=</p>
22439
22440 <p>=a=</p>
22441 !! wikitext
22442 <nowiki>=a=</nowiki>
22443
22444 <nowiki>=a=</nowiki>
22445
22446 <nowiki>=a=</nowiki>
22447 !!end
22448
22449 !! test
22450 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22451 !! options
22452 parsoid=html2wt
22453 !! html/parsoid
22454 <p>=a=
22455 b</p>
22456
22457 <p>=a=
22458 b</p>
22459
22460 <p>=a=
22461 b</p>
22462 !! wikitext
22463 <nowiki>=a=</nowiki>
22464 b
22465
22466 <nowiki>=a=</nowiki>
22467 b
22468
22469 <nowiki>=a=</nowiki>
22470 b
22471 !!end
22472
22473 !! test
22474 Headings: 6c. Heading chars in SOL context (leading newline break)
22475 !! options
22476 parsoid=html2wt
22477 !! html/parsoid
22478 <p>a
22479 =b=</p>
22480 !! wikitext
22481 a
22482 <nowiki>=b=</nowiki>
22483 !!end
22484
22485 !! test
22486 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22487 !! options
22488 parsoid=html2wt
22489 !! html/parsoid
22490 <!--c0--><p>=a=</p>
22491
22492 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22493 !! wikitext
22494 <!--c0--><nowiki>=a=</nowiki>
22495
22496 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22497 !!end
22498
22499 !! test
22500 Headings: 6d. Heading chars in SOL context (No escaping needed)
22501 !! options
22502 parsoid=html2wt
22503 !! html/parsoid
22504 =a=<div>b</div>
22505 !! wikitext
22506 =a=<div>b</div>
22507 !!end
22508
22509 !! test
22510 Headings: 7. Insert a newline between new content and headings
22511 !! options
22512 parsoid=html2wt
22513 !! html/parsoid
22514 <h2>NEW</h2>
22515 <p>new</p>
22516 <h2 data-parsoid='{}'>A</h2>
22517 <p data-parsoid='{}'>a</p>
22518 !! wikitext
22519 == NEW ==
22520 new
22521
22522 ==A==
22523 a
22524
22525 !! end
22526
22527 #### --------------- Lists ---------------
22528 #### 0. Outside nests (*foo, etc.)
22529 #### 1. Nested inside html <ul><li>*foo</li></ul>
22530 #### 2. Inside definition lists
22531 #### 3. Only bullets at start should be escaped
22532 #### 4. No escapes needed
22533 #### 5. No unnecessary escapes
22534 #### 6. Escape bullets in SOL position
22535 #### 7. Escape bullets in a multi-line context
22536 #### ----------------------------------------
22537
22538 !! test
22539 Lists: 0. Outside nests
22540 !! options
22541 parsoid=html2wt
22542 !! html/parsoid
22543 <p>*foo</p>
22544
22545 <p>#foo</p>
22546
22547 <p>;Foo:bar</p>
22548 !! wikitext
22549 <nowiki>*</nowiki>foo
22550
22551 <nowiki>#</nowiki>foo
22552
22553 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22554 !!end
22555
22556 !! test
22557 Lists: 1. Nested inside html
22558 !! options
22559 parsoid=html2wt
22560 !! html/parsoid
22561 <ul><li>*foo</li></ul>
22562 <ul><li>#foo</li></ul>
22563 <ul><li>:foo</li></ul>
22564 <ul><li>;foo</li></ul>
22565 <ol><li>*foo</li></ol>
22566 <ol><li>#foo</li></ol>
22567 <ol><li>:foo</li></ol>
22568 <ol><li>;foo</li></ol>
22569
22570 !! wikitext
22571 *<nowiki>*foo</nowiki>
22572
22573 *<nowiki>#foo</nowiki>
22574
22575 *<nowiki>:foo</nowiki>
22576
22577 *<nowiki>;foo</nowiki>
22578
22579 #<nowiki>*foo</nowiki>
22580
22581 #<nowiki>#foo</nowiki>
22582
22583 #<nowiki>:foo</nowiki>
22584
22585 #<nowiki>;foo</nowiki>
22586 !!end
22587
22588 !! test
22589 Lists: 2. Inside definition lists
22590 !! options
22591 parsoid=html2wt
22592 !! html/parsoid
22593 <dl><dt>;foo</dt></dl>
22594 <dl><dt>:foo</dt></dl>
22595 <dl><dt>:foo</dt>
22596 <dd>bar</dd></dl>
22597 <dl><dd>:foo</dd></dl>
22598
22599 !! wikitext
22600 ;<nowiki>;foo</nowiki>
22601
22602 ;<nowiki>:foo</nowiki>
22603
22604 ;<nowiki>:foo</nowiki>
22605 :bar
22606
22607 :<nowiki>:foo</nowiki>
22608 !!end
22609
22610 !! test
22611 Lists: 3. Only bullets at start of text should be escaped
22612 !! options
22613 parsoid=html2wt
22614 !! html/parsoid
22615 <ul><li>*foo*bar</li></ul>
22616 <ul><li>*foo<i>it</i>*bar</li></ul>
22617
22618 !! wikitext
22619 *<nowiki>*foo*bar</nowiki>
22620
22621 *<nowiki>*foo</nowiki>''it''*bar
22622 !!end
22623
22624 !! test
22625 Lists: 4. No escapes needed
22626 !! options
22627 parsoid=html2wt
22628 !! html/parsoid
22629 <ul>
22630 <li>foo*bar
22631 </li>
22632 </ul>
22633 <ul>
22634 <li><i>foo</i>*bar
22635 </li>
22636 </ul>
22637 <ul>
22638 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22639 </li>
22640 </ul>
22641 <ul>
22642 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22643 </li>
22644 </ul>
22645 !! wikitext
22646 *foo*bar
22647
22648 *''foo''*bar
22649
22650 *[[Foo]]: bar
22651
22652 *[[Foo]]*bar
22653 !!end
22654
22655 !! test
22656 Lists: 5. No unnecessary escapes
22657 !! options
22658 parsoid=html2wt
22659 !! html/parsoid
22660 <ul><li> bar <span>[[foo]]</span></li></ul>
22661 <ul><li> =bar <span>[[foo]]</span></li></ul>
22662 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22663 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22664 <ul><li> =bar <span>foo]]</span>=</li></ul>
22665 <ul><li> <s></s>: a</li></ul>
22666 <ul><li> <i>* foo</i></li></ul>
22667
22668 !! wikitext
22669 * bar <span><nowiki>[[foo]]</nowiki></span>
22670
22671 * =bar <span><nowiki>[[foo]]</nowiki></span>
22672
22673 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22674
22675 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22676
22677 * =bar <span>foo]]</span>=
22678
22679 * <s></s>: a
22680
22681 * ''* foo''
22682 !!end
22683
22684 !! test
22685 Lists: 6. Escape bullets in SOL position
22686 !! options
22687 parsoid=html2wt
22688 !! html/parsoid
22689 <p><!--cmt-->*foo</p>
22690 !! wikitext
22691 <!--cmt--><nowiki>*</nowiki>foo
22692 !!end
22693
22694 !! test
22695 Lists: 7. Escape bullets in a multi-line context
22696 !! options
22697 parsoid=html2wt
22698 !! html/parsoid
22699 <p>a
22700 *b
22701 </p>
22702 !! wikitext
22703 a
22704 <nowiki>*</nowiki>b
22705 !!end
22706
22707 !! test
22708 Lists: 8. Escape colons only if not present in tags
22709 !! options
22710 parsoid=html2wt
22711 !! html/parsoid
22712 <dl><dt>a:b<i>c:d</i></dt></dl>
22713 !! wikitext
22714 ; <nowiki>a:b</nowiki>''c:d''
22715 !! end
22716
22717 #### --------------- HRs ---------------
22718 #### 1. Single line
22719 #### -----------------------------------
22720
22721 !! test
22722 HRs: 1. Single line
22723 !! options
22724 parsoid=html2wt
22725 !! html/parsoid
22726 <hr />----
22727 <hr />=foo=
22728 <hr />*foo
22729 !! wikitext
22730 ----<nowiki>----</nowiki>
22731 ----=foo=
22732 ----*foo
22733 !! end
22734
22735 #### --------------- Tables ---------------
22736 #### 1a. Simple example
22737 #### 1b. No escaping needed (!foo)
22738 #### 1c. No escaping needed (|foo)
22739 #### 1d. No escaping needed (|}foo)
22740 ####
22741 #### 2a. Nested in td (<td>foo|bar</td>)
22742 #### 2b. Nested in td (<td>foo||bar</td>)
22743 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22744 ####
22745 #### 3a. Nested in th (<th>foo!bar</th>)
22746 #### 3b. Nested in th (<th>foo!!bar</th>)
22747 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22748 ####
22749 #### 4a. Escape -
22750 #### 4b. Escape +
22751 #### 4c. No escaping needed
22752 #### --------------------------------------
22753
22754 !! test
22755 Tables: 1a. Simple example
22756 !! options
22757 parsoid=html2wt
22758 !! html/parsoid
22759 <p>{|
22760 |}
22761 </p>
22762 !! wikitext
22763 <nowiki>{|</nowiki>
22764 |}
22765 !! end
22766
22767 !! test
22768 Tables: 1b. No escaping needed
22769 !! options
22770 parsoid=html2wt
22771 !! html/parsoid
22772 <p>!foo
22773 </p>
22774 !! wikitext
22775 !foo
22776 !! end
22777
22778 !! test
22779 Tables: 1c. No escaping needed
22780 !! options
22781 parsoid=html2wt
22782 !! html/parsoid
22783 <p>|foo
22784 </p>
22785 !! wikitext
22786 |foo
22787 !! end
22788
22789 !! test
22790 Tables: 1d. No escaping needed
22791 !! options
22792 parsoid=html2wt
22793 !! html/parsoid
22794 <p>|}foo
22795 </p>
22796 !! wikitext
22797 |}foo
22798 !! end
22799
22800 !! test
22801 Tables: 2a. Nested in td
22802 !! options
22803 parsoid=html2wt
22804 !! html/parsoid
22805 <table><tbody><tr>
22806 <td>foo|bar</td></tr>
22807 <tr><td>x<div>a|b</div></td>
22808 </tbody></table>
22809 !! wikitext
22810 {|
22811 |<nowiki>foo|bar</nowiki>
22812 |-
22813 |x<div><nowiki>a|b</nowiki></div>
22814 |}
22815 !! html/php+tidy
22816 <table>
22817 <tr>
22818 <td>foo|bar</td>
22819 </tr>
22820 <tr>
22821 <td>x
22822 <div>a|b</div>
22823 </td>
22824 </tr>
22825 </table>
22826 !! end
22827
22828 !! test
22829 Tables: 2b. Nested in td
22830 !! options
22831 parsoid=html2wt
22832 !! html/parsoid
22833 <table><tbody><tr>
22834 <td>foo||bar</td>
22835 <td>a<i>b||c</i></td>
22836 <td>a<i><div>b||c</div></i></td>
22837 </tr></tbody></table>
22838 !! wikitext
22839 {|
22840 |<nowiki>foo||bar</nowiki>
22841 |a''<nowiki>b||c</nowiki>''
22842 |a''<div><nowiki>b||c</nowiki></div>''
22843 |}
22844 !! html/php
22845 <table>
22846 <tr>
22847 <td>foo||bar
22848 </td>
22849 <td>a<i>b||c</i>
22850 </td>
22851 <td>a<i><div>b||c</div></i>
22852 </td></tr></table>
22853
22854 !! end
22855
22856 !! test
22857 Tables: 2c. Nested in td -- no escaping needed
22858 !! options
22859 parsoid=html2wt
22860 !! html/*
22861 <table>
22862
22863 <tr>
22864 <td>foo!!bar
22865 </td></tr></table>
22866
22867 !! wikitext
22868 {|
22869
22870 |foo!!bar
22871 |}
22872 !! end
22873
22874 !! test
22875 Tables: 3a. Nested in th
22876 !! options
22877 parsoid=html2wt
22878 !! html/*
22879 <table>
22880
22881 <tr>
22882 <th>foo!bar
22883 </th></tr></table>
22884
22885 !! wikitext
22886 {|
22887
22888 !foo!bar
22889 |}
22890 !! end
22891
22892 !! test
22893 Tables: 3b. Nested in th
22894 !! options
22895 parsoid=html2wt
22896 !! html/parsoid
22897 <table><tbody>
22898 <tr><th>foo!!bar</th>
22899 <th><i>foo|bar</i></th>
22900 <th><i>foo!!bar</i></th>
22901 <th><i><span>foo!!bar</span></i></th>
22902 </tr></tbody></table>
22903 !! wikitext
22904 {|
22905 !<nowiki>foo!!bar</nowiki>
22906 !''<nowiki>foo|bar</nowiki>''
22907 !''<nowiki>foo!!bar</nowiki>''
22908 !''<span><nowiki>foo!!bar</nowiki></span>''
22909 |}
22910 !! html/php
22911 <table>
22912 <tr>
22913 <th>foo!!bar
22914 </th>
22915 <th><i>foo|bar</i>
22916 </th>
22917 <th><i>foo!!bar</i>
22918 </th>
22919 <th><i><span>foo!!bar</span></i>
22920 </th></tr></table>
22921
22922 !! end
22923
22924 !! test
22925 Tables: 3c. Nested in th
22926 !! options
22927 parsoid=html2wt
22928 !! html/parsoid
22929 <table><tbody>
22930 <tr><th>foo||bar</th>
22931 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22932 </tr></tbody></table>
22933 !! wikitext
22934 {|
22935 !<nowiki>foo||bar</nowiki>
22936 !<nowiki>foo||bar</nowiki>
22937 |}
22938 !! html/php
22939 <table>
22940 <tr>
22941 <th>foo||bar
22942 </th>
22943 <th>foo||bar
22944 </th></tr></table>
22945
22946 !! end
22947
22948 !! test
22949 Tables: 4a. Escape -
22950 !! options
22951 parsoid=html2wt
22952 !! html/*
22953 <table>
22954
22955 <tr>
22956 <th>-bar
22957 </th></tr>
22958 <tr>
22959 <td>-bar
22960 </td></tr></table>
22961
22962 !! wikitext
22963 {|
22964
22965 !-bar
22966
22967 |-
22968 |<nowiki>-bar</nowiki>
22969 |}
22970 !! end
22971
22972 !! test
22973 Tables: 4b. Escape +
22974 !! options
22975 parsoid=html2wt
22976 !! html/*
22977 <table>
22978
22979 <tr>
22980 <th>+bar
22981 </th></tr>
22982 <tr>
22983 <td>+bar
22984 </td></tr></table>
22985
22986 !! wikitext
22987 {|
22988
22989 !+bar
22990
22991 |-
22992 |<nowiki>+bar</nowiki>
22993 |}
22994 !! end
22995
22996 !! test
22997 Tables: 4c. No escaping needed
22998 !! options
22999 parsoid=html2wt
23000 !! html/parsoid
23001 <table><tbody>
23002 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23003 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23004 <tr><td>foo
23005 <p>bar|baz
23006 +bar
23007 -bar</p></td></tr>
23008 <tr><td>x
23009 <div>a|b</div></td>
23010 </tbody></table>
23011 !! wikitext
23012 {|
23013 |foo-bar
23014 |foo+bar
23015 |-
23016 |''foo''-bar
23017 |''foo''+bar
23018 |-
23019 |foo
23020 bar|baz
23021 +bar
23022 -bar
23023 |-
23024 |x
23025 <div>a|b</div>
23026 |}
23027 !! html/php
23028 <table>
23029 <tr>
23030 <td>foo-bar
23031 </td>
23032 <td>foo+bar
23033 </td></tr>
23034 <tr>
23035 <td><i>foo</i>-bar
23036 </td>
23037 <td><i>foo</i>+bar
23038 </td></tr>
23039 <tr>
23040 <td>foo
23041 <p>bar|baz
23042 +bar
23043 -bar
23044 </p>
23045 </td></tr>
23046 <tr>
23047 <td>x
23048 <div>a|b</div>
23049 </td></tr></table>
23050
23051 !! end
23052
23053 !! test
23054 Tables: 4d. No escaping needed
23055 !! options
23056 parsoid=html2wt
23057 !! html/parsoid
23058 <table>
23059 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23060 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23061 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23062 </tbody></table>
23063 !! wikitext
23064 {|
23065 |[[Foo]]-bar
23066 ||+1
23067 ||-2
23068 |}
23069 !! html/php
23070 <table>
23071 <tr>
23072 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23073 </td>
23074 <td>+1
23075 </td>
23076 <td>-2
23077 </td></tr></table>
23078
23079 !! end
23080
23081 !! test
23082 T97430: Don't emit empty nowiki pairs around marker meta tags
23083 !! options
23084 parsoid=html2wt
23085 !! html/parsoid
23086 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23087 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23088 !! wikitext
23089 <nowiki>*</nowiki>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.
23091 !! end
23092
23093 !! test
23094 Unclosed xmlish element in table line shouldn't eat end delimiters
23095 !! options
23096 parsoid=html2wt
23097 !! html/parsoid
23098 <table>
23099 <tbody><tr><td> &lt;foo</td>
23100 <td> bar></td></tr>
23101 </tbody></table>
23102 !! wikitext
23103 {|
23104 | <foo
23105 | bar>
23106 |}
23107 !! html/php
23108 <table>
23109 <tr>
23110 <td> &lt;foo
23111 </td>
23112 <td> bar&gt;
23113 </td></tr></table>
23114
23115 !! end
23116
23117 #### --------------- Links ----------------
23118 #### 1. Quote marks in link text
23119 #### 2. Wikilinks: Escapes needed
23120 #### 3. Wikilinks: No escapes needed
23121 #### 4. Extlinks: Escapes needed
23122 #### 5. Extlinks: No escapes needed
23123 #### --------------------------------------
23124 !! test
23125 Links 1. WikiLinks: No escapes needed
23126 !! options
23127 parsoid=html2wt
23128 !! html/parsoid
23129 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23130 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23131 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23132 !! wikitext
23133 [[Foo|Foo''boo'']]
23134 [[Foo|[Foobar]]]
23135 [[Foo|x [Foobar] x]]
23136 !! html/php
23137 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23138 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23139 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23140 </p>
23141 !! end
23142
23143 !! test
23144 Links 2. WikiLinks: Escapes needed
23145 !! options
23146 parsoid=html2wt
23147 !! html/parsoid
23148 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23149 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23150 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23151 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23152 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23153 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23154 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23155 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23156 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23157 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23158 !! wikitext
23159 [[Foo|<nowiki>Foobar]</nowiki>]]
23160 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23161 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23162 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23163 [[Foo|<nowiki>|Bar</nowiki>]]
23164 [[Foo|<nowiki>]]bar</nowiki>]]
23165 [[Foo|<nowiki>[[bar</nowiki>]]
23166 [[Foo|<nowiki>x [[ y</nowiki>]]
23167 [[Foo|<nowiki>x ]] y</nowiki>]]
23168 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23169 !! html/php
23170 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23171 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23172 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23173 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23174 <a href="/wiki/Foo" title="Foo">|Bar</a>
23175 <a href="/wiki/Foo" title="Foo">]]bar</a>
23176 <a href="/wiki/Foo" title="Foo">[[bar</a>
23177 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23178 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23179 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23180 </p>
23181 !! end
23182
23183 !! test
23184 Links 3. WikiLinks: No escapes needed
23185 !! options
23186 parsoid=html2wt
23187 !! html/parsoid
23188 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23189 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23190 !! wikitext
23191 [[Foo|[Foobar]]
23192 [[Foo|foo|bar]]
23193 !! html/php
23194 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23195 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23196 </p>
23197 !! end
23198
23199 !! test
23200 Links 4. ExtLinks: Escapes needed
23201 !! options
23202 parsoid=html2wt
23203 !! html/parsoid
23204 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23205 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23206 <p>[http://google.com]</p>
23207 <p>[http://google.com google]</p>
23208 !! wikitext
23209 [http://google.com <nowiki>[google]</nowiki>]
23210 [http://google.com <nowiki>google]</nowiki>]
23211
23212 <nowiki>[http://google.com]</nowiki>
23213
23214 <nowiki>[http://google.com google]</nowiki>
23215
23216 !! html/php
23217 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23218 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23219 </p><p>[http://google.com]
23220 </p><p>[http://google.com google]
23221 </p>
23222 !! end
23223
23224 !! test
23225 Links 5. ExtLinks: No escapes needed
23226 !! options
23227 parsoid=html2wt
23228 !! html/parsoid
23229 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23230 !! wikitext
23231 [http://google.com [google]
23232 !! html/php
23233 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23234 </p>
23235 !! end
23236
23237 !! test
23238 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23239 !! options
23240 parsoid=html2wt
23241 !! html/parsoid
23242 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23243 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23244 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23245 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23246 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23247 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23248 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23249 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23250 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23251 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23252 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23253 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23254 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23255 </p>
23256 !! wikitext
23257 x<nowiki/>http://example.com<nowiki/>y
23258 http://example.com<nowiki/>?x
23259 http://example.com<nowiki/>&x
23260 http://example.com<nowiki/>'x
23261 http://example.com<nowiki/>,x
23262 http://example.com<nowiki/>.x
23263 http://example.com<nowiki/>;x
23264 http://example.com<nowiki/>:x
23265 http://example.com<nowiki/>;x
23266 http://example.com<nowiki/>!x
23267 http://example.com<nowiki/>=x
23268 http://example.com<nowiki/>(x)
23269 http://example.com(x<nowiki/>)
23270 !! end
23271
23272 !! test
23273 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23274 !! options
23275 parsoid=html2wt
23276 !! html/parsoid
23277 <p>x
23278 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23279 y
23280 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23281 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23282 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23283 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23284 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23285 </p>
23286 !! wikitext
23287 x
23288 http://example.com
23289 y
23290 "http://example.com"
23291 (http://example.com)
23292 (http://example.com) foo
23293 http://example.com,
23294 http://example.com, foo
23295 !! html/php
23296 <p>x
23297 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23298 y
23299 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23300 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23301 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23302 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23303 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23304 </p>
23305 !! end
23306
23307 !! test
23308 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23309 !! options
23310 parsoid=html2wt
23311 !! html/parsoid
23312 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23313 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23314 !! wikitext
23315 http://example.com.,;:!?\
23316 -http://example.com:
23317 !! html/php
23318 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23319 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23320 </p>
23321 !! end
23322
23323 !! test
23324 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23325 !! options
23326 parsoid=html2wt
23327 !! html/parsoid
23328 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23329 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23330 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23331 !! wikitext
23332 RFC 123<nowiki/>4
23333 RFC 123<nowiki/>y
23334 X<nowiki/>RFC 123<nowiki/>y
23335 !! end
23336
23337 !! test
23338 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23339 !! options
23340 parsoid=html2wt
23341 !! html/parsoid
23342 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23343 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23344 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23345 </p>
23346 !! wikitext
23347 RFC 123?foo
23348 RFC 123&foo
23349 -RFC 123-
23350 !! html/php
23351 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23352 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23353 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23354 </p>
23355 !! end
23356
23357 !! test
23358 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23359 !! options
23360 parsoid=html2wt
23361 !! html/parsoid
23362 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23363 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23364 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23365 !! wikitext
23366 PMID 123<nowiki/>4
23367 PMID 123<nowiki/>y
23368 X<nowiki/>PMID 123<nowiki/>y
23369 !! end
23370
23371 !! test
23372 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23373 !! options
23374 parsoid=html2wt
23375 !! html/parsoid
23376 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23377 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23378 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23379 </p>
23380 !! wikitext
23381 PMID 123?foo
23382 PMID 123&foo
23383 -PMID 123-
23384 !! html/php
23385 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23386 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23387 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23388 </p>
23389 !! end
23390
23391 !! test
23392 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23393 !! options
23394 parsoid=html2wt
23395 !! html/parsoid
23396 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23397 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23398 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23399 </p>
23400 !! wikitext
23401 ISBN 1234567890<nowiki/>1
23402 ISBN 1234567890<nowiki/>x
23403 a<nowiki/>ISBN 1234567890<nowiki/>b
23404 !! end
23405
23406 !! test
23407 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23408 !! options
23409 parsoid=html2wt
23410 !! html/parsoid
23411 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23412 !! wikitext
23413 -ISBN 1234567890's
23414 !! html/php
23415 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23416 </p>
23417 !! end
23418
23419 !! test
23420 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23421 !! options
23422 parsoid=html2wt
23423 !! html/*
23424 <p>this is not a link: http://example.com
23425 </p>
23426 !! wikitext
23427 this is not a link: <nowiki>http://example.com</nowiki>
23428 !! end
23429
23430 !! test
23431 Links 15. Link trails can't become link prefixes.
23432 !! options
23433 language=is
23434 parsoid=html2wt
23435 !! html/parsoid
23436 <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>
23437 !! wikitext
23438 [[Söfnuður]]-[[00]]
23439 !! html/php
23440 <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>
23441 </p>
23442 !! end
23443
23444 #### --------------- Quotes ---------------
23445 #### 1. Quotes inside <b> and <i>
23446 #### 2. Link fragments separated by <i> and <b> tags
23447 #### 3. Link fragments inside <i> and <b>
23448 #### 4. No escaping needed
23449 #### --------------------------------------
23450 !! test
23451 1a. Quotes inside <b> and <i>
23452 !! options
23453 parsoid=html2wt
23454 !! html/*
23455 <p><i>'foo'</i>
23456 <i>''foo''</i>
23457 <i>'''foo'''</i>
23458 <i>foo</i>'s
23459 <b>'foo'</b>
23460 <b>''foo''</b>
23461 <b>'''foo'''</b>
23462 <b>foo'<i>bar'</i>baz</b>
23463 <b>foo</b>'s
23464 '<i>foo</i>
23465 <i>foo</i>'
23466 <i>foo'</i>'
23467 '<i>foo</i>'
23468 '<b>foo</b>
23469 <b>foo</b>'
23470 '<b>foo</b>'
23471 <i>fools'<span> errand</span></i>
23472 <i><span>fool</span>'s errand</i>
23473 '<i>foo</i> bar '<i>baz</i>
23474 a|!*#-:;+-~[]{}b'<i>x</i>
23475 </p>
23476 !! wikitext
23477 ''<nowiki/>'foo'''
23478 ''<nowiki>''foo''</nowiki>''
23479 ''<nowiki>'''foo'''</nowiki>''
23480 ''foo''<nowiki/>'s
23481 '''<nowiki/>'foo''''
23482 '''<nowiki>''foo''</nowiki>'''
23483 '''<nowiki>'''foo'''</nowiki>'''
23484 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23485 '''foo'''<nowiki/>'s
23486 '''foo''
23487 ''foo''<nowiki/>'
23488 ''foo'''<nowiki/>'
23489 '''foo''<nowiki/>'
23490 ''''foo'''
23491 '''foo'''<nowiki/>'
23492 ''''foo'''<nowiki/>'
23493 ''fools'<span> errand</span>''
23494 ''<span>fool</span>'s errand''
23495 '<nowiki/>''foo'' bar '''baz''
23496 a|!*#-:;+-~[]{}b'''x''
23497 !! end
23498
23499 !! test
23500 1b. Quotes inside <b> and <i> with other tags on same line
23501 !! options
23502 parsoid=html2wt
23503 !! html/parsoid
23504 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23505 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23506 <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>
23507 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23508 '<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>
23509 '<i>foo</i> <div title="name">test</div>
23510 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23511 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23512 <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>
23513 </ol>
23514 !! wikitext
23515 '''a'' foo ''[[bar]]''
23516 ''a''' foo ''[[bar]]''
23517 ''a''' foo '''{{echo|[[bar]]}}'''
23518 [[foo]] x'''[[bar]]''
23519 '''foo'' <ref>test</ref>
23520 '''foo'' <div title="name">test</div>
23521 '''foo'' and <br> bar
23522 <references />
23523 !! end
23524
23525 !! test
23526 2. Link fragments separated by <i> and <b> tags
23527 !! options
23528 parsoid=html2wt
23529 !! html/parsoid
23530 <p>[[<i>foo</i>hello]]</p>
23531 <p>[[<b>foo</b>hello]]</p>
23532 !! wikitext
23533 [[''foo''<nowiki>hello]]</nowiki>
23534
23535 [['''foo'''<nowiki>hello]]</nowiki>
23536 !! end
23537
23538 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23539 # this is one of the shortcomings of this format
23540 !! test
23541 3. Link fragments inside <i> and <b>
23542 !! options
23543 parsoid=html2wt
23544 !! html/parsoid
23545 <p><i>[[foo</i>]]</p>
23546 <p><b>[[foo</b>]]</p>
23547 !! wikitext
23548 ''[[foo''<nowiki>]]</nowiki>
23549
23550 '''[[foo'''<nowiki>]]</nowiki>
23551 !! end
23552
23553 !! test
23554 4. No escaping needed
23555 !! options
23556 options=html2wt
23557 !! html/parsoid
23558 <p>'<span><i>bar</i></span>'
23559 '<span><b>bar</b></span>'
23560 'a:b'foo
23561 </p>
23562 !! wikitext
23563 '<span>''bar''</span>'
23564 '<span>'''bar'''</span>'
23565 'a:b'foo
23566 !! end
23567
23568 #### ----------- Paragraphs ---------------
23569 #### 1. No unnecessary escapes
23570 #### --------------------------------------
23571
23572 !! test
23573 1. No unnecessary escapes
23574 !! options
23575 parsoid=html2wt
23576 !! html/parsoid
23577 <p>bar <span>[[foo]]</span>
23578 </p><p>=bar <span>[[foo]]</span>
23579 </p><p>[[bar <span>[[foo]]</span>
23580 </p><p>]]bar <span>[[foo]]</span>
23581 </p><p>=bar <span>foo]]</span>=
23582 </p>
23583 !! wikitext
23584 bar <span><nowiki>[[foo]]</nowiki></span>
23585
23586 =bar <span><nowiki>[[foo]]</nowiki></span>
23587
23588 [[bar <span><nowiki>[[foo]]</nowiki></span>
23589
23590 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23591
23592 =bar <span>foo]]</span><nowiki>=</nowiki>
23593 !!end
23594
23595 #### ----------------------- PRE --------------------------
23596 #### 1. Leading whitespace in SOL context should be escaped
23597 #### ------------------------------------------------------
23598 !! test
23599 1. Leading whitespace in SOL context should be escaped
23600 !! options
23601 parsoid=html2wt
23602 !! html/parsoid
23603 <p> a</p>
23604
23605 <p> a</p>
23606
23607 <p> a(tab)</p>
23608
23609 <p> a
23610 <!--cmt-->
23611 a</p>
23612
23613 <p>a
23614 b</p>
23615
23616 <p>a
23617 b</p>
23618
23619 <p>a
23620 b</p>
23621 !! wikitext
23622 <nowiki> </nowiki>a
23623
23624 <nowiki> </nowiki> a
23625
23626 a(tab)
23627
23628 <nowiki> </nowiki> a
23629 <!--cmt-->
23630 <nowiki> </nowiki>a
23631
23632 a
23633 <nowiki> </nowiki>b
23634
23635 a
23636 b
23637
23638 a
23639 b
23640 !! html/php
23641 <p> a
23642 </p><p> a
23643 </p><p> a(tab)
23644 </p><p> a
23645 a
23646 </p><p>a
23647 b
23648 </p><p>a
23649 b
23650 </p><p>a
23651 b
23652 </p>
23653 !! end
23654
23655 !! test
23656 2. Leading whitespace in non-indent-pre contexts should not be escaped
23657 !! options
23658 parsoid=htm2wt
23659 !! html/parsoid
23660 <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>
23661 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23662 <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>
23663 b</span></li>
23664 </ol>
23665 !! wikitext
23666 foo <ref>''a''
23667 b</ref>
23668 <references />
23669 !! end
23670
23671 !! test
23672 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23673 !! options
23674 parsoid=html2wt
23675 !! html/parsoid
23676 <blockquote>
23677 <p>
23678 a
23679 <span>b</span>
23680 c</p>
23681 </blockquote>
23682 !! wikitext
23683 <blockquote>
23684 a
23685 <span>b</span>
23686 c
23687 </blockquote>
23688 !! end
23689
23690 !! test
23691 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23692 !! options
23693 options=html2wt
23694 !! html/parsoid
23695 <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>
23696 !! wikitext
23697 [[File:Foobar.jpg|thumb|caption]]
23698 !! end
23699
23700 !! test
23701 5. Nowiki escaping should account for indent-pres
23702 !! options
23703 parsoid=html2wt
23704 !! html/parsoid
23705 <pre>==foo==</pre>
23706 !! wikitext
23707 ==foo==
23708 !! end
23709
23710 !!test
23711 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23712 !! options
23713 parsoid=html2wt
23714 !! html/parsoid
23715 <pre>
23716 * foo
23717 * bar
23718 </pre>
23719 !! wikitext
23720 * foo
23721 * bar
23722 !! end
23723
23724 #### --------------- Behavior Switches --------------------
23725
23726 !! test
23727 1. Valid behavior switches should be escaped
23728 !! options
23729 parsoid=html2wt
23730 !! html/parsoid
23731 __TOC__
23732 <i>__TOC__</i>
23733 !! wikitext
23734 <nowiki>__TOC__</nowiki>
23735 ''<nowiki>__TOC__</nowiki>''
23736 !! end
23737
23738 !! test
23739 2. Invalid behavior switches should not be escaped
23740 !! options
23741 parsoid=html2wt
23742 !! html/parsoid
23743 __TOO__
23744 __|__
23745 !! wikitext
23746 __TOO__
23747 __|__
23748 !! end
23749
23750 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23751 !! test
23752 Behavior switches should be SOL-transparent
23753 !! options
23754 parsoid=html2wt
23755 !! html/parsoid
23756 <meta property="mw:PageProp/toc" />
23757
23758 <!-- this one's bogus -->
23759 <pre>__TOO__</pre>
23760
23761 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23762
23763 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23764 !! wikitext
23765 __TOC__
23766
23767 <!-- this one's bogus -->
23768 __TOO__
23769
23770 __TOC__ foo
23771
23772 __TOC__
23773 bar
23774 !! end
23775
23776 #### --------------- HTML tags ---------------
23777 #### 1. a tags
23778 #### 2. other tags
23779 #### 3. multi-line html tag
23780 #### 4. extension tags
23781 #### -----------------------------------------
23782 !! test
23783 1. a tags
23784 !! options
23785 parsoid=html2wt
23786 !! html/parsoid
23787 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23788 !! wikitext
23789 <a href="http://google.com">google</a>
23790 !! end
23791
23792 !! test
23793 2. other tags
23794 !! options
23795 parsoid=html2wt
23796 !! html/parsoid
23797 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23798 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23799 <li> &lt;td&gt;</li></ul>
23800
23801 !! wikitext
23802 * <nowiki><div>foo</div></nowiki>
23803 * <nowiki><div style="color:red">foo</div></nowiki>
23804 * <nowiki><td></nowiki>
23805 !! end
23806
23807 !! test
23808 3. multi-line html tag
23809 !! options
23810 parsoid=html2wt
23811 !! html/parsoid
23812 <p>&lt;div
23813 &gt;foo&lt;/div
23814 &gt;
23815 </p>
23816 !! wikitext
23817 <nowiki><div
23818 >foo</div
23819 ></nowiki>
23820 !! end
23821
23822 !! test
23823 4. extension tags
23824 !! options
23825 parsoid=html2wt
23826 !! html/parsoid
23827 <p>&lt;ref&gt;foo&lt;/ref&gt;
23828 </p><p>&lt;ref&gt;bar
23829 </p><p>baz&lt;/ref&gt;
23830 </p>
23831 !! wikitext
23832 <nowiki><ref>foo</ref></nowiki>
23833
23834 <nowiki><ref>bar</nowiki>
23835
23836 baz<nowiki></ref></nowiki>
23837 !! end
23838
23839 #### --------------- Others ---------------
23840 !! test
23841 Escaping nowikis
23842 !! options
23843 parsoid=html2wt
23844 !! html/parsoid
23845 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23846 </p>
23847 !! wikitext
23848 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23849 !! end
23850
23851 ## The quote-char in the input is necessary for triggering the bug
23852 !! test
23853 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23854 !! options
23855 parsoid=html2wt
23856 !! html/parsoid
23857 <p>foo's bar :</p>
23858 !! wikitext
23859 foo's bar :
23860 !! end
23861
23862 #----------- End of wikitext escaping tests --------------
23863
23864 !! test
23865
23866 Tag-like HTML structures are passed through as text
23867 !! wikitext
23868 <x y>
23869
23870 <x.y>
23871
23872 <x-y>
23873
23874 1>2
23875
23876 x<y
23877
23878 a>b
23879
23880 1<d e>f
23881 !! html
23882 <p>&lt;x y&gt;
23883 </p><p>&lt;x.y&gt;
23884 </p><p>&lt;x-y&gt;
23885 </p><p>1&gt;2
23886 </p><p>x&lt;y
23887 </p><p>a&gt;b
23888 </p><p>1&lt;d e&gt;f
23889 </p>
23890 !! end
23891
23892 !! test
23893 HTML tag with necessary entities in attributes
23894 !! wikitext
23895 <span title="&amp;amp;">foo</span>
23896 !! html
23897 <p><span title="&amp;amp;">foo</span>
23898 </p>
23899 !! end
23900
23901 !! test
23902 HTML tag with 'unnecessary' entity encoding in attributes
23903 !! wikitext
23904 <span title="&amp;">foo</span>
23905 !! html
23906 <p><span title="&amp;">foo</span>
23907 </p>
23908 !! end
23909
23910 !! test
23911 HTML tag with broken attribute value quoting
23912 !! wikitext
23913 <span title="Hello world>Foo</span>
23914 !! html/php
23915 <p><span title="Hello world">Foo</span>
23916 </p>
23917 !! html/parsoid
23918 <p><span title="Hello world">Foo</span>
23919 </p>
23920 !! end
23921
23922 !! test
23923 Self-closed tag with broken attribute value quoting
23924 !! options
23925 parsoid=wt2html,html2html
23926 !! wikitext
23927 <div title="Hello world />Foo
23928 !! html/php+tidy
23929 <div title="Hello world"></div>
23930 <p>Foo</p>
23931 !! html/parsoid
23932 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
23933 !! end
23934
23935 !! test
23936 Table with broken attribute value quoting
23937 !! wikitext
23938 {|
23939 | title="Hello world|Foo
23940 |}
23941 !! html/php
23942 <table>
23943 <tr>
23944 <td title="Hello world">Foo
23945 </td></tr></table>
23946
23947 !! html/parsoid
23948 <table>
23949 <tr>
23950 <td title="Hello world">Foo
23951 </td></tr></table>
23952
23953 !! end
23954
23955 !! test
23956 Table with broken attribute value quoting on consecutive lines
23957 !! wikitext
23958 {|
23959 | title="Hello world|Foo
23960 | style="color:red|Bar
23961 |}
23962 !! html/php
23963 <table>
23964 <tr>
23965 <td title="Hello world">Foo
23966 </td>
23967 <td style="color:red">Bar
23968 </td></tr></table>
23969
23970 !! html/parsoid
23971 <table><tbody>
23972 <tr>
23973 <td title="Hello world">Foo
23974 </td><td style="color: red">Bar
23975 </td></tr></tbody></table>
23976
23977 !! end
23978
23979 !! test
23980 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23981 !! options
23982 parsoid
23983 !! wikitext
23984 {{}}
23985 !! html
23986 {{}}
23987 !! end
23988
23989 !! test
23990 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23991 !! options
23992 parsoid
23993 !! wikitext
23994 }}{{
23995 !! html
23996 }}{{
23997 !! end
23998
23999 !!test
24000 Accept empty td cell attribute
24001 !! wikitext
24002 {|
24003 | align="center" | foo || |
24004 |}
24005 !! html
24006 <table>
24007 <tr>
24008 <td align="center"> foo </td>
24009 <td>
24010 </td></tr></table>
24011
24012 !!end
24013
24014 !!test
24015 Non-empty attributes in th-cells
24016 !! wikitext
24017 {|
24018 ! Foo !! style="color: red" | Bar
24019 |}
24020 !! html
24021 <table>
24022 <tr>
24023 <th> Foo </th>
24024 <th style="color: red"> Bar
24025 </th></tr></table>
24026
24027 !!end
24028
24029 !!test
24030 Accept empty attributes in th-cells
24031 !! wikitext
24032 {|
24033 !| foo !!| bar
24034 |}
24035 !! html
24036 <table>
24037 <tr>
24038 <th> foo </th>
24039 <th> bar
24040 </th></tr></table>
24041
24042 !!end
24043
24044 !!test
24045 Empty table rows go away
24046 !! wikitext
24047 {|
24048 | Hello
24049 | there
24050 |- class="foo"
24051 |-
24052 |}
24053 !! html
24054 <table>
24055 <tr>
24056 <td> Hello
24057 </td>
24058 <td> there
24059 </td></tr>
24060
24061 </table>
24062
24063 !! end
24064
24065 ###
24066 ### Parsoid-centric tests for testing RTing of inter-element separators
24067 ### Edge cases not tested by existing parser tests and specific to
24068 ### Parsoid-specific serialization strategies.
24069 ###
24070
24071 !!test
24072 RT-ed inter-element separators should be valid separators
24073 !! wikitext
24074 {|
24075 |- [[foo]]
24076 |}
24077 !! html/php
24078 <table>
24079
24080 </table>
24081
24082 !! html/parsoid
24083 <table>
24084 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24085 </tbody></table>
24086 !!end
24087
24088 # Parsoid-only since PHP parser relies on Tidy for correct output
24089 !!test
24090 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24091 !!options
24092 parsoid
24093 !! wikitext
24094 {|
24095 |<small>foo
24096 bar
24097 |}
24098
24099 {|
24100 |<small>foo<small>
24101 |}
24102 !! html
24103 <table>
24104 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24105 <p>bar</p></small></td></tr>
24106 </tbody></table>
24107
24108 <table>
24109 <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>
24110 </tbody></table>
24111 !!end
24112
24113 # Note that the "style" attribute is really a template parameter here.
24114 # The = would have to be {{=}} if you wanted the literal.
24115 !!test
24116 Empty TD followed by TD with tpl-generated attribute
24117 !! wikitext
24118 {|
24119 |-
24120 |
24121 |{{echo|style='color:red'}}|foo
24122 |}
24123 !! html
24124 <table>
24125
24126 <tr>
24127 <td>
24128 </td>
24129 <td>foo
24130 </td></tr></table>
24131
24132 !!end
24133
24134 !!test
24135 Indented table with an empty td
24136 !! wikitext
24137 {|
24138 |-
24139 |
24140 |foo
24141 |}
24142 !! html
24143 <table>
24144
24145 <tr>
24146 <td>
24147 </td>
24148 <td>foo
24149 </td></tr></table>
24150
24151 !!end
24152
24153 ## We have some newline diffs RT-ing this edge case
24154 ## and it is not important enough -- we seem to be emitting
24155 ## at most 2 newlines after a </tr> and this is unrelated to
24156 ## the issue from T85627 that this is testing.
24157 !!test
24158 Indented table with blank lines in between (T85627)
24159 !! options
24160 parsoid=wt2html
24161 !! wikitext
24162 {|
24163 |foo
24164
24165
24166 |}
24167 !! html
24168 <table>
24169
24170 <tr>
24171 <td>foo
24172 </td></tr></table>
24173
24174 !!end
24175
24176 !!test
24177 Indented block & table
24178 !! wikitext
24179 <div>foo</div>
24180 {|
24181 |foo
24182 |}
24183 !! html/php
24184 <div>foo</div>
24185 <table>
24186 <tr>
24187 <td>foo
24188 </td></tr></table>
24189
24190 !! html/parsoid
24191 <div data-parsoid='{"stx":"html"}'>foo</div>
24192 <table><tbody>
24193 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24194 </tbody></table>
24195 !!end
24196
24197 !! test
24198 Indent and comment before table row
24199 !! wikitext
24200 {|
24201 <!--hi-->|-
24202 | there
24203 |}
24204 !! html/php
24205 <table>
24206
24207 <tr>
24208 <td> there
24209 </td></tr></table>
24210
24211 !! html/parsoid
24212 <table>
24213 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24214 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24215 </tbody></table>
24216 !! end
24217
24218 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24219 !!test
24220 Empty TR followed by a template-generated TR
24221 !!options
24222 parsoid
24223 !! wikitext
24224 {|
24225 |-
24226 {{echo|<tr><td>foo</td></tr>}}
24227 |}
24228 !! html
24229 <table>
24230 <tbody>
24231 <tr></tr>
24232 <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}}]}'>
24233 <td>foo</td></tr>
24234 </tbody></table>
24235 !!end
24236
24237 ## PHP and parsoid output differ for this, and since this is primarily
24238 ## for testing Parsoid's serializer, marking this Parsoid only
24239 !!test
24240 Empty TR followed by mixed-ws-comment line should RT correctly
24241 !!options
24242 parsoid
24243 !! wikitext
24244 {|
24245 |-
24246 <!--c-->
24247 |-
24248 <!--c--> <!--d-->
24249 |}
24250 !! html
24251 <table>
24252 <tbody>
24253 <tr></tr>
24254 <!--c-->
24255 <tr>
24256 <!--c--> </tr><!--d-->
24257 </tbody></table>
24258
24259 !!end
24260
24261 !!test
24262 Multi-line image caption generated by templates with/without trailing newlines
24263 !! wikitext
24264 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24265 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24266 !! html/parsoid
24267 <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>
24268 <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>
24269 !!end
24270
24271 !! test
24272 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24273 !! options
24274 parsoid=html2wt
24275 !! html/parsoid
24276 <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>
24277
24278 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24279 !! wikitext
24280 <includeonly>foo</includeonly>
24281 new para
24282
24283 [[Category:Foo]]
24284
24285 = new heading =
24286 !! end
24287
24288 ## PHP emits broken html for this, and since this is primarily
24289 ## a Parsoid serializer test, marking this Parsoid only
24290 !!test
24291 Improperly nested inline or quotes tags with whitespace in between
24292 !! wikitext
24293 <span> <s>x</span> </s>
24294 ''' ''x''' ''
24295 !! html/parsoid
24296 <p><span> <s>x</s></span><s> </s>
24297 <b> <i>x</i></b><i> </i>
24298 </p>
24299 !!end
24300
24301 !!test
24302 Encapsulate protected attributes from wt
24303 !! wikitext
24304 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24305 !! html/parsoid
24306 <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>
24307 </body>
24308 !!end
24309
24310 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24311 ## Having nested or stray pre tags results in the attempt to add duplicates,
24312 ## causing an assertion fail. This test tries to prevent that situation.
24313 !!test
24314 Ensure ParagraphWrapper can deal with stray closing pre tags
24315 !!options
24316 parsoid=wt2html
24317 !! wikitext
24318 plain text</pre>
24319 !! html/parsoid
24320 plain text
24321 !!end
24322
24323 !!test
24324 1. Ensure fostered text content is wrapped in element nodes
24325 !!options
24326 parsoid=wt2html
24327 !! wikitext
24328 <table>hi</table><table>ho</table>
24329 !! html/parsoid
24330 <p>hi</p>
24331 <table></table>
24332 <p>ho</p>
24333 <table></table>
24334 !!end
24335
24336 !!test
24337 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24338 !!options
24339 parsoid=wt2html,wt2wt
24340 !! wikitext
24341 <table>
24342 <tr> || ||
24343 <td> a
24344 </table>
24345 !! html/parsoid
24346 <p> || ||
24347 </p><table>
24348 <tbody><tr><td> a</td></tr>
24349 </tbody></table>
24350 !!end
24351
24352 !!test
24353 Encapsulation properly handles null DSR information from foster box
24354 !!options
24355 parsoid=wt2html,wt2wt
24356 !! wikitext
24357 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24358 !! html/parsoid
24359 <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>
24360 !!end
24361
24362 !!test
24363 1. Encapsulate foster-parented transclusion content
24364 !!options
24365 parsoid=wt2wt,wt2html
24366 !! wikitext
24367 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24368 !! html/parsoid
24369 <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>
24370 <tbody>
24371 <tr>
24372 <td>bar</td>
24373 </tr>
24374 </tbody>
24375 </table>
24376 !!end
24377
24378 !!test
24379 2. Encapsulate foster-parented transclusion content
24380 !!options
24381 parsoid=wt2wt,wt2html
24382 !! wikitext
24383 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24384 !! html/parsoid
24385 <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>
24386 <table>
24387 <tbody>
24388 <tr>
24389 <td>bar</td>
24390 </tr>
24391 </tbody>
24392 </table>
24393 !!end
24394
24395 !!test
24396 3. Encapsulate foster-parented transclusion content
24397 !!options
24398 parsoid=wt2wt,wt2html
24399 !! wikitext
24400 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24401 !! html/parsoid
24402 <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;]}">
24403 <p>foo</p>
24404 </div>
24405 <table>
24406 <tbody>
24407 <tr>
24408 <td>bar</td>
24409 </tr>
24410 </tbody>
24411 </table>
24412 !!end
24413
24414 !!test
24415 4. Encapsulate foster-parented transclusion content
24416 !!options
24417 parsoid=wt2wt,wt2html
24418 !! wikitext
24419 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24420 !! html/parsoid
24421 <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;]}">
24422 <p>foo</p>
24423 </div>
24424 <table>
24425 <tbody>
24426 <tr>
24427 <td>bar</td>
24428 </tr>
24429 </tbody>
24430 </table>
24431 !!end
24432
24433 !!test
24434 5. Encapsulate foster-parented transclusion content
24435 !!options
24436 parsoid=wt2wt,wt2html
24437 !! wikitext
24438 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24439 !! html/parsoid
24440 <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>
24441 <table>
24442 <tbody>
24443 <tr>
24444 <td>
24445 <div>
24446 <p>foo</p>
24447 </div>
24448 </td>
24449 </tr>
24450 </tbody>
24451 </table>
24452 !!end
24453
24454 !!test
24455 6. Encapsulate foster-parented transclusion content
24456 !!options
24457 parsoid=wt2wt,wt2html
24458 !! wikitext
24459 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24460 !! html/parsoid
24461 <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>
24462 <table>
24463 <tbody>
24464 <tr>
24465 <td>
24466 <div>
24467 <p>foo</p>
24468 </div>
24469 </td>
24470 </tr>
24471 </tbody>
24472 </table>
24473 <p>ok</p>
24474 !!end
24475
24476 !!test
24477 7. Encapsulate foster-parented transclusion content
24478 !!options
24479 parsoid=wt2wt,wt2html
24480 !! wikitext
24481 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24482 !! html/parsoid
24483 <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>
24484 <table>
24485 <tbody>
24486 <tr>
24487 <td>bar</td>
24488 </tr>
24489 </tbody>
24490 </table>
24491 !!end
24492
24493 # Note that the wt is broken on purpose: the = should be {{=}} if you
24494 # don't want it to be a template parameter key.
24495 !!test
24496 8. Encapsulate foster-parented transclusion content
24497 !!options
24498 parsoid=wt2wt,wt2html
24499 !! wikitext
24500 {{echo|a
24501 }}{|{{echo|style='color:red'}}
24502 |-
24503 |b
24504 |}
24505 !! html/parsoid
24506 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24507 <span> </span>
24508 <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>
24509 <table>
24510 <tbody>
24511 <tr>
24512 <td>b</td>
24513 </tr>
24514 </tbody>
24515 </table>
24516 !!end
24517
24518 !!test
24519 9. Encapsulate foster-parented transclusion content
24520 !!options
24521 parsoid=wt2wt,wt2html
24522 !! wikitext
24523 <table>{{echo|hi</table>hello}}
24524 !! html/parsoid
24525 <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>
24526 !!end
24527
24528 !!test
24529 Table in fosterable position
24530 !!options
24531 parsoid=wt2html,wt2wt
24532 !! wikitext
24533 {{OpenTable}}
24534 <div>
24535 {|
24536 |}
24537 </div>
24538 |}
24539 !! html/parsoid
24540 <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">
24541 </span>
24542 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24543
24544 <table>
24545 </table>
24546 !!end
24547
24548 # Parsoid only for bug 64747
24549 !! test
24550 Properly encapsulate empty-content transclusions in fosterable positions
24551 !! wikitext
24552 <table>
24553 {{#if:|
24554 <td>foo</td>
24555 }}
24556 </table>
24557 !! html/parsoid
24558 <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":["","","",""]}]]}'>
24559
24560 </table>
24561 !! end
24562
24563 !! test
24564 Always encapsulate foster box when template range is expanded to table
24565 !! options
24566 parsoid=wt2wt
24567 !! wikitext
24568 {|
24569 hello
24570 {{OpenTable}}
24571 |}
24572 !! html/parsoid
24573
24574 !! end
24575
24576 !!test
24577 Support <object> element with .data attribute
24578 !!options
24579 parsoid=html2wt
24580 !! html/parsoid
24581 <object data="test.swf"></object>
24582 !! wikitext
24583 <object data="test.swf"></object>
24584 !!end
24585
24586 !! test
24587 Don't block XML namespace declaration
24588 !! wikitext
24589 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24590 !! html/php
24591 <p><span>MediaWiki</span>
24592 </p>
24593 !! html/parsoid
24594 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24595 !! end
24596
24597 # -----------------------------------------------------------------
24598 # The following section of tests are primarily to spec requirements
24599 # around serialization of new/edited content.
24600 #
24601 # All these tests are marked Parsoid html2wt and html2html only
24602 # ----------------------------------------------------------------
24603
24604 # 'mi' is a localinterwiki prefix as well as a language
24605 !! test
24606 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24607 !! options
24608 parsoid=html2wt
24609 !! html/parsoid
24610 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24611 !! wikitext
24612 [[Foo]]
24613 !! end
24614
24615 # See T93839
24616 !! test
24617 New wikilinks should be serialized properly
24618 !! options
24619 parsoid=html2wt
24620 !! html/parsoid
24621 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24622 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24623 !! wikitext
24624 [[Foo]]
24625 [[Foo]]
24626 !! end
24627
24628 !! test
24629 New wiki links (href variations)
24630 !! options
24631 parsoid=html2wt
24632 !! html/parsoid
24633 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24634 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24635 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24636 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24637 !! wikitext
24638 [[Foo_bar]]
24639 [[Foo_bar]]
24640 [[Foo_bar]]
24641 [[Toxine bactérienne]]
24642 !! end
24643
24644 !! test
24645 New wiki links (content string variations)
24646 !! options
24647 parsoid=html2wt
24648 !! html/parsoid
24649 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24650 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24651 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24652 !! wikitext
24653 [[Foo_bar]]
24654 [[Foo bar]]
24655 [[Foo_bar|./Foo_bar]]
24656 !! end
24657
24658 !! test
24659 New category links (href variations)
24660 !! options
24661 parsoid=html2wt
24662 !! html/parsoid
24663 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24664 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24665 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24666 !! wikitext
24667 [[Category:Toxine bactérienne]]
24668 [[Category:Toxine bactérienne]]
24669 [[Category:Toxine bactérienne]]
24670 !! end
24671
24672 !! test
24673 New sol transparent links don't need indent-pre nowiki protection
24674 !! options
24675 parsoid=html2wt
24676 language=de
24677 !! html/parsoid
24678 <link rel="mw:PageProp/redirect" href="./Main_Page">
24679 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24680 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24681 !! wikitext
24682 #WEITERLEITUNG [[Main Page]]
24683 <!-- this is good --> [[Category:Good]]
24684 <!-- this is great --> [[Kategorie:Great]]
24685 !! end
24686
24687 !! test
24688 New interlanguage links (href variations)
24689 !! options
24690 parsoid=html2wt
24691 !! html/parsoid
24692 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24693 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24694 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24695 !! wikitext
24696 [[es:Toxine bactérienne]]
24697 [[es:Toxine_bactérienne]]
24698 [[es:Toxine_bactérienne]]
24699 !! end
24700
24701 !! test
24702 Image: Modifying size of an image (1)
24703 !! options
24704 parsoid={
24705 "modes": ["wt2wt"],
24706 "changes": [
24707 ["img[height]", "attr", "height", "22"],
24708 ["img[width]", "attr", "width", "200"]
24709 ]
24710 }
24711 !! wikitext
24712 [[Image:Foobar.jpg|230x230px]]
24713 !! wikitext/edited
24714 [[Image:Foobar.jpg|200x200px]]
24715 !!end
24716
24717 !! test
24718 Image: Modifying size of an image (2)
24719 !! options
24720 parsoid={
24721 "modes": ["wt2wt"],
24722 "changes": [
24723 ["img[height]", "attr", "height", "100"],
24724 ["img[width]", "attr", "width", "500"]
24725 ]
24726 }
24727 !! wikitext
24728 [[Image:Foobar.jpg|230x230px]]
24729 !! wikitext/edited
24730 [[Image:Foobar.jpg|500x500px]]
24731 !!end
24732
24733 # Change in size is ignored so long as class='mw-default-size'
24734 !! test
24735 Image: Modifying size of an image (3)
24736 !! options
24737 parsoid={
24738 "modes": ["wt2wt"],
24739 "changes": [
24740 ["figure[class]", "removeClass", "mw-default-size"],
24741 ["figure img", "attr", "height", "19"],
24742 ["figure img", "attr", "width", "170"]
24743 ]
24744 }
24745 !! wikitext
24746 [[Image:Foobar.jpg|thumb]]
24747 !! wikitext/edited
24748 [[Image:Foobar.jpg|thumb|170x170px]]
24749 !!end
24750
24751 !! test
24752 Image: Modifying alignment of an image (bug 48665)
24753 !! options
24754 parsoid={
24755 "modes": ["wt2wt"],
24756 "changes": [
24757 ["figure[class]", "removeClass", "mw-halign-right"],
24758 ["figure[class]", "addClass", "mw-halign-left"]
24759 ]
24760 }
24761 !! wikitext
24762 [[Image:Foobar.jpg|thumb|caption|right]]
24763 !! wikitext/edited
24764 [[Image:Foobar.jpg|thumb|caption|left]]
24765 !! end
24766
24767 !! test
24768 Image: Modifying mw-default-size of an frameless image (bug 62805)
24769 !! options
24770 parsoid={
24771 "modes": ["wt2wt"],
24772 "changes": [
24773 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24774 ]
24775 }
24776 !! wikitext
24777 [[Image:Foobar.jpg|frameless|right]]
24778 !! wikitext/edited
24779 [[Image:Foobar.jpg|frameless|right|220x220px]]
24780 !! end
24781
24782 !! test
24783 Image: Modifying valign of an image (bug 49221)
24784 !! options
24785 parsoid={
24786 "modes": ["wt2wt"],
24787 "changes": [
24788 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24789 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24790 ]
24791 }
24792 !! wikitext
24793 [[File:Foobar.jpg|20px|middle]]
24794 !! wikitext/edited
24795 [[File:Foobar.jpg|20px|text-top]]
24796 !! end
24797
24798 !! test
24799 Image: Modifying alt attribute of an image (bug 56400)
24800 !! options
24801 parsoid={
24802 "modes": ["wt2wt"],
24803 "changes": [
24804 ["img[alt]", "attr", "alt", "some alternate edited text"]
24805 ]
24806 }
24807 !! wikitext
24808 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24809 !! wikitext/edited
24810 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24811 !!end
24812
24813 !! test
24814 Image: Modifying caption of an image
24815 !! options
24816 parsoid={
24817 "modes": ["wt2wt"],
24818 "changes": [
24819 ["figcaption", "text", "new caption"]
24820 ]
24821 }
24822 !! wikitext
24823 [[Image:Foobar.jpg|thumb|original caption]]
24824 !! wikitext/edited
24825 [[Image:Foobar.jpg|thumb|new caption]]
24826 !!end
24827
24828 !! test
24829 Image: empty alt attribute (bug 48924)
24830 !! options
24831 parsoid
24832 !! wikitext
24833 [[File:Foobar.jpg|thumb|alt=|bar]]
24834 !! html
24835 <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>
24836 !! end
24837
24838 !! test
24839 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24840 !! options
24841 parsoid=html2wt
24842 language=ar
24843 disabled
24844 !! html/parsoid
24845 <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>
24846 !! wikitext
24847 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24848 !! end
24849
24850 !! test
24851 Image: Block level image should have \n before and after
24852 !! wikitext
24853 123
24854 [[File:Foobar.jpg|right|thumb|150x150px]]
24855 456
24856 !! html/parsoid
24857 <p>123</p>
24858 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><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>
24859 <p>456</p>
24860 !!end
24861
24862 !! test
24863 Image: New block level image should have \n before and after (existing content)
24864 !! wikitext
24865 123
24866 [[File:Foobar.jpg|right|thumb|150x150px]]
24867 456
24868 !! html/parsoid
24869 <p>123</p>
24870 <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>
24871 <p>456</p>
24872 !!end
24873
24874 !! test
24875 Image: upright option (parsoid)
24876 !! wikitext
24877 [[File:Foobar.jpg|thumb|upright|caption]]
24878 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24879 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24880 !! html/parsoid
24881 <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>
24882 <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>
24883 <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>
24884 !!end
24885
24886 !! test
24887 Image: upright option is ignored on inline and frame images (parsoid)
24888 !! wikitext
24889 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24890 !! html/parsoid
24891 <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>
24892 !!end
24893
24894 !! test
24895 Image: from basic HTML (1)
24896 !! options
24897 parsoid=html2wt
24898 !! html/parsoid
24899 <span typeof="mw:Image">
24900 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24901 </span>
24902 !! wikitext
24903 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24904 !! end
24905
24906 !! test
24907 Image: from basic HTML (2)
24908 !! options
24909 parsoid=html2wt
24910 !! html/parsoid
24911 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24912 !! wikitext
24913 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24914 !! end
24915
24916 !! test
24917 Image: from basic HTML (3)
24918 !! options
24919 parsoid=html2wt
24920 !! html/parsoid
24921 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24922 !! wikitext
24923 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24924 !! end
24925
24926 !! test
24927 Image: from basic HTML (4)
24928 !! options
24929 parsoid=html2wt
24930 !! html/parsoid
24931 <img src="./File:Foobar.jpg">
24932 !! wikitext
24933 [[File:Foobar.jpg|link=]]
24934 !! end
24935
24936 !! test
24937 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24938 !! options
24939 parsoid=html2wt
24940 !! html/parsoid
24941 <ul>
24942 <li><p>foo</p></li>
24943 </ul>
24944 !! wikitext
24945 * foo
24946 !! end
24947
24948 !! test
24949 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24950 !! options
24951 parsoid=html2wt
24952 !! html/parsoid
24953 <ul> <li>foo</li></ul>
24954 !! wikitext
24955 * foo
24956 !! end
24957
24958 !! test
24959 Don't strip leading whitespace when handling indent-pre suppressing tags
24960 !! options
24961 parsoid=html2wt
24962 !! html/parsoid
24963 <table>
24964 <tr><td> indented row</td></tr>
24965 </table>
24966 <blockquote><p>
24967 <b>This is very bold of you!</b>
24968 </p>
24969 <table><tr><td>
24970 indented cell (no pre-wrapping!)
24971 </td></tr></table>
24972 </blockquote>
24973 <p>foo</p>
24974 <div>bar</div>
24975 !! wikitext
24976 {|
24977 | indented row
24978 |}
24979 <blockquote>
24980 '''This is very bold of you!'''
24981
24982 {|
24983 |
24984 indented cell (no pre-wrapping!)
24985 |}
24986 </blockquote>
24987 foo
24988 <div>bar</div>
24989 !! end
24990
24991 !! test
24992 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24993 !! options
24994 parsoid=html2wt
24995 !! html/parsoid
24996 <p>foo</p>
24997 <span>bar</span>
24998
24999 <span>foo2
25000 </span>bar2
25001
25002 <div>foo</div>
25003 <span>bar</span>
25004
25005 <div>
25006 <span>foo</span>
25007 </div>
25008 !! wikitext
25009 foo
25010
25011 <span>bar</span>
25012
25013 <span>foo2
25014 <nowiki> </nowiki></span>bar2
25015
25016 <div>foo</div>
25017 <nowiki> </nowiki><span>bar</span>
25018
25019 <div>
25020 <nowiki> </nowiki><span>foo</span>
25021 </div>
25022 !! end
25023
25024 !! test
25025 Lists: Dont insert newlines in a serialized list item.
25026 !! options
25027 parsoid=html2wt
25028 !! html/parsoid
25029 <ul><li>a<br>b</li><li>c</li></ul>
25030 !! wikitext
25031 * a<br>b
25032 * c
25033 !! end
25034
25035 !! test
25036 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25037 !! options
25038 parsoid={
25039 "modes": ["html2wt"],
25040 "scrubWikitext": false
25041 }
25042 !! html/parsoid
25043 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25044 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25045
25046 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25047 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25048
25049 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25050
25051 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25052 !! wikitext
25053 == hello there [[Category:A1]] ==
25054
25055 == [[Category:A2]] hi pal ==
25056
25057 == <!--foo--> [[Category:A3]] how goes it ==
25058
25059 == it goes well [[Category:A4]] <!--bar--> ==
25060
25061 ==howdy [[Category:A5]]==
25062
25063 == __TOC__ ok ==
25064 !! end
25065
25066 !! test
25067 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25068 !! options
25069 parsoid={
25070 "modes": ["html2wt"],
25071 "scrubWikitext": true
25072 }
25073 !! html/parsoid
25074 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25075 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25076
25077 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25078 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25079
25080 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25081 !! wikitext
25082 == hello there ==
25083 [[Category:A1]]
25084 [[Category:A2]]
25085
25086 == hi pal ==
25087
25088 <!--foo--> [[Category:A3]]
25089
25090 == how goes it ==
25091
25092 == it goes well ==
25093 [[Category:A4]] <!--bar-->
25094
25095 __TOC__
25096
25097 == ok ==
25098 !! end
25099
25100 !! test
25101 Headings: Don't hoist metas that come from templates
25102 !! options
25103 parsoid={
25104 "modes": ["html2wt"],
25105 "scrubWikitext": true
25106 }
25107 !! html/parsoid
25108 <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>
25109 !! wikitext
25110 == {{echo|foo [[Category:Foo]]}} ==
25111 !! end
25112
25113 !! test
25114 Headings: Category in ref isn't hoisted
25115 !! options
25116 parsoid={
25117 "modes": ["html2wt"],
25118 "scrubWikitext": true
25119 }
25120 !! html/parsoid
25121 <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>
25122
25123 <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>
25124 !! wikitext
25125 == foo <ref>bar
25126 [[Category:Baz]] </ref> ==
25127
25128 <references />
25129 !! end
25130
25131 !! test
25132 Parsoid: Serialize positional parameters with = in them as named parameter
25133 !! options
25134 parsoid=html2wt
25135 !! html/parsoid
25136 <p about="#mwt1" typeof="mw:Transclusion"
25137 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25138
25139 <p about="#mwt1" typeof="mw:Transclusion"
25140 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25141
25142 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25143 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25144 <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>
25145 !! wikitext
25146 {{echo|1 = f=oo}}
25147
25148 {{echo|1 = f=oo|2 = bar}}
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 {{echo|<nowiki>f=oo</nowiki>|bar}}
25153 !! end
25154
25155 !! test
25156 Parsoid: Serialize positional parameters with = in extlink as named parameter
25157 !! options
25158 parsoid=html2wt
25159 !! html/parsoid
25160 <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>
25161 !! wikitext
25162 {{echo|1 = http://stuff?is=ok}}
25163 !! end
25164
25165 !! test
25166 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25167 !! options
25168 parsoid=html2wt
25169 !! html/parsoid
25170 <div>a<p>b</p></div>
25171 <div>a
25172 <p>b</p></div>
25173 <div>
25174 a
25175 <p>b</p></div>
25176 !! wikitext
25177 <div>a
25178 b
25179 </div>
25180 <div>a
25181 b
25182 </div>
25183 <div>
25184 a
25185
25186 b
25187 </div>
25188 !! end
25189
25190 !! test
25191 Substrings resembling wikitext in hrefs should not get nowiki escapes
25192 !! options
25193 parsoid=html2wt
25194 !! html/parsoid
25195 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25196 !! wikitext
25197 [[Foo''bar''baz]]
25198 !! end
25199
25200 !! test
25201 Enforce single-line context in the serializer
25202 !! options
25203 parsoid=html2wt
25204 !! html/parsoid
25205 <h2>testing
25206 123</h2>
25207
25208 <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">
25209 </span><span about="#mwt1">you</span> </h2>
25210
25211 <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>
25212
25213 <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
25214 there</span></li></ol>
25215
25216 <ul><li>asd
25217 sdf</li></ul>
25218
25219 <ul><li>foo
25220 bar
25221 baz</li>
25222 <li>foo <b>bar</b>
25223 baz</li></ul>
25224
25225 <dl><dt>hi
25226 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25227 ho</dd></dl>
25228
25229 <dl><dd> <table>
25230 <tbody><tr><td> ha
25231 ha
25232 ha</td></tr>
25233 </tbody></table></dd></dl>
25234 !! wikitext
25235 == testing 123 ==
25236
25237 == hi {{bogus|there
25238 you}} ==
25239
25240 == foo <ref>hello
25241 there</ref> ==
25242
25243 <references />
25244
25245 * asd sdf
25246
25247 * foo bar baz
25248 * foo '''bar''' baz
25249
25250 ; hi ho : hi ho
25251
25252 : {|
25253 | ha
25254 ha
25255 ha
25256 |}
25257 !! end
25258
25259 !! test
25260 Serialize new placeholder space without spans
25261 !! options
25262 parsoid=html2wt
25263 !! html/parsoid
25264 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25265
25266 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25267
25268 <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>
25269 !! wikitext
25270 foo : bar
25271
25272 foo : bar
25273
25274 <ref>foo : bar</ref>ok
25275 !! end
25276
25277
25278 #-----------------------
25279 # Tag minimization tests
25280 #-----------------------
25281
25282 !! test
25283 1. I/B quote minimization: wikitext-only tags should be combined
25284 !! options
25285 parsoid=html2wt
25286 !! html/parsoid
25287 <p><i>A</i><i>B</i></p>
25288 <p><b>A</b><b>B</b></p>
25289 <p><i>A</i><b><i>B</i></b></p>
25290 <p><b>A</b><i><b>B</b></i></p>
25291 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25292 <p><i><b>A</b></i><i><b>B</b></i></p>
25293 <p><i><b>A</b></i><b><i>B</i></b></p>
25294 <p><b><i>A</i></b><i><b>B</b></i></p>
25295 !! wikitext
25296 ''AB''
25297
25298 '''AB'''
25299
25300 ''A'''B'''''
25301
25302 '''A''B'''''
25303
25304 '''A''BC''D'''
25305
25306 '''''AB'''''
25307
25308 '''''AB'''''
25309
25310 '''''AB'''''
25311 !! end
25312
25313 !! test
25314 2. I/B quote minimization: wikitext and html tags should not be combined
25315 !! options
25316 parsoid=html2wt
25317 !! html/parsoid
25318 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25319 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25320 !! wikitext
25321 ''A''<i>B</i>
25322
25323 ''A''<nowiki/>'''<i>B</i>'''
25324 !! end
25325
25326 !! test
25327 3. I/B quote minimization: templated content stops minimization
25328 !! options
25329 parsoid=html2wt
25330 !! html/parsoid
25331 <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>
25332 <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>
25333 !! wikitext
25334 ''A''{{echo|''B''}}
25335
25336 ''A''{{echo|'''''B'''''}}
25337 !! end
25338
25339 !! test
25340 4. I/B quote minimization: new content should be mimimized with adjacent old content
25341 !! options
25342 parsoid=html2wt
25343 !! html/parsoid
25344 <p><i>A</i><i>B</i></p>
25345 <p><b>A</b><b>B</b></p>
25346 <p><i>A</i><b><i>B</i></b></p>
25347 !! wikitext
25348 ''AB''
25349
25350 '''AB'''
25351
25352 ''A'''B'''''
25353 !! end
25354
25355 !! test
25356 5a. Merge adjacent quote nodes if they've been edited
25357 !! options
25358 parsoid={
25359 "modes": ["wt2wt", "selser"],
25360 "changes": [
25361 ["p", "contents", "remove", ":contains('b')"]
25362 ]
25363 }
25364 !! wikitext
25365 ''a''b''c''
25366 !! wikitext/edited
25367 ''ac''
25368 !! end
25369
25370 !! test
25371 5b. Merge adjacent quote nodes if they've been edited
25372 !! options
25373 parsoid={
25374 "modes": ["wt2wt", "selser"],
25375 "changes": [
25376 ["#x", "remove"]
25377 ]
25378 }
25379 !! wikitext
25380 ''a''<span id="x">b</span>''c''
25381 !! wikitext/edited
25382 ''ac''
25383 !! end
25384
25385 !! test
25386 1. Merge adjacent link nodes as long as at least one element is new
25387 !! options
25388 parsoid={
25389 "modes": ["html2wt"],
25390 "scrubWikitext": true
25391 }
25392 !! html/parsoid
25393 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25394 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25395 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25396 !! wikitext
25397 [[Football]]
25398 [[Football]]
25399 [[Football|Foot]][[Football|ball]]
25400 !! end
25401
25402 !! test
25403 2. Merge adjacent link nodes and enable additional normalizations
25404 !! options
25405 parsoid={
25406 "modes": ["html2wt"],
25407 "scrubWikitext": true
25408 }
25409 !! html/parsoid
25410 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25411 !! wikitext
25412 [[Football|''Football'']]
25413 !! end
25414
25415 !! test
25416 3. Don't merge adjacent link nodes if scrubWikitext is false
25417 !! options
25418 parsoid={
25419 "modes": ["html2wt"],
25420 "scrubWikitext": false
25421 }
25422 !! html/parsoid
25423 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25424 !! wikitext
25425 [[Football|Foot]][[Football|ball]]
25426 !! end
25427
25428 #------------------------------
25429 # End of tag minimization tests
25430 #------------------------------
25431
25432 !!test
25433 Bug 54262: New entities
25434 !! options
25435 parsoid=html2wt
25436 !! html/parsoid
25437 <span typeof="mw:Entity">&nbsp;</span>
25438 !! wikitext
25439 &nbsp;
25440 !! end
25441
25442 ## Note that there is no wikitext output for 'unknownproperty' ##
25443 ## Unknown magic words are silently dropped ##
25444
25445 !! test
25446 Magic words
25447 !! options
25448 parsoid=html2wt
25449 !! html/parsoid
25450 <meta property='mw:PageProp/toc' />
25451 <meta property='mw:PageProp/notoc' />
25452 <meta property='mw:PageProp/forcetoc' />
25453 <meta property='mw:PageProp/index' />
25454 <meta property='mw:PageProp/noindex' />
25455 <meta property='mw:PageProp/nogallery' />
25456 <meta property='mw:PageProp/noeditsection' />
25457 <meta property='mw:PageProp/notitleconvert' />
25458 <meta property='mw:PageProp/nocontentconvert' />
25459 <meta property='mw:PageProp/unknownproperty' />
25460 !! wikitext
25461 __TOC__
25462 __NOTOC__
25463 __FORCETOC__
25464 __INDEX__
25465 __NOINDEX__
25466 __NOGALLERY__
25467 __NOEDITSECTION__
25468 __NOTITLECONVERT__
25469 __NOCONTENTCONVERT__
25470 !! end
25471
25472 !! test
25473 Consecutive <pre>s should not get merged
25474 !! options
25475 parsoid=html2wt,html2html
25476 !! html/parsoid
25477 <pre>a</pre><pre>b</pre>
25478
25479 <pre>c
25480 </pre><pre>
25481 d</pre>
25482
25483 <pre>e
25484
25485 </pre><pre>
25486
25487 f</pre>
25488 !! wikitext
25489 a
25490
25491 b
25492
25493 c
25494
25495 d
25496
25497 e
25498
25499
25500
25501 f
25502 !! end
25503
25504 !! test
25505 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25506 !! options
25507 parsoid=html2wt
25508 !! html/parsoid
25509 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25510 !! wikitext
25511 [[Special:BookSources/1234567890|ISBN 1234567895]]
25512 !! end
25513
25514 !! test
25515 Edited RFC links not serializable as RFC links should serialize as extlinks
25516 !! options
25517 parsoid=html2wt
25518 !! html/parsoid
25519 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25520 !! wikitext
25521 [//tools.ietf.org/html/rfc123 New RFC]
25522 !! end
25523
25524 !! test
25525 Edited PMID links not serializable as PMID links should serialize as extlinks
25526 !! options
25527 parsoid=html2wt
25528 !! html/parsoid
25529 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25530 !! wikitext
25531 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25532 !! end
25533
25534 !! test
25535 WTS of autolinks with trailing/surrounding context
25536 !! options
25537 parsoid=html2wt
25538 !! html/parsoid
25539 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25540 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25541 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25542 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25543 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25544 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25545 !! wikitext
25546 http://cscott.net'''foo'''
25547
25548 http://cscott.net<b>foo</b>
25549
25550 '''http://cscott.net'''
25551
25552 '''http://cscott.net '''
25553
25554 '''http://cscott.net<nowiki/>x'''
25555
25556 http://cscott.net<nowiki/>x
25557 !! end
25558
25559 !! test
25560 WTS of autolinks with nowikis (round-trip)
25561 !! wikitext
25562 x<nowiki/>http://cscott.net<nowiki/>x
25563 !! html/parsoid
25564 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25565 !! end
25566
25567 # this is the "easy" test because it leaves in place all the
25568 # data-parsoid information indicating this is an autolink
25569 !! test
25570 WTS of autolinks with escapes (editing)
25571 !! options
25572 parsoid={
25573 "modes": ["wt2wt"],
25574 "changes": [
25575 [ "meta", "remove" ]
25576 ]
25577 }
25578 !! wikitext
25579 x<nowiki/>http://cscott.net<nowiki/>x
25580 !! wikitext/edited
25581 x<nowiki/>http://cscott.net<nowiki/>x
25582 !! end
25583
25584 !! test
25585 WTS of edited autolink-like text (T103364)
25586 !! options
25587 parsoid={
25588 "modes": ["wt2wt"],
25589 "changes": [
25590 [ "span[typeof]", "removeAttr", "typeof" ]
25591 ]
25592 }
25593 !! wikitext
25594 Not a link: <nowiki>http://example.com</nowiki>.
25595 !! wikitext/edited
25596 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25597 !! end
25598
25599 !! test
25600 WTS of newly-authored autolink-like text (T103364)
25601 !! options
25602 parsoid=html2wt
25603 !! html/parsoid
25604 <p>http://example.com is not a link.</p>
25605 !! wikitext
25606 <nowiki>http://example.com</nowiki> is not a link.
25607 !! end
25608
25609 !! test
25610 WTS of autolink-like text after an autolink (T108563)
25611 !! options
25612 parsoid=html2wt
25613 !! html/parsoid
25614 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25615 !! wikitext
25616 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25617 !! end
25618
25619 !! test
25620 Magic links inside links (not autolinked)
25621 !! wikitext
25622 [[Foo|http://example.com]]
25623 [[Foo|RFC 1234]]
25624 [[Foo|PMID 1234]]
25625 [[Foo|ISBN 123456789x]]
25626
25627 [http://foo.com http://example.com]
25628 [http://foo.com RFC 1234]
25629 [http://foo.com PMID 1234]
25630 [http://foo.com ISBN 123456789x]
25631 !! html+tidy
25632 <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>
25633 <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>
25634 !! html/parsoid
25635 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25636 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25637 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25638 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25639
25640 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25641 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25642 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25643 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25644 !! end
25645
25646 !! test
25647 Magic links inside image captions (autolinked)
25648 !! wikitext
25649 [[File:Foobar.jpg|thumb|http://example.com]]
25650 [[File:Foobar.jpg|thumb|RFC 1234]]
25651 [[File:Foobar.jpg|thumb|PMID 1234]]
25652 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25653 !! html+tidy
25654 <div class="thumb tright">
25655 <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>
25656 <div class="thumbcaption">
25657 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25658 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25659 </div>
25660 </div>
25661 <div class="thumb tright">
25662 <div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
25663 <div class="thumbcaption">
25664 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25665 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25666 </div>
25667 </div>
25668 <div class="thumb tright">
25669 <div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
25670 <div class="thumbcaption">
25671 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25672 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25673 </div>
25674 </div>
25675 <div class="thumb tright">
25676 <div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
25677 <div class="thumbcaption">
25678 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25679 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25680 </div>
25681 </div>
25682 !! html/parsoid
25683 <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>
25684 <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>
25685 <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>
25686 <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>
25687 !! end
25688
25689 !! test
25690 WTS of magic word text (T109371)
25691 !! options
25692 parsoid=html2wt
25693 !! html/parsoid
25694 <p>RFC 1234</p>
25695 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25696 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25697 !! wikitext
25698 <nowiki>RFC 1234</nowiki>
25699
25700 [http://foo.com RFC 1234]
25701
25702 [[Foo|RFC 1234]]
25703 !! end
25704
25705 !! test
25706 Edited Redirect link should emit a non-piped wikitext link
25707 !! options
25708 parsoid=html2wt
25709 !! html/parsoid
25710 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25711 !! wikitext
25712 #REDIRECT [[Bar]]
25713 !! end
25714
25715 !! test
25716 T75121: Infer extension name from typeOf if data-mw is not present
25717 !! options
25718 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25719 !! html/parsoid
25720 <div typeOf="mw:Extension/foo"></div>
25721 !! wikitext
25722 <foo />
25723 !! end
25724
25725 # Note that the <p> wrapping isn't present in PHP parser output
25726 # The important thing for this test is that P-wrapping doesn't
25727 # interfere with the <nowiki> protection for leading - in <td>
25728 # (which isn't necessary for <th>).
25729 !! test
25730 T88318: p-wrapped dash in table.
25731 !! options
25732 parsoid=html2wt,wt2wt
25733 !! html/parsoid
25734 <table><tbody>
25735 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25736 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25737 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25738 </tbody></table>
25739 !! wikitext
25740 {|
25741 !-
25742 !-
25743 |-
25744 |<nowiki>-</nowiki>
25745 |<nowiki>- </nowiki>
25746 |-
25747 |<small>-</small>
25748 |<br>
25749 -
25750 |<br>
25751 -
25752 |}
25753 !! html/php+tidy
25754 <table>
25755 <tr>
25756 <th>-</th>
25757 <th>-</th>
25758 </tr>
25759 <tr>
25760 <td>-</td>
25761 <td>-</td>
25762 </tr>
25763 <tr>
25764 <td><small>-</small></td>
25765 <td><br />
25766 <p>-</p>
25767 </td>
25768 <td><br />
25769 <p>-</p>
25770 </td>
25771 </tr>
25772 </table>
25773 !! end
25774
25775 !! test
25776 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25777 !! options
25778 parsoid=html2wt
25779 !! html/parsoid
25780 <table id='mwAb'>
25781 <td id='mwAc'>foo</td>
25782 <td id='serialize-this'>bar</td>
25783 </table>
25784 !! wikitext
25785 {|
25786 |foo
25787 | id="serialize-this" |bar
25788 |}
25789 !! end
25790
25791 !! test
25792 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25793 !! options
25794 parsoid=html2wt
25795 !! html/parsoid
25796 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25797 !! wikitext
25798 <div id="hello">ok</div>
25799 !! end
25800
25801 !! test
25802 WTS change modes
25803 !! options
25804 parsoid={
25805 "modes": ["wt2wt"],
25806 "changes": [
25807 [ "#xyz", "before", "<b>before</b> stuff " ],
25808 [ "#xyz", "after", " stuff <i>after</i>" ],
25809 [ "#xyz", "html", "x <b>y</b> z" ]
25810 ]
25811 }
25812 !! wikitext
25813 <span id="xyz">hello</span>
25814 !! wikitext/edited
25815 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25816 !! end
25817
25818 !! test
25819 Never serialize a-tag as html, regardless of what data-parsoid has to say
25820 !! options
25821 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25822 !! html/parsoid
25823 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25824 !! wikitext
25825 [[Foo]]
25826 !! end
25827
25828 ## SSS FIXME: This is broken output nevertheless.
25829 ## What might be a reasonable non-broken output for this?
25830 ## This is an edge case unlikely to be seen in production
25831 ## that I am not wasting more time on this right now.
25832 !! test
25833 Never serialize a-tag as html, no matter what attributes it has
25834 !! options
25835 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25836 !! html/parsoid
25837 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25838 !! wikitext
25839 [http://boo.org http://boohoo.org]
25840 !! end
25841
25842 # Misnested is an indication that selser can reuse the source but these have
25843 # shown to sneak through on occasion. See T101768.
25844 # The original wikitext here is: [http://test.com [[one]] two three]
25845 !! test
25846 Strip span tags added to mark misnested links
25847 !! options
25848 parsoid=html2wt
25849 !! html/parsoid
25850 <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>
25851 !! wikitext
25852 [http://test.com][[one]] two three
25853 !! end
25854
25855 !! test
25856 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25857 !! options
25858 parsoid=html2wt
25859 !! html/parsoid
25860 <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|}"]}'>
25861 <tbody><tr><td>d
25862 </td></tr>
25863 </tbody></table>
25864 !! wikitext
25865 {{echo|a}}
25866 {|{{echo|c
25867 {{!}}d
25868 }}
25869 |}
25870 !! end
25871
25872 ## This test verifies the presence and computation of this attribute indirectly
25873 ## by making an edit and ensuring that the serialization is correct (which it would be
25874 ## only if firstWikitextNode is properly set).
25875 !! test
25876 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25877 !! options
25878 parsoid= {
25879 "modes": ["wt2wt"],
25880 "changes": [
25881 [ "div#x", "remove" ],
25882 [ "div", "before", "<div>new</div>" ]
25883 ]
25884 }
25885 !! wikitext
25886 <div id="x">foo</div>
25887 {|
25888 {{echo|<div>boo</div>
25889 {{!}}b}}
25890 |c
25891 |}
25892 !! wikitext/edited
25893
25894 <div>new</div>
25895 {|
25896 {{echo|<div>boo</div>
25897 {{!}}b}}
25898 |c
25899 |}
25900 !! end
25901
25902 # --------------------------------------------
25903 # Tests spec'ing wikitext serialization norms |
25904 # --------------------------------------------
25905
25906 !! test
25907 1. Categories should always be serialized on their own line
25908 !! options
25909 parsoid=html2wt
25910 !! html/parsoid
25911 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
25912 !! wikitext
25913 foo
25914 [[Category:Foo]]
25915 bar
25916 !! end
25917
25918 !! test
25919 2. Categories that are part of templates should not introduce a line break
25920 !! wikitext
25921 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
25922 !! html/parsoid
25923 <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>
25924 !! end
25925
25926 # Careful while editing these next 2 tests. There are \u200f characters
25927 # before and after the <link> tags in the HTML and following some
25928 # of the categories in wikitext
25929 # Do not remove these characters in edits.
25930 #
25931 # As part of the serialization, these bidi characters will get stripped.
25932 !! test
25933 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
25934 !! options
25935 parsoid={
25936 "modes": ["html2wt"],
25937 "scrubWikitext": true
25938 }
25939 !! html/parsoid
25940 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
25941 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
25942 !! wikitext
25943 [[קטגוריה:טקסים]]
25944 [[קטגוריה: שיטות משפט]]
25945 !! end
25946
25947 !! test
25948 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
25949 !! options
25950 parsoid={
25951 "modes": ["html2wt"],
25952 "scrubWikitext": true
25953 }
25954 !! html/parsoid
25955 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
25956 !! wikitext
25957 [[קטגוריה:טקסים]]
25958 ‏y
25959 !! end
25960
25961 !! test
25962 Lists: Add space after bullets
25963 !! options
25964 parsoid=html2wt
25965 !! html/parsoid
25966 <ul>
25967 <li>foo</li>
25968 <li> bar</li>
25969 <li><span> baz</span></li>
25970 </ul>
25971 !! wikitext
25972 * foo
25973 * bar
25974 * <span> baz</span>
25975 !! end
25976
25977 !! test
25978 1. Headings: Add space before/after == (T53744)
25979 !! options
25980 parsoid=html2wt
25981 !! html/parsoid
25982 <h2>foo</h2>
25983 <h2> bar</h2>
25984 <h2>baz </h2>
25985 <h2><span> baz</span></h2>
25986 !! wikitext
25987 == foo ==
25988
25989 == bar ==
25990
25991 == baz ==
25992
25993 == <span> baz</span> ==
25994 !! end
25995
25996 !! test
25997 2. Headings: Add space before/after == even after hoisted content
25998 !! options
25999 parsoid={
26000 "modes": ["html2wt"],
26001 "scrubWikitext": true
26002 }
26003 !! html/parsoid
26004 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26005 !! wikitext
26006 [[Category:A2]]
26007
26008 == ok ==
26009 !! end
26010
26011 !! test
26012 1. Headings: suppress newly created empty headings
26013 !! options
26014 parsoid={
26015 "modes": ["html2wt"],
26016 "scrubWikitext": true
26017 }
26018 !! html/parsoid
26019 <h2></h2>
26020 !! wikitext
26021 !! end
26022
26023 !! test
26024 2. Headings: don't suppress empty headings if scrubWikitext is false
26025 !! options
26026 parsoid=html2wt
26027 !! html/parsoid
26028 <h2></h2>
26029 !! wikitext
26030 ==<nowiki/>==
26031 !! end
26032
26033 !! test
26034 3. Headings: suppress empty headings on edits
26035 !! options
26036 parsoid={
26037 "modes": ["selser"],
26038 "scrubWikitext": true,
26039 "changes": [
26040 [ "#x", "remove"]
26041 ]
26042 }
26043 !! wikitext
26044 ==<span id="x">foo</span>==
26045 !! wikitext/edited
26046 !! end
26047
26048 !! test
26049 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26050 !! options
26051 parsoid={
26052 "modes": ["html2wt"],
26053 "scrubWikitext": true
26054 }
26055 !! html/parsoid
26056 <h2>foo<br/>bar</h2>
26057 <h2>foo <span><br/>bar</span> baz</h2>
26058 !! wikitext
26059 == foo bar ==
26060
26061 == foo <span> bar</span> baz ==
26062 !! end
26063
26064 !! test
26065 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26066 !! options
26067 parsoid={
26068 "modes": ["html2wt"],
26069 "scrubWikitext": false
26070 }
26071 !! html/parsoid
26072 <h2>foo<br/>bar</h2>
26073 !! wikitext
26074 == foo<br> bar ==
26075 !! end
26076
26077 !! test
26078 1. WT Quote Tags: suppress newly created empty style tags
26079 !! options
26080 parsoid={
26081 "modes": ["html2wt"],
26082 "scrubWikitext": true
26083 }
26084 !! html/parsoid
26085 <i></i><b></b>
26086 !! wikitext
26087 !! end
26088
26089 !! test
26090 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26091 !! options
26092 parsoid=html2wt
26093 !! html/parsoid
26094 <i></i><b></b>
26095 !! wikitext
26096 ''<nowiki/>'''''<nowiki/>'''
26097 !! end
26098
26099 !! test
26100 3. WT Quote Tags: suppress empty style tags on edits
26101 !! options
26102 parsoid={
26103 "modes": ["selser"],
26104 "scrubWikitext": true,
26105 "changes": [
26106 [ "#x", "remove"]
26107 ]
26108 }
26109 !! wikitext
26110 '''<span id="x">foo</span>'''
26111 !! wikitext/edited
26112 !! end
26113
26114 !! test
26115 1. Anchors: suppress newly created empty anchors
26116 !! options
26117 parsoid={
26118 "modes": ["html2wt"],
26119 "scrubWikitext": true
26120 }
26121 !! html/parsoid
26122 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26123 !! wikitext
26124 !! end
26125
26126 !! test
26127 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26128 !! options
26129 parsoid={
26130 "modes": ["html2wt"],
26131 "scrubWikitext": false
26132 }
26133 !! html/parsoid
26134 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26135 !! wikitext
26136 [[Test|<nowiki/>]]
26137 !! end
26138
26139 !! test
26140 3. Anchors: suppress empty anchors on edits
26141 !! options
26142 parsoid={
26143 "modes": ["selser"],
26144 "scrubWikitext": true,
26145 "changes": [
26146 [ "#x", "remove"]
26147 ]
26148 }
26149 !! wikitext
26150 [[Test|<span id="x">foo</span>]]
26151 !! wikitext/edited
26152 !! end
26153
26154 !! test
26155 3a. Anchors: do not suppress numbered extlinks
26156 !! options
26157 parsoid={
26158 "modes": ["wt2wt"],
26159 "scrubWikitext": true
26160 }
26161 !! wikitext
26162 [http://foo.com]
26163 !! html/parsoid
26164 <a rel="mw:ExtLink" href="http://foo.com"></a>
26165 !! end
26166
26167 !! test
26168 3b. Anchors: do not suppress numbered extlinks
26169 !! options
26170 parsoid={
26171 "modes": ["wt2wt"],
26172 "scrubWikitext": true,
26173 "changes": [
26174 [ "#x", "remove"]
26175 ]
26176 }
26177 !! wikitext
26178 [http://foo.com <span id="x">foo</span>]
26179 !! wikitext/edited
26180 [http://foo.com]
26181 !! end
26182
26183 !!test
26184 Normalizations should be restricted to edited content
26185 !!options
26186 parsoid={
26187 "modes": ["selser"],
26188 "scrubWikitext": true,
26189 "changes": [
26190 [ "h1", "before", "<i></i>"]
26191 ]
26192 }
26193 !!wikitext
26194 a
26195 = =
26196 b
26197 !!wikitext/edited
26198 a
26199 = =
26200 b
26201 !!end
26202
26203 !! test
26204 1. Multiple normalizations (html2wt)
26205 !! options
26206 parsoid={
26207 "modes": ["html2wt"],
26208 "scrubWikitext": true
26209 }
26210 !! html
26211 <h2><i></i></h2>
26212 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26213 </a><b><i></i></b>x</p>
26214 !! wikitext
26215
26216 [[foo]]
26217 x
26218
26219 !! end
26220
26221 !! test
26222 2. Multiple normalizations (selser)
26223 !! options
26224 parsoid={
26225 "modes": ["selser"],
26226 "scrubWikitext": true,
26227 "changes": [
26228 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26229 ]
26230 }
26231 !! wikitext
26232 <span id="x">foo</span>
26233 !! wikitext/edited
26234 <span id="x">foo</span>
26235
26236 x
26237 !! end
26238
26239 !! test
26240 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26241 !! options
26242 parsoid={
26243 "modes": ["html2wt"],
26244 "scrubWikitext": true
26245 }
26246 !! html/parsoid
26247 <p> hi</p>
26248 <p> hello</p>
26249 !! wikitext
26250 hi
26251
26252 hello
26253 !! end
26254
26255 !! test
26256 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26257 !! options
26258 parsoid=html2wt
26259 !! html/parsoid
26260 <p> hi</p>
26261 <p> hello</p>
26262 !! wikitext
26263 <nowiki> </nowiki>hi
26264
26265 <nowiki> </nowiki> hello
26266 !! end
26267
26268 !! test
26269 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26270 !! options
26271 parsoid={
26272 "modes": ["html2wt"],
26273 "scrubWikitext": true
26274 }
26275 !! html/parsoid
26276 <p>Foo
26277 bar
26278 baz</p>
26279
26280 <table><tr><td>Foo
26281 bar
26282 baz bang</td></tr></table>
26283
26284 <p><!--boo--> foo
26285 bar</p>
26286
26287 <p> foo
26288 bar<span>boo</span></p>
26289 !! wikitext
26290 Foo
26291 bar
26292 baz
26293
26294 {|
26295 |Foo
26296 bar
26297 baz bang
26298 |}
26299
26300 <!--boo-->foo
26301 bar
26302
26303 foo
26304 bar<span>boo</span>
26305 !! end
26306
26307 !! test
26308 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26309 !! options
26310 parsoid={
26311 "modes": ["selser"],
26312 "scrubWikitext": true,
26313 "changes": [
26314 [ "p", "html", " a\n b" ]
26315 ]
26316 }
26317 !! wikitext
26318 xyz
26319 !! wikitext/edited
26320 a
26321 b
26322 !! end
26323
26324 !! test
26325 1. New links that end in spaces
26326 !! options
26327 parsoid={
26328 "modes": ["html2wt"],
26329 "scrubWikitext": false
26330 }
26331 !! html/parsoid
26332 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26333 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26334 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26335 !! wikitext
26336 [[Berlin ]]<nowiki/>is the capital of Germany.
26337
26338 [[Foo ]]'''bar'''
26339
26340 [[Boston ]] is a city.
26341 !! end
26342
26343 !! test
26344 2. New links that end in spaces
26345 !! options
26346 parsoid={
26347 "modes": ["html2wt"],
26348 "scrubWikitext": true
26349 }
26350 !! html/parsoid
26351 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26352 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26353 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26354 !! wikitext
26355 [[Berlin]] is the capital of Germany.
26356
26357 [[Foo]] '''bar'''
26358
26359 [[Boston]] is a city.
26360 !! end
26361
26362 !! test
26363 1. Table cells with escapable prefixes
26364 !! options
26365 parsoid={
26366 "modes": ["html2wt"],
26367 "scrubWikitext": false
26368 }
26369 !! html
26370 <table>
26371 <tr><td>a</td></tr>
26372 <tr><td>-</td></tr>
26373 <tr><td>+</td></tr>
26374 </table>
26375 !! wikitext
26376 {|
26377 |a
26378 |-
26379 |<nowiki>-</nowiki>
26380 |-
26381 |<nowiki>+</nowiki>
26382 |}
26383 !! end
26384
26385 !! test
26386 2. Table cells with escapable prefixes
26387 !! options
26388 parsoid={
26389 "modes": ["html2wt"],
26390 "scrubWikitext": true
26391 }
26392 !! html
26393 <table>
26394 <tr><td>a</td></tr>
26395 <tr><td>-</td></tr>
26396 <tr><td>+</td></tr>
26397 </table>
26398 !! wikitext
26399 {|
26400 |a
26401 |-
26402 | -
26403 |-
26404 | +
26405 |}
26406 !! end
26407
26408 !! test
26409 3a. Table cells with escapable prefixes after edits
26410 !! options
26411 parsoid={
26412 "modes": ["selser"],
26413 "scrubWikitext": true,
26414 "changes": [
26415 [ "table tbody tr:first-child td:first-child", "remove"]
26416 ]
26417 }
26418 !! wikitext
26419 {|
26420 |a||-
26421 |}
26422 !! wikitext/edited
26423 {|
26424 | -
26425 |}
26426 !! end
26427
26428 !! test
26429 3b. Table cells with escapable prefixes after edits
26430 !! options
26431 parsoid={
26432 "modes": ["selser"],
26433 "scrubWikitext": true,
26434 "changes": [
26435 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26436 [ "#x", "remove" ]
26437 ]
26438 }
26439 !! wikitext
26440 {|
26441 |pqr
26442 |<span id="x">foo</span>+
26443 |}
26444 !! wikitext/edited
26445 {|
26446 | -
26447 | +
26448 |}
26449 !! end
26450
26451 # FIXME: This test will fail because
26452 # normalization doesn't realize that the id attribute
26453 # will eliminate the escapable scenario
26454 !! test
26455 4a. Table cells without escapable prefixes after edits
26456 !! options
26457 parsoid={
26458 "modes": ["selser"],
26459 "scrubWikitext": true,
26460 "changes": [
26461 [ "#x", "html", "-" ]
26462 ]
26463 }
26464 !! wikitext
26465 {|
26466 | id="x" |abcd
26467 |}
26468 !! wikitext/edited
26469 {|
26470 | id="x" |-
26471 |}
26472 !! end
26473
26474 ## This tests normalizer's ability to discriminate between
26475 ## cells having identical content.
26476 !! test
26477 4b. Table cells without escapable prefixes after edits
26478 !! options
26479 parsoid={
26480 "modes": ["selser"],
26481 "scrubWikitext": true,
26482 "changes": [
26483 [ "td", "html", "-" ]
26484 ]
26485 }
26486 !! wikitext
26487 {|
26488 |a||b
26489 |}
26490 !! wikitext/edited
26491 {|
26492 | -||-
26493 |}
26494 !! end
26495
26496 ## This tests normalizer's ability to not be tripped by
26497 ## comments (and whitespace)
26498 !! test
26499 4c. Table cells without escapable prefixes after edits
26500 !! options
26501 parsoid={
26502 "modes": ["selser"],
26503 "scrubWikitext": true,
26504 "changes": [
26505 [ "table tbody tr td:first-child", "remove" ]
26506 ]
26507 }
26508 !! wikitext
26509 {|
26510 |-
26511 <!--foo--> |a||-
26512 |}
26513 !! wikitext/edited
26514 {|
26515 |-
26516 <!--foo--> | -
26517 |}
26518 !! end
26519
26520 ## This tests normalizer's ability to handle HTML cells
26521 !! test
26522 4d. Table cells without escapable prefixes after edits
26523 !! options
26524 parsoid={
26525 "modes": ["selser"],
26526 "scrubWikitext": true,
26527 "changes": [
26528 [ "td", "html", "-" ]
26529 ]
26530 }
26531 !! wikitext
26532 <table>
26533 <tr><td>a</td></tr>
26534 </table>
26535 !! wikitext/edited
26536 <table>
26537 <tr><td>-</td></tr>
26538 </table>
26539 !! end
26540
26541 ## T111151 Remove font elements without attributes
26542 !! test
26543 5a. font tags without attributes should be dropped in scrubWikitext mode
26544 !! options
26545 parsoid={
26546 "modes": ["html2wt"],
26547 "scrubWikitext": true
26548 }
26549 !! html
26550 <font>foo</font>
26551 <font><font>bar</font></font>
26552 <font class="x">boo</font>
26553 !! wikitext
26554 foo
26555 bar
26556 <font class="x">boo</font>
26557 !! end
26558
26559 !! test
26560 5b. font tags should not be dropped without scrubWikitext being enabled
26561 !! options
26562 parsoid={
26563 "modes": ["html2wt"],
26564 "scrubWikitext": false
26565 }
26566 !! html
26567 <font>foo</font>
26568 !! wikitext
26569 <font>foo</font>
26570 !! end
26571
26572 !! test
26573 Escape nowiki DOM elements
26574 !! options
26575 parsoid=html2wt
26576 !! html/parsoid
26577 <nowiki><i>foo</i></nowiki>
26578 !! wikitext
26579 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26580 !! end
26581
26582 # This is meant to be an interim fix while we go about figuring out
26583 # how to not introduce these trailing <nowiki/>s in the first place.
26584 !! test
26585 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26586 !! options
26587 parsoid=html2wt
26588 !! html/parsoid
26589 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26590 y</p>
26591 <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>
26592 <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>
26593 !! wikitext
26594 x
26595 y
26596
26597 {{echo|
26598 1 = <nowiki/>}}
26599
26600 {{echo|
26601 1 = <nowiki/>
26602 }}
26603 !! end
26604
26605 # ---------------------------------------------------
26606 # End of tests spec'ing wikitext serialization norms |
26607 # ---------------------------------------------------
26608
26609 # T104032
26610 !! test
26611 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26612 !! options
26613 parsoid=html2wt
26614 !! html/parsoid
26615 a<p>b</p>
26616 <b>c</b><p>d</p>
26617 <table><tr>
26618 <td>a<p>b</p></td>
26619 <td><b>c</b><p>d</p></td>
26620 </tr></table>
26621 !! wikitext
26622 a
26623
26624 b
26625
26626 '''c'''
26627
26628 d
26629 {|
26630 |a
26631 b
26632 |'''c'''
26633 d
26634 |}
26635 !! end
26636
26637 # -----------------------------------------------------------------
26638 # End of section for Parsoid-only html2wt tests for serialization
26639 # of new content
26640 # -----------------------------------------------------------------
26641
26642 # -----------------------------------------------------------------
26643 # The following section of tests are primarily to spec behavior of
26644 # the selective serializer. All these tests have manual selser
26645 # changes. The automated selser changes for all tests handle the
26646 # wide variation of changes, but these tests here capture specs
26647 # deterministically.
26648 # ----------------------------------------------------------------
26649
26650 ## T90517
26651 !! test
26652 Selser: New comments should not be lost
26653 !! options
26654 parsoid={
26655 "modes": ["selser"],
26656 "changes": [
26657 [ "#a", "after", "<!--c1-->" ],
26658 [ "#b", "before", "<!--c2-->" ]
26659 ]
26660 }
26661 !! wikitext
26662 <span id="a">a</span>
26663
26664 <span id="b">b</span>
26665 !! wikitext/edited
26666 <span id="a">a</span><!--c1-->
26667
26668 <!--c2--><span id="b">b</span>
26669 !! end
26670
26671 ## T89383
26672 !! test
26673 Selser: Check for validity of DSR before using it
26674 !! options
26675 parsoid={
26676 "modes": ["selser"],
26677 "changes": [
26678 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26679 ]
26680 }
26681 !! wikitext
26682 <span id="a">a</span>
26683 !! wikitext/edited
26684 {{DISPLAYTITLE:foo}}
26685 <span id="a">a</span>
26686 !! end
26687
26688 !! test
26689 1. DOMDiff: Changes to <ref> content should be looked up using id
26690 !! options
26691 parsoid={
26692 "modes": ["selser"],
26693 "changes": [
26694 ["#X", "after", "bar"],
26695 ["#Y", "after", "baz"]
26696 ]
26697 }
26698 !! wikitext
26699 X <ref><span id="X">foo</span></ref>
26700 Y <ref name="a" />
26701 <references>
26702 <ref name="a"><span id="Y">foo</span></ref>
26703 </references>
26704 !! wikitext/edited
26705 X <ref><span id="X">foo</span>bar</ref>
26706 Y <ref name="a" />
26707 <references>
26708 <ref name="a"><span id="Y">foo</span>baz</ref>
26709 </references>
26710 !! end
26711
26712 !! test
26713 2. DOMDiff: Changes to <ref> content should be looked up using id
26714 !! options
26715 parsoid={
26716 "modes": ["selser"],
26717 "changes": [
26718 ["#Z", "after", "bar"]
26719 ]
26720 }
26721 !! wikitext
26722 A <ref>foo bar for a</ref>
26723 B <ref group="X" name="b" />
26724
26725 <references />
26726
26727 <references group="X">
26728 <ref name="b"><span id="Z">foo</span></ref>
26729 </references>
26730 !! wikitext/edited
26731 A <ref>foo bar for a</ref>
26732 B <ref group="X" name="b" />
26733
26734 <references />
26735
26736 <references group="X">
26737 <ref name="b"><span id="Z">foo</span>bar</ref>
26738 </references>
26739 !! end
26740
26741 !! test
26742 Empty LI (T49673)
26743 !! wikitext
26744 * a
26745 *
26746 *
26747 * b
26748 !! html/php+tidy
26749 <ul>
26750 <li>a</li>
26751 <li class="mw-empty-li"></li>
26752 <li class="mw-empty-li"></li>
26753 <li>b</li>
26754 </ul>
26755 !! end