Sync up with Parsoid parserTests.
[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 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # comment run through Linker::formatComment() instead of main parser
30 # local format section links in edit comment text as local links
31 # notoc disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
33 #
34 # You can also set the following parser properties via test options:
35 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 # wgLinkHolderBatchSize, wgRawHtml
37 #
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
41
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
48
49 !!article
50 Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !!article
56 Template:Foo
57 !!text
58 FOO
59 !!endarticle
60
61 !! article
62 Template:Blank
63 !! text
64 !! endarticle
65
66 !! article
67 Template:pipe
68 !! text
69 |
70 !! endarticle
71
72 !!article
73 MediaWiki:bad image list
74 !!text
75 * [[File:Bad.jpg]] except [[Nasty page]]
76 !!endarticle
77
78 !! article
79 Template:inner list
80 !! text
81 * item 1
82 !! endarticle
83
84 !! article
85 Template:tbl-start
86 !! text
87 {|
88 !! endarticle
89
90 !! article
91 Template:tbl-end
92 !! text
93 |}
94 !! endarticle
95
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
101
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
107
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
113
114 !! article
115 Template:table_attribs
116 !! text
117 <noinclude>
118 |</noinclude>style="color: red"| Foo
119 !! endarticle
120
121 !! article
122 Template:table_cells
123 !! text
124 {{table_attribs}} || Bar || Baz
125 !! endarticle
126
127 !! article
128 Template:image_attribs
129 !! text
130 <noinclude>
131 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
132 !! endarticle
133
134 ## See T48811 for details
135 !! article
136 Template:mixed_attr_content_template
137 !! text
138 style="color:red;" title="T48811"
139 |-
140 |foo
141 !! endarticle
142
143 !! article
144 A?b
145 !! text
146 Weirdo titles!
147 !! endarticle
148
149 !!article
150 Template:Bullet
151 !!text
152 * Bar
153 !!endarticle
154
155 !!article
156 Template:OpenTable
157 !!text
158 {|
159 !!endarticle
160
161 !!article
162 Template:EmptyLITest
163 !!text
164 *a
165 *
166 *
167 *b
168 !!endarticle
169
170 !!article
171 Template:EmptyTRTest
172 !!text
173 {|
174 |-
175 |-
176 |foo
177 |-
178 |-
179 |bar
180 |}
181 !!endarticle
182
183 !!article
184 Template:EmptyTRWithHTMLAttrTest
185 !!text
186 <table>
187 <tr align="center"></tr>
188 <tr><td>foo</td></tr>
189 <tr align="center"></tr>
190 <tr><td>bar</td></tr>
191 </table>
192 !!endarticle
193
194 ###
195 ### Basic tests
196 ###
197 !! test
198 Blank input
199 !! wikitext
200 !! html
201 !! end
202
203
204 !! test
205 Simple paragraph
206 !! wikitext
207 This is a simple paragraph.
208 !! html
209 <p>This is a simple paragraph.
210 </p>
211 !! end
212
213 !! test
214 Paragraphs with extra newline spacing
215 !! wikitext
216 foo
217
218 bar
219
220
221 baz
222
223
224
225 booz
226 !! html
227 <p>foo
228 </p><p>bar
229 </p><p><br />
230 baz
231 </p><p><br />
232 </p><p>booz
233 </p>
234 !! end
235
236 !! test
237 Paragraphs with newline spacing with comment lines in between
238 !! wikitext
239 ----
240 a
241 <!--foo-->
242 b
243 ----
244 a
245 <!--foo--><!--More than 1 comment, still stripped-->
246 b
247 ----
248 a
249 <!--foo--> <!----> <!-- bar -->
250 b
251 ----
252 a
253 <!--foo-->
254
255 b
256 ----
257 a
258
259 <!--foo-->
260 b
261 ----
262 a
263 <!--foo-->
264
265
266 b
267 ----
268 a
269
270
271 <!--foo-->
272 b
273 ----
274 !! html
275 <hr />
276 <p>a
277 b
278 </p>
279 <hr />
280 <p>a
281 b
282 </p>
283 <hr />
284 <p>a
285 b
286 </p>
287 <hr />
288 <p>a
289 </p><p>b
290 </p>
291 <hr />
292 <p>a
293 </p><p>b
294 </p>
295 <hr />
296 <p>a
297 </p><p><br />
298 b
299 </p>
300 <hr />
301 <p>a
302 </p><p><br />
303 b
304 </p>
305 <hr />
306
307 !! end
308
309 !! test
310 Paragraphs with newline spacing with non-empty white-space lines in between
311 !! wikitext
312 ----
313 a
314
315 b
316 ----
317 a
318
319
320 b
321 ----
322 !! html
323 <hr />
324 <p>a
325 </p><p>b
326 </p>
327 <hr />
328 <p>a
329 </p><p><br />
330 b
331 </p>
332 <hr />
333
334 !! end
335
336 !! test
337 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
338 !! wikitext
339 ----
340 a
341 <!--foo-->
342 b
343 ----
344 a
345 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
346 b
347 ----
348 a
349
350 <!--foo-->
351 <!--bar-->
352 b
353 ----
354 a
355
356 <!--foo-->
357 <!--bar-->
358
359 b
360 ----
361 !! html
362 <hr />
363 <p>a
364 b
365 </p>
366 <hr />
367 <p>a
368 b
369 </p>
370 <hr />
371 <p>a
372 </p><p>b
373 </p>
374 <hr />
375 <p>a
376 </p><p><br />
377 b
378 </p>
379 <hr />
380
381 !! end
382
383 !! test
384 Extra newlines: More paragraphs with indented comment
385 !! wikitext
386 a
387
388 <!--boo-->
389
390 b
391 !! html
392 <p>a
393 </p><p><br />
394 b
395 </p>
396 !!end
397
398 !! test
399 Extra newlines followed by heading
400 !! wikitext
401 a
402
403
404
405 =b=
406 [[a]]
407
408
409 =b=
410 !! html
411 <p>a
412 </p><p><br />
413 </p>
414 <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>
415 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
416 </p><p><br />
417 </p>
418 <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>
419
420 !! end
421
422 !! test
423 Extra newlines between heading and content are swallowed
424 !! wikitext
425 =b=
426
427
428
429 [[a]]
430 !! html
431 <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>
432 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
433 </p>
434 !! end
435
436 !! test
437 Parsing an URL
438 !! wikitext
439 http://fr.wikipedia.org/wiki/🍺
440 <!-- EasterEgg we love beer, better be able be able to link to it -->
441 !! html
442 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
443 </p>
444 !! end
445
446 # Note that the html+tidy output removes the spaces after the <li>,
447 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
448 # This is an issue for all tests with lists. We intentionally do
449 # *not* add html+tidy clauses for these, as we don't want to
450 # document/test the broken behavior. (Parsoid matches the non-tidy
451 # output in these cases.)
452
453 !! test
454 Simple list
455 !! wikitext
456 * Item 1
457 * Item 2
458 !! html
459 <ul><li> Item 1</li>
460 <li> Item 2</li></ul>
461
462 !! end
463
464 !! test
465 Italics and bold
466 !! wikitext
467 * plain
468 * plain''italic''plain
469 * plain''italic''plain''italic''plain
470 * plain'''bold'''plain
471 * plain'''bold'''plain'''bold'''plain
472 * plain''italic''plain'''bold'''plain
473 * plain'''bold'''plain''italic''plain
474 * plain''italic'''bold-italic'''italic''plain
475 * plain'''bold''bold-italic''bold'''plain
476 * plain'''''bold-italic'''italic''plain
477 * plain'''''bold-italic''bold'''plain
478 * plain''italic'''bold-italic'''''plain
479 * plain'''bold''bold-italic'''''plain
480 * plain l'''italic''plain
481 * plain l''''bold''' plain
482 !! html
483 <ul><li> plain</li>
484 <li> plain<i>italic</i>plain</li>
485 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
486 <li> plain<b>bold</b>plain</li>
487 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
488 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
489 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
490 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
491 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
492 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
493 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
494 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
495 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
496 <li> plain l'<i>italic</i>plain</li>
497 <li> plain l'<b>bold</b> plain</li></ul>
498
499 !! end
500
501 # this example taken from the [[simple:Moon]] article (bug 47326)
502 !! test
503 Italics and possessives (1)
504 !! wikitext
505 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
506 !! html
507 <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
508 </p>
509 !! end
510
511 # this example taken from [[en:Flaming Pie]] (bug 49926)
512 !! test
513 Italics and possessives (2)
514 !! wikitext
515 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
516 !! html
517 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
518 </p>
519 !! end
520
521 # this example taken from [[en:Dictionary]] (bug 49926)
522 !! test
523 Italics and possessives (3)
524 !! wikitext
525 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''.
526 !! html
527 <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>.
528 </p>
529 !! end
530
531
532 ###
533 ### 2-quote opening sequence tests
534 ###
535 !! test
536 Italics and bold: 2-quote opening sequence: (2,2)
537 !! wikitext
538 ''foo''
539 !! html
540 <p><i>foo</i>
541 </p>
542 !!end
543
544 !! test
545 Italics and bold: 2-quote opening sequence: (2,3)
546 !! wikitext
547 ''foo'''
548 !! html/*
549 <p><i>foo'</i>
550 </p>
551 !!end
552
553 !! test
554 Italics and bold: 2-quote opening sequence: (2,4)
555 !! options
556 parsoid=wt2html
557 !! wikitext
558 ''foo''''
559 !! html/*
560 <p><i>foo''</i>
561 </p>
562 !!end
563
564 # same html as previous, but wikitext adjusted to match parsoid html2wt
565 !! test
566 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
567 !! wikitext
568 ''foo<nowiki>''</nowiki>''
569 !! html
570 <p><i>foo''</i>
571 </p>
572 !! end
573
574 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
575 !! test
576 Italics and bold: 2-quote opening sequence: (2,5)
577 !! options
578 parsoid=wt2html
579 !! wikitext
580 ''foo'''''
581 !! html/php
582 <p><i>foo</i>
583 </p>
584 !! html/parsoid
585 <p><i>foo</i><b></b>
586 </p>
587 !!end
588
589 # same html as previous, but wikitext adjusted to match parsoid html2wt
590 !! test
591 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
592 !! wikitext
593 ''foo'''''<nowiki/>'''
594 !! html/php
595 <p><i>foo</i>
596 </p>
597 !! html/parsoid
598 <p><i>foo</i><b></b>
599 </p>
600 !! end
601
602
603 ###
604 ### 3-quote opening sequence tests
605 ###
606
607 !! test
608 Italics and bold: 3-quote opening sequence: (3,2)
609 !! wikitext
610 '''foo''
611 !! html/*
612 <p>'<i>foo</i>
613 </p>
614 !!end
615
616 !! test
617 Italics and bold: 3-quote opening sequence: (3,3)
618 !! wikitext
619 '''foo'''
620 !! html
621 <p><b>foo</b>
622 </p>
623 !!end
624
625 !! test
626 Italics and bold: 3-quote opening sequence: (3,4)
627 !! wikitext
628 '''foo''''
629 !! html/*
630 <p><b>foo'</b>
631 </p>
632 !!end
633
634 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
635 !! test
636 Italics and bold: 3-quote opening sequence: (3,5)
637 !! options
638 parsoid=wt2html
639 !! wikitext
640 '''foo'''''
641 !! html/php
642 <p><b>foo</b>
643 </p>
644 !! html/parsoid
645 <p><b>foo</b><i></i>
646 </p>
647 !!end
648
649 # same html as previous, but wikitext adjusted to match parsoid html2wt
650 !! test
651 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
652 !! wikitext
653 '''foo'''''<nowiki/>''
654 !! html/php
655 <p><b>foo</b>
656 </p>
657 !! html/parsoid
658 <p><b>foo</b><i></i>
659 </p>
660 !! end
661
662
663 ###
664 ### 4-quote opening sequence tests
665 ###
666
667 !! test
668 Italics and bold: 4-quote opening sequence: (4,2)
669 !! options
670 parsoid=wt2html
671 !! wikitext
672 ''''foo''
673 !! html/*
674 <p>''<i>foo</i>
675 </p>
676 !!end
677
678 # same html as previous, but wikitext adjusted to match parsoid html2wt
679 !! test
680 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
681 !! wikitext
682 <nowiki>''</nowiki>''foo''
683 !! html
684 <p>''<i>foo</i>
685 </p>
686 !! end
687
688 !! test
689 Italics and bold: 4-quote opening sequence: (4,3)
690 !! wikitext
691 ''''foo'''
692 !! html/*
693 <p>'<b>foo</b>
694 </p>
695 !!end
696
697 !! test
698 Italics and bold: 4-quote opening sequence: (4,4)
699 !! options
700 parsoid=wt2html
701 !! wikitext
702 ''''foo''''
703 !! html/*
704 <p>'<b>foo'</b>
705 </p>
706 !!end
707
708 # same html as previous, but wikitext adjusted to match parsoid html2wt
709 !! test
710 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
711 !! wikitext
712 '<nowiki/>'''foo''''
713 !! html
714 <p>'<b>foo'</b>
715 </p>
716 !! end
717
718 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
719 !! test
720 Italics and bold: 4-quote opening sequence: (4,5)
721 !! options
722 parsoid=wt2html
723 !! wikitext
724 ''''foo'''''
725 !! html/php
726 <p>'<b>foo</b>
727 </p>
728 !! html/parsoid
729 <p>'<b>foo</b><i></i>
730 </p>
731 !!end
732
733 # same html as previous, but wikitext adjusted to match parsoid html2wt
734 !! test
735 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
736 !! wikitext
737 '<nowiki/>'''foo'''''<nowiki/>''
738 !! html/php
739 <p>'<b>foo</b>
740 </p>
741 !! html/parsoid
742 <p>'<b>foo</b><i></i>
743 </p>
744 !! end
745
746
747 ###
748 ### 5-quote opening sequence tests
749 ###
750
751 !! test
752 Italics and bold: 5-quote opening sequence: (5,2)
753 !! options
754 parsoid=wt2html
755 !! wikitext
756 '''''foo''
757 !! html/*
758 <p><b><i>foo</i></b>
759 </p>
760 !!end
761
762 # same html as previous, but wikitext adjusted to match parsoid html2wt
763 # skipping wt2html and html2html because it wants to put <i> before <b>
764 !! test
765 Italics and bold: 5-quote opening sequence: (5,2+3)
766 !! options
767 parsoid=wt2wt,html2wt
768 !! wikitext
769 '''''foo'''''
770 !! html
771 <p><b><i>foo</i></b>
772 </p>
773 !! end
774
775 !! test
776 Italics and bold: 5-quote opening sequence: (5,3)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 '''''foo'''
781 !! html/*
782 <p><i><b>foo</b></i>
783 </p>
784 !!end
785
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 5-quote opening sequence: (5,3+2)
789 !! wikitext
790 '''''foo'''''
791 !! html
792 <p><i><b>foo</b></i>
793 </p>
794 !! end
795
796 !! test
797 Italics and bold: 5-quote opening sequence: (5,4)
798 !! options
799 parsoid=wt2html
800 !! wikitext
801 '''''foo''''
802 !! html/*
803 <p><i><b>foo'</b></i>
804 </p>
805 !!end
806
807 !! test
808 Italics and bold: 5-quote opening sequence: (5,5)
809 !! wikitext
810 '''''foo'''''
811 !! html
812 <p><i><b>foo</b></i>
813 </p>
814 !!end
815
816 !! test
817 Italics and bold: 5-quote opening sequence: (5,6)
818 !! wikitext
819 '''''foo''''''
820 !! html/*
821 <p><i><b>foo'</b></i>
822 </p>
823 !! end
824
825 ###
826 ### multiple quote sequences in a line
827 ###
828 !! test
829 Italics and bold: multiple quote sequences: (2,4,2)
830 !! options
831 parsoid=wt2html
832 !! wikitext
833 ''foo''''bar''
834 !! html/*
835 <p><i>foo'<b>bar</b></i>
836 </p>
837 !!end
838
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
843 !! wikitext
844 ''foo'<nowiki/>'''bar'''''
845 !! html
846 <p><i>foo'<b>bar</b></i>
847 </p>
848 !! end
849
850
851 !! test
852 Italics and bold: multiple quote sequences: (2,4,3)
853 !! options
854 parsoid=wt2html
855 !! wikitext
856 ''foo''''bar'''
857 !! html/*
858 <p><i>foo'<b>bar</b></i>
859 </p>
860 !!end
861
862
863 # same html as previous, but wikitext adjusted to match parsoid html2wt
864 !! test
865 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
866 !! wikitext
867 ''foo'<nowiki/>'''bar'''''
868 !! html
869 <p><i>foo'<b>bar</b></i>
870 </p>
871 !! end
872
873
874 !! test
875 Italics and bold: multiple quote sequences: (2,4,4)
876 !! options
877 parsoid=wt2html
878 !! wikitext
879 ''foo''''bar''''
880 !! html/*
881 <p><i>foo'<b>bar'</b></i>
882 </p>
883 !!end
884
885
886 # same html as previous, but wikitext adjusted to match parsoid html2wt
887 !! test
888 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
889 !! wikitext
890 ''foo'<nowiki/>'''bar'<nowiki/>'''''
891 !! html
892 <p><i>foo'<b>bar'</b></i>
893 </p>
894 !! end
895
896
897 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
898 !! test
899 Italics and bold: multiple quote sequences: (3,4,2)
900 !! options
901 parsoid=wt2html
902 !! wikitext
903 '''foo''''bar''
904 !! html/php
905 <p><b>foo'</b>bar
906 </p>
907 !! html/parsoid
908 <p><b>foo'</b>bar<i></i>
909 </p>
910 !!end
911
912 # same html as previous, but wikitext adjusted to match parsoid html2wt
913 !! test
914 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
915 !! options
916 parsoid
917 !! wikitext
918 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
919 !! html/php
920 <p><b>foo'</b>bar
921 </p>
922 !! html/parsoid
923 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
924 </p>
925 !! end
926
927
928 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
929 !! test
930 Italics and bold: multiple quote sequences: (3,4,3)
931 !! options
932 parsoid=wt2html
933 !! wikitext
934 '''foo''''bar'''
935 !! html/php
936 <p><b>foo'</b>bar
937 </p>
938 !! html/parsoid
939 <p><b>foo'</b>bar<b></b>
940 </p>
941 !!end
942
943 # same html as previous, but wikitext adjusted to match parsoid html2wt
944 !! test
945 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
946 !! wikitext
947 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
948 !! html/php
949 <p><b>foo'</b>bar
950 </p>
951 !! html/parsoid
952 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
953 </p>
954 !! end
955
956 ###
957 ### other quote tests
958 ###
959 !! test
960 Italics and bold: other quote tests: (2,3,5)
961 !! wikitext
962 ''this is about '''foo's family'''''
963 !! html
964 <p><i>this is about <b>foo's family</b></i>
965 </p>
966 !!end
967
968
969 !! test
970 Italics and bold: other quote tests: (2,(3,3),2)
971 !! wikitext
972 ''this is about '''foo's''' family''
973 !! html
974 <p><i>this is about <b>foo's</b> family</i>
975 </p>
976 !!end
977
978
979 !! test
980 Italics and bold: other quote tests: (3,2,3,2)
981 !! options
982 parsoid=wt2html
983 !! wikitext
984 '''this is about ''foo'''s family''
985 !! html/*
986 <p><b>this is about <i>foo</i></b><i>s family</i>
987 </p>
988 !!end
989
990
991 # same html as previous, but wikitext adjusted to match parsoid html2wt
992 !! test
993 Italics and bold: other quote tests: (3,2,3+2+2,2)
994 !! wikitext
995 '''this is about ''foo'''''<nowiki/>''s family''
996 !! html
997 <p><b>this is about <i>foo</i></b><i>s family</i>
998 </p>
999 !! end
1000
1001
1002 !! test
1003 Italics and bold: other quote tests: (3,2,3,3)
1004 !! wikitext
1005 '''this is about ''foo'''s family'''
1006 !! html/*
1007 <p>'<i>this is about </i>foo<b>s family</b>
1008 </p>
1009 !!end
1010
1011
1012 !! test
1013 Italics and bold: other quote tests: (3,(2,2),3)
1014 !! wikitext
1015 '''this is about ''foo's'' family'''
1016 !! html
1017 <p><b>this is about <i>foo's</i> family</b>
1018 </p>
1019 !!end
1020
1021
1022 !! test
1023 Italicized possessive
1024 !! wikitext
1025 The ''[[Main Page]]'''s talk page.
1026 !! html/php
1027 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1028 </p>
1029 !! html/parsoid
1030 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1031 !! end
1032
1033 !! test
1034 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1035 (Requires tidy for PHP parser output to be fixed up)
1036 !! options
1037 parsoid=wt2html,wt2wt
1038 !! wikitext
1039 {|
1040 !''a!!''b
1041 |''a||''b
1042 |}
1043 !! html/php+tidy
1044 <table>
1045 <tr>
1046 <th><i>a</i></th>
1047 <th><i>b</i></th>
1048 <td><i>a</i></td>
1049 <td><i>b</i></td>
1050 </tr>
1051 </table>
1052 !! html/parsoid
1053 <table>
1054 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1055 <td><i>a</i></td><td><i>b</i></td></tr>
1056 </tbody></table>
1057 !! end
1058
1059 ###
1060 ### Non-html5 tags
1061 ###
1062
1063 !! test
1064 Non-html5 tags should be accepted
1065 !! wikitext
1066 <center>''foo''</center>
1067 <big>''foo''</big>
1068 <font>''foo''</font>
1069 <strike>''foo''</strike>
1070 <tt>''foo''</tt>
1071 !! html
1072 <center><i>foo</i></center>
1073 <p><big><i>foo</i></big>
1074 <font><i>foo</i></font>
1075 <strike><i>foo</i></strike>
1076 <tt><i>foo</i></tt>
1077 </p>
1078 !! end
1079
1080 !! test
1081 <wbr> is valid wikitext (bug 52468)
1082 !! wikitext
1083 <wbr>
1084 !! html
1085 <p><wbr />
1086 </p>
1087 !! end
1088
1089 # <strike> is HTML4, <s> is HTML4/5.
1090 !! test
1091 <s> or <strike> for strikethrough
1092 !! wikitext
1093 <strike>strike</strike>
1094
1095 <s>s</s>
1096 !! html
1097 <p><strike>strike</strike>
1098 </p><p><s>s</s>
1099 </p>
1100 !! end
1101
1102 ## a not permitted
1103 ## i,b,br omitted
1104 !! test
1105 Text-level semantic html elements in wikitext
1106 !! wikitext
1107 <em>text</em>
1108 <strong>text</strong>
1109 <small>text</small>
1110 <s>text</s>
1111 <cite>text</cite>
1112 <q>text</q>
1113 <dfn>text</dfn>
1114 <abbr>text</abbr>
1115 <data>text</data>
1116 <time>text</time>
1117 <code>text</code>
1118 <var>text</var>
1119 <samp>text</samp>
1120 <kbd>text</kbd>
1121 <sub>text</sub>
1122 <u>text</u>
1123 <mark>text</mark>
1124 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1125 <bdi>text</bdi>
1126 <bdo>text</bdo>
1127 <span>text</span>
1128 <wbr />
1129 !! html
1130 <p><em>text</em>
1131 <strong>text</strong>
1132 <small>text</small>
1133 <s>text</s>
1134 <cite>text</cite>
1135 <q>text</q>
1136 <dfn>text</dfn>
1137 <abbr>text</abbr>
1138 <data>text</data>
1139 <time>text</time>
1140 <code>text</code>
1141 <var>text</var>
1142 <samp>text</samp>
1143 <kbd>text</kbd>
1144 <sub>text</sub>
1145 <u>text</u>
1146 <mark>text</mark>
1147 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1148 <bdi>text</bdi>
1149 <bdo>text</bdo>
1150 <span>text</span>
1151 <wbr />
1152 </p>
1153 !! end
1154
1155 # test cases taken from
1156 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1157 !! test
1158 Ruby markup (W3C-style)
1159 !! wikitext
1160 ; Mono-ruby for individual base characters
1161 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1162 ; Group ruby
1163 : <ruby>今日<rt>きょう</rt></ruby>
1164 ; Jukugo ruby
1165 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1166 ; Inline ruby
1167 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1168 ; Double-sided ruby
1169 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1170 <ruby>
1171 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1172 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1173 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1174 </ruby>
1175 !! html
1176 <dl><dt> Mono-ruby for individual base characters</dt>
1177 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1178 <dt> Group ruby</dt>
1179 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1180 <dt> Jukugo ruby</dt>
1181 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1182 <dt> Inline ruby</dt>
1183 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1184 <dt> Double-sided ruby</dt>
1185 <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>
1186 <p><ruby>
1187 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1188 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1189 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1190 </ruby>
1191 </p>
1192 !! end
1193
1194 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1195 !! test
1196 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1197 !! wikitext
1198 <b→> doesn't work! </b→>
1199
1200 <bä> doesn't work! </bä>
1201
1202 <boo> works fine </boo>
1203
1204 <s.foo>s.foo</s.foo>
1205
1206 <sub-ID#1>
1207 !! html
1208 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1209 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1210 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1211 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1212 </p><p>&lt;sub-ID#1&gt;
1213 </p>
1214 !! end
1215
1216 !! test
1217 Isolated close tags should be treated as literal text (bug 52760)
1218 !! wikitext
1219 </b>
1220
1221 <s.foo>s</s>
1222 !! html
1223 <p>&lt;/b&gt;
1224 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1225 </p>
1226 !! end
1227
1228 ###
1229 ### Special characters
1230 ###
1231
1232 !! test
1233 Bare pipe character (bug 52363)
1234 !! wikitext
1235 |
1236 !! html
1237 <p>|
1238 </p>
1239 !! end
1240
1241 !! test
1242 Bare pipe character from a template (bug 52363)
1243 !! wikitext
1244 {{pipe}}
1245 !! html
1246 <p>|
1247 </p>
1248 !! end
1249
1250 ###
1251 ### <nowiki> test cases
1252 ###
1253
1254 !! test
1255 <nowiki> unordered list
1256 !! wikitext
1257 <nowiki>* This is not an unordered list item.</nowiki>
1258 !! html
1259 <p>* This is not an unordered list item.
1260 </p>
1261 !! end
1262
1263 !! test
1264 <nowiki> spacing
1265 !! wikitext
1266 <nowiki>Lorem ipsum dolor
1267
1268 sed abit.
1269 sed nullum.
1270
1271 :and a colon
1272 </nowiki>
1273 !! html
1274 <p>Lorem ipsum dolor
1275
1276 sed abit.
1277 sed nullum.
1278
1279 :and a colon
1280
1281 </p>
1282 !! end
1283
1284 !! test
1285 nowiki 3
1286 !! wikitext
1287 :There is not nowiki.
1288 :There is <nowiki>nowiki</nowiki>.
1289
1290 #There is not nowiki.
1291 #There is <nowiki>nowiki</nowiki>.
1292
1293 *There is not nowiki.
1294 *There is <nowiki>nowiki</nowiki>.
1295 !! html
1296 <dl><dd>There is not nowiki.</dd>
1297 <dd>There is nowiki.</dd></dl>
1298 <ol><li>There is not nowiki.</li>
1299 <li>There is nowiki.</li></ol>
1300 <ul><li>There is not nowiki.</li>
1301 <li>There is nowiki.</li></ul>
1302
1303 !! end
1304
1305 !! test
1306 Entities inside <nowiki>
1307 !! wikitext
1308 <nowiki>&lt;</nowiki>
1309 !! html
1310 <p>&lt;
1311 </p>
1312 !! end
1313
1314 !! test
1315 Entities inside template parameters
1316 !! options
1317 parsoid
1318 !! wikitext
1319 {{echo|&ndash;}}
1320 !! html
1321 <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>
1322 !! end
1323
1324 !! test
1325 Properly escape nowiki when combined with other wiki markup
1326 !! options
1327 parsoid=html2wt
1328 !! html
1329 <p>* &lt;/nowiki&gt; tag</p>
1330 !! wikitext
1331 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1332 !! end
1333
1334 ###
1335 ### Comments
1336 ###
1337 !! test
1338 Comments and Indent-Pre
1339 !! wikitext
1340 <!-- comment 1 --> asdf
1341
1342 <!-- comment 1 --> asdf
1343 <!-- comment 2 -->
1344
1345 <!-- comment 1 --> asdf
1346 <!-- comment 2 -->xyz
1347
1348 <!-- comment 1 --> asdf
1349 <!-- comment 2 --> xyz
1350 !! html
1351 <pre>asdf
1352 </pre>
1353 <pre>asdf
1354 </pre>
1355 <pre>asdf
1356 </pre>
1357 <p>xyz
1358 </p>
1359 <pre>asdf
1360 xyz
1361 </pre>
1362 !! end
1363
1364 !! test
1365 Comment test 2a
1366 !! wikitext
1367 asdf
1368 <!-- comment 1 -->
1369 jkl
1370 !! html
1371 <p>asdf
1372 jkl
1373 </p>
1374 !! end
1375
1376 !! test
1377 Comment test 2b
1378 !! wikitext
1379 asdf
1380 <!-- comment 1 -->
1381
1382 jkl
1383 !! html
1384 <p>asdf
1385 </p><p>jkl
1386 </p>
1387 !! end
1388
1389 !! test
1390 Comment test 3
1391 !! wikitext
1392 asdf
1393 <!-- comment 1 -->
1394 <!-- comment 2 -->
1395 jkl
1396 !! html
1397 <p>asdf
1398 jkl
1399 </p>
1400 !! end
1401
1402 !! test
1403 Comment test 4
1404 !! wikitext
1405 asdf<!-- comment 1 -->jkl
1406 !! html
1407 <p>asdfjkl
1408 </p>
1409 !! end
1410
1411 !! test
1412 Comment spacing
1413 !! wikitext
1414 a
1415 <!-- foo --> b <!-- bar -->
1416 c
1417 !! html
1418 <p>a
1419 </p>
1420 <pre> b
1421 </pre>
1422 <p>c
1423 </p>
1424 !! end
1425
1426 !! test
1427 Comment whitespace
1428 !! wikitext
1429 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1430 !! html
1431
1432 !! end
1433
1434 !! test
1435 Comment semantics and delimiters
1436 !! wikitext
1437 <!-- --><!----><!-----><!------>
1438 !! html
1439
1440 !! end
1441
1442 !! test
1443 Comment semantics and delimiters, redux
1444 !! wikitext
1445 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1446 -- foo -- funky huh? ... -->
1447 !! html
1448
1449 !! end
1450
1451 !! test
1452 Comment semantics and delimiters: directors cut
1453 !! wikitext
1454 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1455 everything starting with < followed by !-- until the first -- and > we see,
1456 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1457 -->-->
1458 !! html
1459 <p>--&gt;
1460 </p>
1461 !! end
1462
1463 !! test
1464 Comment semantics: nesting
1465 !! wikitext
1466 <!--<!-- no, we're not going to do anything fancy here -->-->
1467 !! html
1468 <p>--&gt;
1469 </p>
1470 !! end
1471
1472 !! test
1473 Comment semantics: unclosed comment at end
1474 !! wikitext
1475 <!--This comment will run out to the end of the document
1476 !! html
1477
1478 !! end
1479
1480 # Bug 58184: document parsoid's behaviour
1481 !! test
1482 Suppress comment closing tag in lenient browsers
1483 !! options
1484 parsoid=wt2html,html2html
1485 !! wikitext
1486 <!-- Browsers--!> think this is closed -->
1487 !! html/php
1488
1489 !! html/parsoid
1490 <!-- Browsers--¡> think this is closed -->
1491 !! end
1492
1493 !! test
1494 Comment in template title
1495 !! wikitext
1496 {{f<!---->oo}}
1497 !! html
1498 <p>FOO
1499 </p>
1500 !! end
1501
1502 !! test
1503 Comment on its own line post-expand
1504 !! wikitext
1505 a
1506 {{blank}}<!---->
1507 b
1508 !! html
1509 <p>a
1510 </p><p>b
1511 </p>
1512 !! end
1513
1514 !! test
1515 Comment on its own line post-expand with non-significant whitespace
1516 !! wikitext
1517 a
1518 {{blank}} <!---->
1519 b
1520 !! html
1521 <p>a
1522 </p><p>b
1523 </p>
1524 !! end
1525
1526 !! test
1527 Multiple comments should still parse as SOL-transparent
1528 !! options
1529 parsoid=wt2html,wt2wt
1530 !! wikitext
1531 <!--c1-->*a
1532 <!--c2--><!--c3--><!--c4-->*b
1533 !! html
1534 <ul>
1535 <li>a
1536 </li>
1537 <li>b
1538 </li>
1539 </ul>
1540 !! end
1541
1542 ###
1543 ### paragraph wrapping tests
1544 ###
1545 !! test
1546 No block tags
1547 !! wikitext
1548 a
1549
1550 b
1551 !! html
1552 <p>a
1553 </p><p>b
1554 </p>
1555 !! end
1556
1557 !! test
1558 Block tag on one line (<div>)
1559 !! wikitext
1560 a <div>foo</div>
1561
1562 b
1563 !! html
1564 a <div>foo</div>
1565 <p>b
1566 </p>
1567 !! html+tidy
1568 <p>a</p>
1569 <div>foo</div>
1570 <p>b</p>
1571 !! end
1572
1573 !! test
1574 Block tag on one line (<blockquote>)
1575 !! wikitext
1576 a <blockquote>foo</blockquote>
1577
1578 b
1579 !! html
1580 a <blockquote>foo</blockquote>
1581 <p>b
1582 </p>
1583 !! html+tidy
1584 <p>a</p>
1585 <blockquote>
1586 <p>foo</p>
1587 </blockquote>
1588 <p>b</p>
1589 !! end
1590
1591 !! test
1592 Block tag on both lines (<div>)
1593 !! wikitext
1594 a <div>foo</div>
1595
1596 b <div>foo</div>
1597 !! html
1598 a <div>foo</div>
1599 b <div>foo</div>
1600
1601 !! html+tidy
1602 <p>a</p>
1603 <div>foo</div>
1604 <p>b</p>
1605 <div>foo</div>
1606 !! end
1607
1608 !! test
1609 Block tag on both lines (<blockquote>)
1610 !! wikitext
1611 a <blockquote>foo</blockquote>
1612
1613 b <blockquote>foo</blockquote>
1614 !! html
1615 a <blockquote>foo</blockquote>
1616 b <blockquote>foo</blockquote>
1617
1618 !! html+tidy
1619 <p>a</p>
1620 <blockquote>
1621 <p>foo</p>
1622 </blockquote>
1623 <p>b</p>
1624 <blockquote>
1625 <p>foo</p>
1626 </blockquote>
1627 !! end
1628
1629 !! test
1630 Multiple lines without block tags
1631 !! wikitext
1632 <div>foo</div> a
1633 b
1634 c
1635 d<!--foo--> e
1636 x <div>foo</div> z
1637 !! html
1638 <div>foo</div> a
1639 <p>b
1640 c
1641 d e
1642 </p>
1643 x <div>foo</div> z
1644
1645 !! html+tidy
1646 <div>foo</div>
1647 <p>a</p>
1648 <p>b c d e</p>
1649 <p>x</p>
1650 <div>foo</div>
1651 <p>z</p>
1652 !! end
1653
1654 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1655 # So, we have a separate section for Parsoid. We don't want
1656 # to mimic this stripping behavior in Parsoid. It affects
1657 # editing experience and also requires us to maintain additional
1658 # info for RT-ing.
1659 !! test
1660 Empty lines between lines with block tags
1661 !! wikitext
1662 <div></div>
1663
1664
1665 <div></div>a
1666
1667 b
1668 <div>a</div>b
1669
1670 <div>b</div>d
1671
1672
1673 <div>e</div>
1674 !! html
1675 <div></div>
1676 <p><br />
1677 </p>
1678 <div></div>a
1679 <p>b
1680 </p>
1681 <div>a</div>b
1682 <div>b</div>d
1683 <p><br />
1684 </p>
1685 <div>e</div>
1686
1687 !! html+tidy
1688 <p><br /></p>
1689 <p>a</p>
1690 <p>b</p>
1691 <div>a</div>
1692 <p>b</p>
1693 <div>b</div>
1694 <p>d</p>
1695 <p><br /></p>
1696 <div>e</div>
1697 !! html/parsoid
1698 <div data-parsoid='{"stx":"html"}'></div>
1699
1700 <p><br /></p>
1701 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1702
1703 <p>b</p>
1704 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1705
1706 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1707
1708 <p><br /></p>
1709 <div data-parsoid='{"stx":"html"}'>e</div>
1710 !! end
1711
1712 ## PHP parser emits output which is broken
1713 ## XXX The parsoid output doesn't match the tidy output.
1714 !! test
1715 Unclosed HTML p-tags should be handled properly
1716 !! wikitext
1717 <div><p>foo</div>
1718 a
1719
1720 b
1721 !! html/php+tidy
1722 <div>
1723 <p>foo&lt;/div&gt;</p>
1724 <p>a</p>
1725 b</div>
1726 !! html/parsoid
1727 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1728 <p>a</p>
1729 <p>b</p>
1730 !! end
1731
1732 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1733 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1734 ## them for now.
1735 !! test
1736 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1737 !! options
1738 parsoid=wt2html
1739 !! wikitext
1740 a [[Category:A1]] [[Category:A2]]
1741 [[Category:A3]]
1742 [[Category:A4]]
1743 !! html/parsoid
1744 <p>a</p>
1745 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1746 !! end
1747
1748 !! test
1749 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1750 !! options
1751 parsoid=wt2html
1752 !! wikitext
1753 [[Category:A1]]a
1754 !! html/parsoid
1755 <link href="Category:A1"/><p>a</p>
1756 !! end
1757
1758 ###
1759 ### Preformatted text
1760 ###
1761 !! test
1762 Preformatted text
1763 !! wikitext
1764 This is some
1765 Preformatted text
1766 With ''italic''
1767 And '''bold'''
1768 And a [[Main Page|link]]
1769 !! html
1770 <pre>This is some
1771 Preformatted text
1772 With <i>italic</i>
1773 And <b>bold</b>
1774 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1775 </pre>
1776 !! end
1777
1778 !! test
1779 Tabs don't trigger preformatted text
1780 !! wikitext
1781 This is not
1782 preformatted text.
1783 This is preformatted text.
1784 So is this.
1785 !! html
1786 <p> This is not
1787 preformatted text.
1788 </p>
1789 <pre>This is preformatted text.
1790 So is this.
1791 </pre>
1792 !! end
1793
1794 !! test
1795 Ident preformatting with inline content
1796 !! wikitext
1797 a
1798 ''b''
1799 !! html
1800 <pre>a
1801 <i>b</i>
1802 </pre>
1803 !! end
1804
1805 !! test
1806 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1807 !! wikitext
1808 <pre><nowiki>
1809 <b>
1810 <cite>
1811 <em>
1812 </nowiki></pre>
1813 !! html
1814 <pre>
1815 &lt;b&gt;
1816 &lt;cite&gt;
1817 &lt;em&gt;
1818 </pre>
1819
1820 !! end
1821
1822 !! test
1823 Regression with preformatted in <center>
1824 !! wikitext
1825 <center>
1826 Blah
1827 </center>
1828 !! html
1829 <center>
1830 <pre>Blah
1831 </pre>
1832 </center>
1833
1834 !! end
1835
1836 !! test
1837 Bug 52763: Preformatted in <blockquote>
1838 !! wikitext
1839 <blockquote>
1840 Blah
1841 {|
1842 |
1843 indented cell (no pre-wrapping!)
1844 |}
1845 </blockquote>
1846 !! html
1847 <blockquote>
1848 <p> Blah
1849 </p>
1850 <table>
1851 <tr>
1852 <td>
1853 <p> indented cell (no pre-wrapping!)
1854 </p>
1855 </td></tr></table>
1856 </blockquote>
1857
1858 !! end
1859
1860 !! test
1861 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1862 !! wikitext
1863 <blockquote>
1864 Foo
1865
1866 Bar
1867 </blockquote>
1868 !! html
1869 <blockquote>
1870 <p>Foo
1871 </p><p>Bar
1872 </p>
1873 </blockquote>
1874
1875 !! end
1876
1877 !! test
1878 Bug 15491: <ins>/<del> in blockquote
1879 !! wikitext
1880 <blockquote>
1881 Foo <del>bar</del> <ins>baz</ins> quux
1882 </blockquote>
1883 !! html
1884 <blockquote>
1885 <p>Foo <del>bar</del> <ins>baz</ins> quux
1886 </p>
1887 </blockquote>
1888
1889 !! end
1890
1891 # Note that the p-wrapping is newline sensitive, which could be
1892 # considered a bug: tidy will wrap only the 'Foo' in the example
1893 # below in a <p> tag. (see comment 23-25 of bug #6200)
1894 !! test
1895 Bug 15491: <ins>/<del> in blockquote (2)
1896 !! wikitext
1897 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1898 </blockquote>
1899 !! html
1900 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1901 </blockquote>
1902
1903 !! html+tidy
1904 <blockquote>
1905 <p>Foo</p>
1906 <del>bar</del> <ins>baz</ins> quux</blockquote>
1907 !! end
1908
1909 !! test
1910 <pre> with attributes (bug 3202)
1911 !! wikitext
1912 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1913 !! html
1914 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1915
1916 !! end
1917
1918 !! test
1919 <pre> with width attribute (bug 3202)
1920 !! wikitext
1921 <pre width="8">Narrow screen goodies</pre>
1922 !! html
1923 <pre width="8">Narrow screen goodies</pre>
1924
1925 !! end
1926
1927 !! test
1928 <pre> with forbidden attribute (bug 3202)
1929 !! wikitext
1930 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1931 !! html
1932 <pre width="8">Narrow screen goodies</pre>
1933
1934 !! end
1935
1936 !! test
1937 Entities inside <pre>
1938 !! wikitext
1939 <pre>&lt;</pre>
1940 !! html
1941 <pre>&lt;</pre>
1942
1943 !! end
1944
1945 !! test
1946 <pre> with forbidden attribute values (bug 3202)
1947 !! wikitext
1948 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1949 !! html
1950 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1951
1952 !! end
1953
1954 !! test
1955 <nowiki> inside <pre> (bug 13238)
1956 !! wikitext
1957 <pre>
1958 <nowiki>
1959 </pre>
1960 <pre>
1961 <nowiki></nowiki>
1962 </pre>
1963 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1964 !! html
1965 <pre>
1966 &lt;nowiki&gt;
1967 </pre>
1968 <pre>
1969
1970 </pre>
1971 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1972
1973 !! end
1974
1975 !! test
1976 <nowiki> and <pre> preference (first one wins)
1977 !! wikitext
1978 <pre>
1979 <nowiki>
1980 </pre>
1981 </nowiki>
1982 </pre>
1983
1984 <nowiki>
1985 <pre>
1986 <nowiki>
1987 </pre>
1988 </nowiki>
1989 </pre>
1990
1991 !! html
1992 <pre>
1993 &lt;nowiki&gt;
1994 </pre>
1995 <p>&lt;/nowiki&gt;
1996 &lt;/pre&gt;
1997 </p><p>
1998 &lt;pre&gt;
1999 &lt;nowiki&gt;
2000 &lt;/pre&gt;
2001
2002 &lt;/pre&gt;
2003 </p>
2004 !! end
2005
2006 !! test
2007 </pre> inside nowiki
2008 !! wikitext
2009 <nowiki></pre></nowiki>
2010 !! html
2011 <p>&lt;/pre&gt;
2012 </p>
2013 !! end
2014
2015 # Parsoid doesn't strip empty tags, like Tidy does.
2016 !! test
2017 Empty pre; pre inside other HTML tags (bug 54946)
2018 !! options
2019 parsoid=wt2html,wt2wt
2020 !! wikitext
2021 a
2022
2023 <div><pre>
2024 foo
2025 </pre></div>
2026 <pre></pre>
2027 !! html/php
2028 <p>a
2029 </p>
2030 <div><pre>
2031 foo
2032 </pre></div>
2033 <pre></pre>
2034
2035 !! html/php+tidy
2036 <p>a</p>
2037 <div>
2038 <pre>
2039 foo
2040 </pre></div>
2041 !! html/parsoid
2042 <p>a</p>
2043
2044 <div><pre>foo
2045 </pre></div>
2046 <pre></pre>
2047 !! end
2048
2049 !! test
2050 HTML pre followed by indent-pre
2051 !! wikitext
2052 <pre>foo</pre>
2053 bar
2054 !! html
2055 <pre>foo</pre>
2056 <pre>bar
2057 </pre>
2058 !! end
2059
2060 !!test
2061 Block tag pre
2062 !!options
2063 parsoid
2064 !! wikitext
2065 <p><pre>foo</pre></p>
2066 !! html
2067 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2068 !!end
2069
2070 !!test
2071 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2072 !! wikitext
2073 {{echo|}}
2074 !! html
2075
2076 !!end
2077
2078 !!test
2079 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2080 !! wikitext
2081 {{echo|
2082 foo}}
2083 !! html
2084 <p>foo
2085 </p>
2086 !!end
2087
2088 !! test
2089 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2090 !! wikitext
2091 {{echo|a
2092 b}}
2093 !! html
2094 <pre>a
2095 </pre>
2096 <p>b
2097 </p>
2098 !!end
2099
2100 !! test
2101 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2102 !! wikitext
2103 {{echo|a
2104 b
2105 c
2106 d
2107 e
2108 }}
2109 !! html
2110 <pre>a
2111 </pre>
2112 <p>b
2113 c
2114 </p>
2115 <pre>d
2116 </pre>
2117 <p>e
2118 </p>
2119 !!end
2120
2121 !!test
2122 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2123 !! wikitext
2124 {{echo| foo}}
2125
2126 {{echo| foo}}{{echo| bar}}
2127
2128 {{echo| foo}}
2129 {{echo| bar}}
2130
2131 {{echo|<!--cmt--> foo}}
2132
2133 <!--cmt-->{{echo| foo}}
2134
2135 {{echo|{{echo| }}bar}}
2136 !! html
2137 <pre>foo
2138 </pre>
2139 <pre>foo bar
2140 </pre>
2141 <pre>foo
2142 bar
2143 </pre>
2144 <pre>foo
2145 </pre>
2146 <pre>foo
2147 </pre>
2148 <pre>bar
2149 </pre>
2150 !!end
2151
2152 !! test
2153 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2154 !! wikitext
2155 {{echo| }}a
2156
2157 {{echo|
2158 }}a
2159
2160 {{echo|
2161 b}}
2162
2163 {{echo|a
2164 }}b
2165
2166 {{echo|a
2167 }} b
2168 !! html
2169 <pre>a
2170 </pre>
2171 <p><br />
2172 </p>
2173 <pre>a
2174 </pre>
2175 <p><br />
2176 </p>
2177 <pre>b
2178 </pre>
2179 <p>a
2180 </p>
2181 <pre>b
2182 </pre>
2183 <p>a
2184 </p>
2185 <pre>b
2186 </pre>
2187 !!end
2188
2189 !! test
2190 Things that look like <pre> tags aren't treated as such
2191 !! wikitext
2192 Barack Obama <President> of the United States
2193 <President></President>
2194 !! html
2195 <p>Barack Obama &lt;President&gt; of the United States
2196 &lt;President&gt;&lt;/President&gt;
2197 </p>
2198 !! end
2199
2200 ## PHP parser discards the "<pre " string
2201 !! test
2202 Handle broken pre-like tags (bug 64025)
2203 !! options
2204 parsoid=wt2html
2205 !! wikitext
2206 {{echo|<pre <pre>x</pre>}}
2207
2208 <table><pre </table>
2209 !! html/php
2210 <pre>x</pre>
2211 <table><pre></pre></table>
2212
2213 !! html/parsoid
2214 <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>
2215
2216
2217 <p>&lt;pre </p>
2218
2219 <table></table>
2220 !! end
2221
2222 !! test
2223 Parsoid: handle pre with space after attribute
2224 !! options
2225 parsoid=wt2html
2226 !! wikitext
2227 <pre style="width:50%;" >{{echo|foo}}</pre>
2228 !! html
2229 <pre style="width:50%;">{{echo|foo}}</pre>
2230 !! end
2231
2232 # TODO / maybe: fix wt2wt for this
2233 !! test
2234 Parsoid: Don't paragraph-wrap fosterable content
2235 !! options
2236 parsoid=wt2html
2237 !! wikitext
2238 {|
2239 <td></td>
2240 <td></td>
2241
2242
2243
2244 |}
2245 !! html
2246 <table>
2247
2248 <tbody>
2249 <tr>
2250 <td></td>
2251
2252 <td></td></tr>
2253
2254
2255
2256 </tbody></table>
2257 !! end
2258
2259 !! test
2260 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2261 !! options
2262 parsoid=wt2html
2263 !! wikitext
2264 {|
2265 <td>
2266 <td>
2267 </td>
2268
2269
2270
2271 |}
2272 !! html
2273 <table>
2274
2275 <tbody>
2276 <tr>
2277 <td></td>
2278
2279 <td>
2280 </td></tr>
2281
2282
2283
2284 </tbody></table>
2285 !! end
2286
2287
2288 #--------------------------------------------------------------------
2289 # Transclusion parameter whitespace stripping tests
2290 # Behavior is different for positional and named parameters
2291 #--------------------------------------------------------------------
2292 !! test
2293 Templates: Strip leading and trailing whitespace from named-param values
2294 !! wikitext
2295 {{echo|1= a }}
2296
2297 {{echo|1= {{echo|b}} }}
2298
2299 {{echo| 1 =
2300 c }}
2301
2302 {{echo| 1 =
2303 * d
2304 }}
2305 !! html
2306 <p>a
2307 </p><p>b
2308 </p><p>c
2309 </p>
2310 <ul><li> d</li></ul>
2311
2312 !! end
2313
2314 !! test
2315 Templates: Don't strip whitespace from positional-param values
2316 !! wikitext
2317 {{echo|a }}
2318
2319 {{echo|{{echo|b}} }}
2320
2321 {{echo| c
2322 }}
2323
2324 {{echo| {{echo|d}}
2325 }}
2326
2327 {{echo|
2328 e}}
2329
2330 {{echo|
2331 * f}}
2332
2333 {{echo|
2334 }}g
2335 !! html
2336 <p>a
2337 </p><p>b
2338 </p>
2339 <pre>c
2340 </pre>
2341 <p><br />
2342 </p>
2343 <pre>d
2344 </pre>
2345 <p><br />
2346 </p>
2347 <pre>e
2348 </pre>
2349 <p><br />
2350 </p>
2351 <ul><li> f</li></ul>
2352 <p><br />
2353 </p>
2354 <pre>g
2355 </pre>
2356 !! end
2357
2358 !! test
2359 Templates: Handle empty comment-and-ws-only lines correctly
2360 !! wikitext
2361 {{echo|foo
2362 <!--should be ignored-->
2363 <!--should be ignored as well-->
2364 bar}}
2365 !! html
2366 <p>foo
2367 bar
2368 </p>
2369 !! end
2370
2371 !! test
2372 Templates: Handle comments in the target
2373 !! wikitext
2374 {{echo
2375 <!-- should be ignored -->
2376 |foo}}
2377
2378 {{echo<!-- should be ignored -->
2379 |foo}}
2380
2381 {{echo<!-- should be ignored -->|foo}}
2382
2383 {{<!-- should be ignored -->echo|foo}}
2384 !!html/parsoid
2385 <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>
2386
2387 <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>
2388
2389 <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>
2390
2391 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2392 !!end
2393
2394 !! test
2395 Templates: Handle comments in parameter names (bug 67657)
2396 !! wikitext
2397 {{echo|1
2398 <!-- should be ignored -->
2399 =foo}}
2400
2401 {{echo|
2402 <!-- should be ignored -->
2403 1 = foo}}
2404
2405 {{echo|1<!-- should be ignored --> = foo}}
2406
2407 {{echo|<!-- should be ignored -->1 = foo}}
2408 !!html/parsoid
2409 <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>
2410
2411 <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>
2412
2413 <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>
2414
2415 <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>
2416 !!end
2417
2418 !! test
2419 Templates: Other wikitext in parameter names (bug 67657)
2420 !! wikitext
2421 {{echo|''1''=foo}}
2422 !!html/parsoid
2423 <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>
2424 !!html/php
2425 <p>{{{1}}}
2426 </p>
2427 !!end
2428
2429 #--------------------------------------------------------------------
2430 # Transclusion parameter escaping tests
2431 #--------------------------------------------------------------------
2432 !! test
2433 Templates: Parsoid parameter escaping test 1
2434 !! options
2435 parsoid
2436 !! wikitext
2437 {{echo|[foo]|{{echo|[bar]}}}}
2438 !! html
2439 <p about="#mwt1" typeof="mw:Transclusion"
2440 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2441 !! end
2442
2443 !! test
2444 Parsoid: Pipes in external links in template parameter
2445 !! options
2446 parsoid
2447 !! wikitext
2448 {{echo|[{{echo|http://example.com}} link]}}
2449 !! html
2450 <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>
2451 !! end
2452
2453 !! test
2454 Parsoid: pipe in transclusion parameter
2455 !! options
2456 parsoid
2457 !! wikitext
2458 {{echo|http://foo.com/a&#124;b}}
2459 !! html
2460 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2461 typeof="mw:Transclusion"
2462 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>
2463 !! end
2464
2465 !! test
2466 Parsoid: Pipe in external link target and content in template parameter
2467 !! options
2468 parsoid=html2wt,wt2wt
2469 !! wikitext
2470 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2471 !! html
2472 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2473 typeof="mw:Transclusion"
2474 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2475 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2476 !! end
2477
2478 !! test
2479 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2480 !! options
2481 parsoid
2482 !! wikitext
2483 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2484 !! html
2485 <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>
2486 !! end
2487
2488 !! test
2489 Templates: Don't escape already nowiki-escaped text in template parameters
2490 !! options
2491 parsoid=html2wt,wt2wt
2492 !! wikitext
2493 {{echo|foo<nowiki>|</nowiki>bar}}
2494 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2495 {{echo|<nowiki></nowiki>}}
2496 !! html
2497 <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>
2498 <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>
2499 <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>
2500 </p>
2501 !! end
2502
2503 ## Bug 52824
2504 !! test
2505 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2506 !! options
2507 parsoid=html2wt,wt2wt
2508 !! wikitext
2509 {{echo|{{echo|1=bar}}}}
2510 !! html
2511 <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>
2512 !! end
2513
2514 ## Bug 56733
2515 !! test
2516 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2517 !! options
2518 parsoid
2519 !! wikitext
2520 {{echo|a : b}}
2521 !! html
2522 <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:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2523 !! end
2524
2525 ## Bug T73412
2526 !! test
2527 Templates: Preserve blank parameter names
2528 !! wikitext
2529 {{echo|=foo}}
2530 !! html/php
2531 <p>{{{1}}}
2532 </p>
2533 !! html/parsoid
2534 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2535 !! end
2536
2537 ###
2538 ### Parsoid-centric tests for testing RT edge cases for pre
2539 ###
2540
2541 !!test
2542 1a. Indent-Pre and Comments
2543 !! wikitext
2544 a
2545 <!--a-->
2546 c
2547 !! html
2548 <pre>a
2549 </pre>
2550 <p>c
2551 </p>
2552 !!end
2553
2554 !!test
2555 1b. Indent-Pre and Comments
2556 !! wikitext
2557 a
2558 <!--a-->
2559 c
2560 !! html
2561 <pre>a
2562 </pre>
2563 <p>c
2564 </p>
2565 !!end
2566
2567 !!test
2568 1c. Indent-Pre and Comments
2569 !! wikitext
2570 <!--a--> a
2571
2572 <!--a--> a
2573 !! html
2574 <pre> a
2575 </pre>
2576 <pre> a
2577 </pre>
2578 !!end
2579
2580 !!test
2581 1d. Indent-Pre and Comments
2582 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2583 !! wikitext
2584 <!--a--> a
2585
2586 <!--b-->b
2587 !! html
2588 <pre>a
2589 </pre>
2590 <pre>b
2591 </pre>
2592 !!end
2593
2594 !!test
2595 2a. Indent-Pre and tables
2596 !! wikitext
2597 {|
2598 |-
2599 !h1!!h2
2600 |foo||bar
2601 |}
2602 !! html
2603 <table>
2604
2605 <tr>
2606 <th>h1</th>
2607 <th>h2
2608 </th>
2609 <td>foo</td>
2610 <td>bar
2611 </td></tr></table>
2612
2613 !!end
2614
2615 !!test
2616 2b. Indent-Pre and tables
2617 !! wikitext
2618 {|
2619 |-
2620 |foo
2621 |}
2622 !! html
2623 <table>
2624
2625 <tr>
2626 <td>foo
2627 </td></tr></table>
2628
2629 !!end
2630
2631 !!test
2632 2c. Indent-Pre and tables (bug 42252)
2633 !! wikitext
2634 {|
2635 |+ foo
2636 ! | bar
2637 |}
2638 !! html
2639 <table>
2640 <caption> foo
2641 </caption>
2642 <tr>
2643 <th> bar
2644 </th></tr></table>
2645
2646 !!end
2647
2648 !!test
2649 2d. Indent-Pre and tables
2650 !! wikitext
2651 a
2652 {|
2653 | b
2654 |}
2655 !! html/php
2656 <pre>a
2657 </pre>
2658 <table>
2659 <tr>
2660 <td> b
2661 </td></tr></table>
2662
2663 !! html/parsoid
2664 <pre>a</pre>
2665 <table>
2666 <tbody><tr><td> b</td></tr>
2667 </tbody></table>
2668 !!end
2669
2670 !!test
2671 2e. Indent-Pre and table-line syntax
2672 !! wikitext
2673 a
2674 | b
2675 | c
2676 !! html/php
2677 <pre>a
2678 | b
2679 | c
2680 </pre>
2681 !!end
2682
2683 !!test
2684 2f. Indent-pre started by table-line syntax
2685 !! wikitext
2686 a
2687 | b
2688 | c
2689 !! html/php
2690 <p>a
2691 </p>
2692 <pre>| b
2693 | c
2694 </pre>
2695 !! html/parsoid
2696 <p>a</p>
2697 <pre>
2698 | b
2699 | c</pre>
2700 !!end
2701
2702 !!test
2703 3a. Indent-Pre and block tags (single-line html)
2704 !! wikitext
2705 a <p> foo </p>
2706 b <div> foo </div>
2707 c <blockquote> foo </blockquote>
2708 <span> foo </span>
2709 !! html
2710 a <p> foo </p>
2711 b <div> foo </div>
2712 c <blockquote> foo </blockquote>
2713 <pre><span> foo </span>
2714 </pre>
2715 !! html/parsoid
2716 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2717 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2718 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2719 <pre><span> foo </span>
2720 </pre>
2721 !! html+tidy
2722 <p>a</p>
2723 <p>foo</p>
2724 <p>b</p>
2725 <div>foo</div>
2726 <p>c</p>
2727 <blockquote>
2728 <p>foo</p>
2729 </blockquote>
2730 <pre>
2731 <span> foo </span>
2732 </pre>
2733 !! end
2734
2735 !!test
2736 3b. Indent-Pre and block tags (multi-line html)
2737 !! wikitext
2738 a <span>foo</span>
2739 b <div> foo </div>
2740 !! html
2741 <pre>a <span>foo</span>
2742 </pre>
2743 b <div> foo </div>
2744
2745 !! html/parsoid
2746 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2747 b <div data-parsoid='{"stx":"html"}'> foo </div>
2748 !! html+tidy
2749 <pre>
2750 a <span>foo</span>
2751 </pre>
2752 <p>b</p>
2753 <div>foo</div>
2754 !!end
2755
2756 !!test
2757 3c. Indent-Pre and block tags (pre-content on separate line)
2758 !! wikitext
2759 <p>
2760 foo
2761 </p>
2762
2763 <div>
2764 foo
2765 </div>
2766
2767 <center>
2768 foo
2769 </center>
2770
2771 <blockquote>
2772 foo
2773 </blockquote>
2774
2775 <blockquote>
2776 <pre>
2777 foo
2778 </pre>
2779 </blockquote>
2780
2781 <table><tr><td>
2782 foo
2783 </td></tr></table>
2784
2785 <ul><li>
2786 foo
2787 </li></ul>
2788
2789 !! html
2790 <p>
2791 foo
2792 </p>
2793 <div>
2794 <pre>foo
2795 </pre>
2796 </div>
2797 <center>
2798 <pre>foo
2799 </pre>
2800 </center>
2801 <blockquote>
2802 <p> foo
2803 </p>
2804 </blockquote>
2805 <blockquote>
2806 <pre>
2807 foo
2808 </pre>
2809 </blockquote>
2810 <table><tr><td>
2811 <pre>foo
2812 </pre>
2813 </td></tr></table>
2814 <ul><li>
2815 foo
2816 </li></ul>
2817
2818 !!end
2819
2820 !!test
2821 4. Indent-Pre and extension tags
2822 !! wikitext
2823 a <gallery>
2824 File:foobar.jpg
2825 </gallery>
2826 !! html
2827 a <ul class="gallery mw-gallery-traditional">
2828 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2829 <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" /></a></div></div>
2830 <div class="gallerytext">
2831 </div>
2832 </div></li>
2833 </ul>
2834
2835 !! html+tidy
2836 <p>a</p>
2837 <ul class="gallery mw-gallery-traditional">
2838 <li class="gallerybox" style="width: 155px">
2839 <div style="width: 155px">
2840 <div class="thumb" style="width: 150px;">
2841 <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" /></a></div>
2842 </div>
2843 <div class="gallerytext"></div>
2844 </div>
2845 </li>
2846 </ul>
2847 !!end
2848
2849 !! test
2850 Table wikitext syntax outside wiki-tables
2851 !! wikitext
2852 a
2853 ! not a table heading
2854 |- not a table row
2855 | not a table cell
2856 | class="foo bar" | baz
2857 b
2858 |}
2859 |-
2860 c
2861 !! html
2862 <p>a
2863 ! not a table heading
2864 |- not a table row
2865 | not a table cell
2866 | class="foo bar" | baz
2867 b
2868 |}
2869 |-
2870 c
2871 </p>
2872 !! end
2873
2874 !!test
2875 Render paragraphs when indent-pre is suppressed in blocklevels
2876 !! wikitext
2877 <blockquote>
2878 foo
2879
2880 bar
2881 </blockquote>
2882 !! html
2883 <blockquote>
2884 <p> foo
2885 </p><p> bar
2886 </p>
2887 </blockquote>
2888
2889 !!end
2890
2891 !!test
2892 4. Multiple spaces at start-of-line
2893 !! wikitext
2894 <p> foo </p>
2895 foo
2896 {|
2897 |foo
2898 |}
2899 !! html
2900 <p> foo </p>
2901 <pre> foo
2902 </pre>
2903 <table>
2904 <tr>
2905 <td>foo
2906 </td></tr></table>
2907
2908 !!end
2909
2910 ## NOTE: the leading white-space chars on empty line are significant
2911 !! test
2912 5a. White-space in indent-pre
2913 !! wikitext
2914 a<br />
2915
2916 b
2917 !! html
2918 <pre>a<br />
2919
2920 b
2921 </pre>
2922 !! end
2923
2924 ## NOTE: the leading white-space chars on empty line are significant
2925 !! test
2926 5b. White-space in indent-pre
2927 !! wikitext
2928 a
2929
2930 b
2931
2932
2933 c
2934 !! html
2935 <pre>a
2936
2937 b
2938
2939
2940 c
2941 </pre>
2942 !! end
2943
2944 !! test
2945 5c. White-space in indent-pre
2946 !! wikitext
2947 ''a''
2948 ''b''
2949 ''c''
2950 !! html
2951 <pre><i>a</i>
2952 <i>b</i>
2953 <i>c</i>
2954 </pre>
2955 !! end
2956
2957 !! test
2958 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2959 !! wikitext
2960 a
2961
2962 <!-- continue -->
2963 b
2964
2965 c
2966
2967 d
2968 !! html
2969 <pre>a
2970
2971 b
2972 </pre>
2973 <pre>c
2974
2975 </pre>
2976 <p>d
2977 </p>
2978 !! end
2979
2980 !! test
2981 7a. Indent-pre and category links
2982 !! options
2983 parsoid=wt2html,wt2wt
2984 !! wikitext
2985 [[Category:foo]] <!-- No pre-wrapping -->
2986 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2987 !! html
2988 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2989 <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-wrapping -->
2990 !! end
2991
2992 !! test
2993 7b. Indent-pre and category links
2994 !! options
2995 parsoid=wt2html,wt2wt
2996 !! wikitext
2997 [[Category:foo]] a
2998 [[Category:foo]] {{echo|b}}
2999 !! html
3000 <pre>
3001 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3002 <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>
3003 !! end
3004
3005 ###
3006 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3007 ###
3008
3009 !!test
3010 HTML-pre: 1. embedded newlines
3011 !! wikitext
3012 <pre>foo</pre>
3013
3014 <pre>
3015 foo
3016 </pre>
3017
3018 <pre>
3019
3020 foo
3021 </pre>
3022
3023 <pre>
3024
3025
3026 foo
3027 </pre>
3028 !! html
3029 <pre>foo</pre>
3030 <pre>
3031 foo
3032 </pre>
3033 <pre>
3034
3035 foo
3036 </pre>
3037 <pre>
3038
3039
3040 foo
3041 </pre>
3042
3043 !! html/parsoid
3044 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3045
3046 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3047 foo
3048 </pre>
3049
3050 <pre data-parsoid='{"stx":"html"}'>
3051
3052 foo
3053 </pre>
3054
3055 <pre data-parsoid='{"stx":"html"}'>
3056
3057
3058 foo
3059 </pre>
3060 !!end
3061
3062 !! test
3063 HTML-pre: big spaces
3064 !! wikitext
3065 <pre>
3066
3067
3068
3069
3070 haha
3071
3072
3073
3074
3075 haha
3076
3077
3078
3079
3080 </pre>
3081 !! html
3082 <pre>
3083
3084
3085
3086
3087 haha
3088
3089
3090
3091
3092 haha
3093
3094
3095
3096
3097 </pre>
3098
3099 !! html/parsoid
3100 <pre data-parsoid='{"stx":"html"}'>
3101
3102
3103
3104
3105 haha
3106
3107
3108
3109
3110 haha
3111
3112
3113
3114
3115 </pre>
3116 !! end
3117
3118 !!test
3119 HTML-pre: 2: indented text
3120 !! wikitext
3121 <pre>
3122 foo
3123 </pre>
3124 !! html
3125 <pre>
3126 foo
3127 </pre>
3128
3129 !!end
3130
3131 !!test
3132 HTML-pre: 3: other wikitext
3133 !! wikitext
3134 <pre>
3135 * foo
3136 # bar
3137 = no-h =
3138 '' no-italic ''
3139 [[ NoLink ]]
3140 </pre>
3141 !! html
3142 <pre>
3143 * foo
3144 # bar
3145 = no-h =
3146 '' no-italic ''
3147 [[ NoLink ]]
3148 </pre>
3149
3150 !!end
3151
3152 ###
3153 ### Definition lists
3154 ###
3155 !! test
3156 Simple definition
3157 !! wikitext
3158 ; name : Definition
3159 !! html
3160 <dl><dt> name&#160;</dt>
3161 <dd> Definition</dd></dl>
3162
3163 !! end
3164
3165 !! test
3166 Definition list for indentation only
3167 !! wikitext
3168 : Indented text
3169 !! html
3170 <dl><dd> Indented text</dd></dl>
3171
3172 !! end
3173
3174 !! test
3175 Definition list with no space
3176 !! wikitext
3177 ;name:Definition
3178 !! html
3179 <dl><dt>name</dt>
3180 <dd>Definition</dd></dl>
3181
3182 !!end
3183
3184 !! test
3185 Definition list with URL link
3186 !! wikitext
3187 ; http://example.com/ : definition
3188 !! html
3189 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3190 <dd> definition</dd></dl>
3191
3192 !! end
3193
3194 !! test
3195 Definition list with bracketed URL link
3196 !! wikitext
3197 ;[http://www.example.com/ Example]:Something about it
3198 !! html
3199 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3200 <dd>Something about it</dd></dl>
3201
3202 !! end
3203
3204 !! test
3205 Definition list with wikilink containing colon
3206 !! wikitext
3207 ; [[Help:FAQ]]: The least-read page on Wikipedia
3208 !! html
3209 <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>
3210 <dd> The least-read page on Wikipedia</dd></dl>
3211
3212 !! end
3213
3214 # At Brion's and JeLuF's insistence... :)
3215 !! test
3216 Definition list with news link containing colon
3217 !! wikitext
3218 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3219 !! html/php
3220 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3221 <dd> This isn't even a real newsgroup!</dd></dl>
3222
3223 !! html/parsoid
3224 <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>
3225 !! end
3226
3227 !! test
3228 Malformed definition list with colon
3229 !! wikitext
3230 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3231 !! html
3232 <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>
3233
3234 !! end
3235
3236 !! test
3237 Definition lists: colon in external link text
3238 !! wikitext
3239 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3240 !! html
3241 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3242 <dd> OK, I made that up</dd></dl>
3243
3244 !! end
3245
3246 !! test
3247 Definition lists: colon in HTML attribute
3248 !! wikitext
3249 ;<b style="display: inline">bold</b>
3250 !! html
3251 <dl><dt><b style="display: inline">bold</b></dt></dl>
3252
3253 !! end
3254
3255 !! test
3256 Definition lists: self-closed tag
3257 !! wikitext
3258 ;one<br/>two : two-line fun
3259 !! html
3260 <dl><dt>one<br />two&#160;</dt>
3261 <dd> two-line fun</dd></dl>
3262
3263 !! end
3264
3265 !! test
3266 Bug 11748: Literal closing tags
3267 !! wikitext
3268 <dl>
3269 <dt>test 1</dt>
3270 <dd>test test test test test</dd>
3271 <dt>test 2</dt>
3272 <dd>test test test test test</dd>
3273 </dl>
3274 !! html
3275 <dl>
3276 <dt>test 1</dt>
3277 <dd>test test test test test</dd>
3278 <dt>test 2</dt>
3279 <dd>test test test test test</dd>
3280 </dl>
3281
3282 !! end
3283
3284 !! test
3285 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3286 !! wikitext
3287 <ul><li>
3288 ; term : description
3289 * unordered
3290 </li></ul>
3291 !! html
3292 <ul><li>
3293 <dl><dt> term&#160;</dt>
3294 <dd> description</dd></dl>
3295 <ul><li> unordered</li></ul>
3296 </li></ul>
3297
3298 !! end
3299
3300 !! test
3301
3302 Definition list with empty definition and following paragraph
3303 !! wikitext
3304 ; term:
3305 Paragraph text
3306 !! html
3307 <dl><dt> term</dt>
3308 <dd></dd></dl>
3309 <p>Paragraph text
3310 </p>
3311 !! end
3312
3313 !! test
3314 Nested definition lists using html syntax
3315 !! wikitext
3316 <dl><dt>x</dt>
3317 <dd>a</dd>
3318 <dd>b</dd></dl>
3319
3320 !! end
3321
3322 !! test
3323 Definition Lists: No nesting: Multiple dd's
3324 !! wikitext
3325 ;x
3326 :a
3327 :b
3328 !! html
3329 <dl><dt>x</dt>
3330 <dd>a</dd>
3331 <dd>b</dd></dl>
3332
3333 !! end
3334
3335 !! test
3336 Definition Lists: Indentation: Regular
3337 !! wikitext
3338 :i1
3339 ::i2
3340 :::i3
3341 !! html
3342 <dl><dd>i1
3343 <dl><dd>i2
3344 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3345
3346 !! end
3347
3348 !! test
3349 Definition Lists: Indentation: Missing 1st level
3350 !! wikitext
3351 ::i2
3352 :::i3
3353 !! html
3354 <dl><dd><dl><dd>i2
3355 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3356
3357 !! end
3358
3359 !! test
3360 Definition Lists: Indentation: Multi-level indent
3361 !! wikitext
3362 :::i3
3363 !! html
3364 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3365
3366 !! end
3367
3368 !! test
3369 Definition Lists: Hacky use to indent tables
3370 !! wikitext
3371 ::{|
3372 |foo
3373 |bar
3374 |}
3375 this text
3376 should be left alone
3377 !! html
3378 <dl><dd><dl><dd><table>
3379 <tr>
3380 <td>foo
3381 </td>
3382 <td>bar
3383 </td></tr></table></dd></dl></dd></dl>
3384 <p>this text
3385 should be left alone
3386 </p>
3387 !! end
3388
3389 !! test
3390 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3391 !! wikitext
3392 <!-- foo -->
3393 ::{|
3394 |foo
3395 |bar
3396 |}<!-- bar -->
3397 this text
3398 should be left alone
3399 !! html/parsoid
3400 <!-- foo -->
3401 <dl><dd><dl><dd><table><tr>
3402 <td>foo</td>
3403 <td>bar</td>
3404 </tr></table><!-- bar --></dd></dl></dd></dl>
3405 <p>this text
3406 should be left alone</p>
3407 !! end
3408
3409 !! test
3410 Definition Lists: Hacky use to indent tables, with comment before table
3411 !! wikitext
3412 ::<!-- foo -->{|
3413 |foo
3414 |}
3415 !! html/parsoid
3416 <dl><dd><dl><dd><!-- foo --><table><tr>
3417 <td>foo</td>
3418 </tr></table></dd></dl></dd></dl>
3419 !! end
3420
3421 # Bug 52473
3422 !! test
3423 Definition Lists: Hacky use to indent tables (WS-insensitive)
3424 !! options
3425 parsoid
3426 !! wikitext
3427 : {|
3428 |a
3429 |}
3430 !! html
3431 <dl>
3432 <dd> <table><tr><td>a</td></tr></table> </dd>
3433 </dl>
3434 !! end
3435 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3436 ## as an empty dt item. It also ignores all but the last ";" when followed
3437 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3438 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3439 ## ";"s.
3440 ##
3441 ## Ex: ";;t2 ::d2" is transformed into:
3442 ##
3443 ## <dl>
3444 ## <dt>t2 </dt>
3445 ## <dd>
3446 ## <dl>
3447 ## <dt></dt>
3448 ## <dd>d2</dd>
3449 ## </dl>
3450 ## </dd>
3451 ## </dl>
3452 ##
3453 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3454 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3455 ##
3456 ## <dl>
3457 ## <dt>
3458 ## <dl>
3459 ## <dt>t2 </dt>
3460 ## <dd>:d2</dd>
3461 ## </dl>
3462 ## </dt>
3463 ## </dl>
3464 ##
3465 ## All Parsoid only definition list tests have this difference.
3466 ##
3467 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3468 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3469
3470 !! test
3471 Table / list interaction: indented table with lists in table contents
3472 !! wikitext
3473 :{|
3474 |-
3475 | a
3476 * b
3477 |-
3478 | c
3479 * d
3480 |}
3481 !! html
3482 <dl><dd><table>
3483
3484 <tr>
3485 <td> a
3486 <ul><li> b</li></ul>
3487 </td></tr>
3488 <tr>
3489 <td> c
3490 <ul><li> d</li></ul>
3491 </td></tr></table></dd></dl>
3492
3493 !! end
3494
3495 !!test
3496 Table / list interaction: lists nested in tables nested in indented lists
3497 !! wikitext
3498 :{|
3499 |
3500 :a
3501 :b
3502 |
3503 *c
3504 *d
3505 |}
3506
3507 *e
3508 *f
3509 !! html
3510 <dl><dd><table>
3511 <tr>
3512 <td>
3513 <dl><dd>a</dd>
3514 <dd>b</dd></dl>
3515 </td>
3516 <td>
3517 <ul><li>c</li>
3518 <li>d</li></ul>
3519 </td></tr></table></dd></dl>
3520 <ul><li>e</li>
3521 <li>f</li></ul>
3522
3523 !!end
3524
3525 !! test
3526 Definition Lists: Nesting: Multi-level (Parsoid only)
3527 !! options
3528 parsoid
3529 !! wikitext
3530 ;t1 :d1
3531 ;;t2 ::d2
3532 ;;;t3 :::d3
3533 !! html
3534 <dl>
3535 <dt>t1 </dt>
3536 <dd>d1</dd>
3537 <dt>
3538 <dl>
3539 <dt>t2 </dt>
3540 <dd>:d2</dd>
3541 <dt>
3542 <dl>
3543 <dt>t3 </dt>
3544 <dd>::d3</dd>
3545 </dl>
3546 </dt>
3547 </dl>
3548 </dt>
3549 </dl>
3550
3551
3552 !! end
3553
3554
3555 !! test
3556 Definition Lists: Nesting: Test 2 (Parsoid only)
3557 !! options
3558 parsoid
3559 !! wikitext
3560 ;t1
3561 ::d2
3562 !! html
3563 <dl>
3564 <dt>t1</dt>
3565 <dd>
3566 <dl>
3567 <dd>d2</dd>
3568 </dl>
3569 </dd>
3570 </dl>
3571
3572 !! end
3573
3574
3575 !! test
3576 Definition Lists: Nesting: Test 3 (Parsoid only)
3577 !! options
3578 parsoid
3579 !! wikitext
3580 :;t1
3581 ::::d2
3582 !! html
3583 <dl>
3584 <dd>
3585 <dl>
3586 <dt>t1</dt>
3587 <dd>
3588 <dl>
3589 <dd>
3590 <dl>
3591 <dd>d2</dd>
3592 </dl>
3593 </dd>
3594 </dl>
3595 </dd>
3596 </dl>
3597 </dd>
3598 </dl>
3599
3600 !! end
3601
3602
3603 !! test
3604 Definition Lists: Nesting: Test 4
3605 !! wikitext
3606 ::;t3
3607 :::d3
3608 !! html
3609 <dl><dd><dl><dd><dl><dt>t3</dt>
3610 <dd>d3</dd></dl></dd></dl></dd></dl>
3611
3612 !! end
3613
3614
3615 ## The Parsoid team believes the following three test exposes a
3616 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3617 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3618 ## It also exposes a "misfeature" in tidy, which doesn't like
3619 ## <dl> tags with a single <dt> child; it converts the <dt> into
3620 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3621 !! test
3622 Definition Lists: Mixed Lists: Test 1
3623 !! wikitext
3624 :;* foo
3625 ::* bar
3626 :; baz
3627 !! html/php
3628 <dl><dd><dl><dt><ul><li> foo</li>
3629 <li> bar</li></ul></dt></dl>
3630 <dl><dt> baz</dt></dl></dd></dl>
3631
3632 !! html/php+tidy
3633 <dl>
3634 <dd>
3635 <dl>
3636 <dd>
3637 <ul>
3638 <li>foo</li>
3639 <li>bar</li>
3640 </ul>
3641 </dd>
3642 </dl>
3643 <dl>
3644 <dt>baz</dt>
3645 </dl>
3646 </dd>
3647 </dl>
3648 !! html/parsoid
3649 <dl>
3650 <dd><dl>
3651 <dt><ul>
3652 <li> foo
3653 </li>
3654 </ul></dt>
3655 <dd><ul>
3656 <li> bar
3657 </li>
3658 </ul></dd>
3659 <dt> baz</dt>
3660 </dl></dd>
3661 </dl>
3662 !! end
3663
3664 !! test
3665 Definition Lists: Mixed Lists: Test 2
3666 !! wikitext
3667 *: d1
3668 *: d2
3669 !! html
3670 <ul><li><dl><dd> d1</dd>
3671 <dd> d2</dd></dl></li></ul>
3672
3673 !! end
3674
3675
3676 !! test
3677 Definition Lists: Mixed Lists: Test 3
3678 !! wikitext
3679 *::: d1
3680 *::: d2
3681 !! html
3682 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3683 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3684
3685 !! end
3686
3687
3688 !! test
3689 Definition Lists: Mixed Lists: Test 4
3690 !! wikitext
3691 *;d1 :d2
3692 *;d3 :d4
3693 !! html
3694 <ul><li><dl><dt>d1&#160;</dt>
3695 <dd>d2</dd>
3696 <dt>d3&#160;</dt>
3697 <dd>d4</dd></dl></li></ul>
3698
3699 !! end
3700
3701
3702 !! test
3703 Definition Lists: Mixed Lists: Test 5
3704 !! wikitext
3705 *:d1
3706 *:: d2
3707 !! html
3708 <ul><li><dl><dd>d1
3709 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3710
3711 !! end
3712
3713
3714 !! test
3715 Definition Lists: Mixed Lists: Test 6
3716 !! wikitext
3717 #*:d1
3718 #*::: d3
3719 !! html
3720 <ol><li><ul><li><dl><dd>d1
3721 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3722
3723 !! end
3724
3725
3726 !! test
3727 Definition Lists: Mixed Lists: Test 7
3728 !! wikitext
3729 :* d1
3730 :* d2
3731 !! html
3732 <dl><dd><ul><li> d1</li>
3733 <li> d2</li></ul></dd></dl>
3734
3735 !! end
3736
3737
3738 !! test
3739 Definition Lists: Mixed Lists: Test 8
3740 !! wikitext
3741 :* d1
3742 ::* d2
3743 !! html
3744 <dl><dd><ul><li> d1</li></ul>
3745 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3746
3747 !! end
3748
3749
3750 !! test
3751 Definition Lists: Mixed Lists: Test 9
3752 !! wikitext
3753 *;foo :bar
3754 !! html
3755 <ul><li><dl><dt>foo&#160;</dt>
3756 <dd>bar</dd></dl></li></ul>
3757
3758 !! end
3759
3760
3761 !! test
3762 Definition Lists: Mixed Lists: Test 10
3763 !! wikitext
3764 *#;foo :bar
3765 !! html
3766 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3767 <dd>bar</dd></dl></li></ol></li></ul>
3768
3769 !! end
3770
3771 # The Parsoid team disagrees with the PHP parser's seemingly-random
3772 # rules regarding dd/dt on the next two tests. Parsoid is more
3773 # consistent, and recognizes the shared nesting and keeps the
3774 # still-open tags around until the nesting is complete.
3775 # (And tidy again converts <dt> to <dd> before 'bar'.)
3776
3777 !! test
3778 Definition Lists: Mixed Lists: Test 11
3779 !! wikitext
3780 *#*#;*;;foo :bar
3781 *#*#;boo :baz
3782 !! html/php
3783 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3784 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3785 <dl><dt>boo&#160;</dt>
3786 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3787
3788 !! html/php+tidy
3789 <ul>
3790 <li>
3791 <ol>
3792 <li>
3793 <ul>
3794 <li>
3795 <ol>
3796 <li>
3797 <dl>
3798 <dt>foo&#160;</dt>
3799 <dd>
3800 <ul>
3801 <li>
3802 <dl>
3803 <dd>
3804 <dl>
3805 <dt>bar</dt>
3806 </dl>
3807 </dd>
3808 </dl>
3809 </li>
3810 </ul>
3811 </dd>
3812 </dl>
3813 <dl>
3814 <dt>boo&#160;</dt>
3815 <dd>baz</dd>
3816 </dl>
3817 </li>
3818 </ol>
3819 </li>
3820 </ul>
3821 </li>
3822 </ol>
3823 </li>
3824 </ul>
3825 !! html/parsoid
3826 <ul>
3827 <li>
3828 <ol>
3829 <li>
3830 <ul>
3831 <li>
3832 <ol>
3833 <li>
3834 <dl>
3835 <dt>
3836 <ul>
3837 <li>
3838 <dl>
3839 <dt>
3840 <dl>
3841 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3842 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3843 </dl></dt>
3844 </dl></li>
3845 </ul></dt>
3846 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3847 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3848 </dl></li>
3849 </ol></li>
3850 </ul></li>
3851 </ol></li>
3852 </ul>
3853 !! end
3854
3855
3856 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3857 !! test
3858 Definition Lists: Weird Ones: Test 1
3859 !! wikitext
3860 *#;*::;; foo : bar (who uses this?)
3861 !! html/php
3862 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3863 <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>
3864
3865 !! html/php+tidy
3866 <ul>
3867 <li>
3868 <ol>
3869 <li>
3870 <dl>
3871 <dt>foo&#160;</dt>
3872 <dd>
3873 <ul>
3874 <li>
3875 <dl>
3876 <dd>
3877 <dl>
3878 <dd>
3879 <dl>
3880 <dd>
3881 <dl>
3882 <dt>bar (who uses this?)</dt>
3883 </dl>
3884 </dd>
3885 </dl>
3886 </dd>
3887 </dl>
3888 </dd>
3889 </dl>
3890 </li>
3891 </ul>
3892 </dd>
3893 </dl>
3894 </li>
3895 </ol>
3896 </li>
3897 </ul>
3898 !! html/parsoid
3899 <ul>
3900 <li>
3901 <ol>
3902 <li>
3903 <dl>
3904 <dt>
3905 <ul>
3906 <li>
3907 <dl>
3908 <dd>
3909 <dl>
3910 <dd>
3911 <dl>
3912 <dt>
3913 <dl>
3914 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3915 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3916 </dl></dt>
3917 </dl></dd>
3918 </dl></dd>
3919 </dl></li>
3920 </ul></dt>
3921 </dl></li>
3922 </ol></li>
3923 </ul>
3924 !! end
3925
3926 !! test
3927 Definition Lists: colons occurring in tags
3928 !! wikitext
3929 ;a:b
3930 ;'''a:b'''
3931 ;<i>a:b</i>
3932 ;<span>a:b</span>
3933 ;<div>a:b</div>
3934 ;{{echo|a:b}}
3935 ;{{echo|''a:b''}}
3936 !! html
3937 <dl><dt>a</dt>
3938 <dd>b</dd>
3939 <dt><b>a:b</b></dt>
3940 <dt><i>a:b</i></dt>
3941 <dt><span>a:b</span></dt>
3942 <dt><div>a:b</div></dt>
3943 <dt>a</dt>
3944 <dd>b</dd>
3945 <dt><i>a:b</i></dt></dl>
3946
3947 !! end
3948
3949 !! test
3950 Definition Lists: colons and tables 1
3951 !! wikitext
3952 :{|
3953 | x
3954 |}
3955 :{|
3956 | y
3957 |}
3958 !! html
3959 <dl><dd><table>
3960 <tr>
3961 <td> x
3962 </td></tr></table></dd></dl>
3963 <dl><dd><table>
3964 <tr>
3965 <td> y
3966 </td></tr></table></dd></dl>
3967
3968 !! end
3969
3970 # Parsoid's output (as documented below) differs from php's in this case.
3971 # This is probably a bug. If we fixup parsoid to match php's output, the
3972 # above test should pass and the below test case can be removed. It is
3973 # unclear which output is more desirable.
3974
3975 !! test
3976 Definition Lists: colons and tables 2
3977 !! wikitext
3978 :{|
3979 | x
3980 |}
3981 :{|
3982 | y
3983 |}
3984 !! html/parsoid
3985 <dl><dd><table>
3986 <tr>
3987 <td> x
3988 </td></tr></table></dd>
3989 <dd><table>
3990 <tr>
3991 <td> y
3992 </td></tr></table></dd></dl>
3993 !! end
3994
3995
3996 ###
3997 ### External links
3998 ###
3999 !! test
4000 External links: non-bracketed
4001 !! wikitext
4002 Non-bracketed: http://example.com
4003 !! html
4004 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4005 </p>
4006 !! end
4007
4008 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4009 !! test
4010 External links: numbered
4011 !! wikitext
4012 Numbered: [http://example.com]
4013 Numbered: [http://example.net]
4014 Numbered: [http://example.com]
4015 !! html/php
4016 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4017 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4018 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4019 </p>
4020 !! html/parsoid
4021 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4022 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4023 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4024 !!end
4025
4026 !! test
4027 External links: specified text
4028 !! wikitext
4029 Specified text: [http://example.com link]
4030 !! html
4031 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4032 </p>
4033 !!end
4034
4035 !! test
4036 External links: trail
4037 !! wikitext
4038 Linktrails should not work for external links: [http://example.com link]s
4039 !! html
4040 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4041 </p>
4042 !! end
4043
4044 !! test
4045 External links: dollar sign in URL
4046 !! wikitext
4047 http://example.com/1$2345
4048 !! html
4049 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4050 </p>
4051 !! end
4052
4053 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4054 !! test
4055 External links: dollar sign in URL (autonumber)
4056 !! wikitext
4057 [http://example.com/1$2345]
4058 !! html/php
4059 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4060 </p>
4061 !! html/parsoid
4062 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4063 !!end
4064
4065 !! test
4066 External links: open square bracket forbidden in URL (bug 4377)
4067 !! options
4068 parsoid=wt2html,wt2wt,html2html
4069 !! wikitext
4070 http://example.com/1[2345
4071 !! html/php
4072 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4073 </p>
4074 !! html/parsoid
4075 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4076 !! end
4077
4078 !! test
4079 External links: open square bracket forbidden in URL (named) (bug 4377)
4080 !! options
4081 parsoid=wt2html,html2html
4082 !! wikitext
4083 [http://example.com/1[2345]
4084 !! html/php
4085 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4086 </p>
4087 !! html/parsoid
4088 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4089 !!end
4090
4091 # parsoid adds a space before the link name
4092 !! test
4093 External links: open square bracket forbidden in URL (named) (bug 4377)
4094 Parsoid variant.
4095 !! wikitext
4096 [http://example.com/1 [2345]
4097 !! html
4098 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4099 </p>
4100 !!end
4101
4102 !! test
4103 External links: nowiki in URL link text (bug 6230)
4104 !! wikitext
4105 [http://example.com/ <nowiki>''example site''</nowiki>]
4106 !! html
4107 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4108 </p>
4109 !! end
4110
4111 !! test
4112 External links: newline forbidden in text (bug 6230 regression check)
4113 !! wikitext
4114 [http://example.com/ first
4115 second]
4116 !! html
4117 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4118 second]
4119 </p>
4120 !!end
4121
4122 !! test
4123 External links: Pipe char between url and text
4124 !! wikitext
4125 [http://example.com | link]
4126 !! html
4127 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4128 </p>
4129 !!end
4130
4131 !! test
4132 External links: protocol-relative URL in brackets
4133 !! wikitext
4134 [//example.com/ Test]
4135 !! html
4136 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4137 </p>
4138 !! end
4139
4140 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4141 !! test
4142 External links: protocol-relative URL in brackets without text
4143 !! wikitext
4144 [//example.com]
4145 !! html/php
4146 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4147 </p>
4148 !! html/parsoid
4149 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4150 !! end
4151
4152 !! test
4153 External links: protocol-relative URL in free text is left alone
4154 !! wikitext
4155 //example.com/Foo
4156 !! html
4157 <p>//example.com/Foo
4158 </p>
4159 !!end
4160
4161 !! test
4162 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4163 !! wikitext
4164 foo//example.com/Foo
4165 !! html
4166 <p>foo//example.com/Foo
4167 </p>
4168 !! end
4169
4170 !! test
4171 External links: with no contents
4172 !! wikitext
4173 [http://en.wikipedia.org/wiki/Foo]
4174
4175 [[wikipedia:Foo|Bar]]
4176
4177 [[wikipedia:Foo|<span>Bar</span>]]
4178 !! html/php
4179 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4180 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4181 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4182 </p>
4183 !! html/parsoid
4184 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4185 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4186 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4187 !! end
4188
4189 !! test
4190 External links: Free with trailing punctuation
4191 !! wikitext
4192 http://example.com,
4193 http://example.com;
4194 http://example.com\
4195 http://example.com.
4196 http://example.com:
4197 http://example.com!
4198 http://example.com?
4199 http://example.com)
4200 http://example.com/url_with_(brackets)
4201 (http://example.com/url_without_brackets)
4202 http://example.com/url_with_entity&nbsp;
4203 http://example.com/url_with_entity&#xA0;
4204 http://example.com/url_with_entity&#160;
4205 http://example.com/url_with_entity&lt;
4206 http://example.com/url_with_entity&#x3C;
4207 http://example.com/url_with_entity&#60;
4208 !! html/php
4209 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4210 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4211 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4212 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4213 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4214 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4215 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4216 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4217 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4218 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4219 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4220 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4221 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4222 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4223 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4224 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4225 </p>
4226 !! html/parsoid
4227 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4228 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4229 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4230 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4231 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4232 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4233 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4234 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4235 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4236 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4237 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4238 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4239 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4240 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4241 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4242 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4243 !! end
4244
4245 !! test
4246 External links: No preceding word characters allowed (bug 65278)
4247 !! wikitext
4248 NOPEhttp://example.com
4249 N0http://example.com
4250 ok:http://example.com
4251 ok-http://example.com
4252 !! html
4253 <p>NOPEhttp://example.com
4254 N0http://example.com
4255 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4256 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4257 </p>
4258 !! end
4259
4260 !! test
4261 External image
4262 !! wikitext
4263 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4264 !! html
4265 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4266 </p>
4267 !! end
4268
4269 !! test
4270 External image from https
4271 !! wikitext
4272 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4273 !! html
4274 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4275 </p>
4276 !! end
4277
4278 !! test
4279 External image (when not allowed)
4280 !! options
4281 wgAllowExternalImages=0
4282 !! wikitext
4283 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4284 !! html
4285 <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>
4286 </p>
4287 !! end
4288
4289 !! test
4290 Link to non-http image, no img tag
4291 !! wikitext
4292 Link to non-http image, no img tag: ftp://example.com/test.jpg
4293 !! html
4294 <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>
4295 </p>
4296 !! end
4297
4298 !! test
4299 External links: terminating separator
4300 !! wikitext
4301 Terminating separator: http://example.com/thing,
4302 !! html
4303 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4304 </p>
4305 !! end
4306
4307 !! test
4308 External links: intervening separator
4309 !! wikitext
4310 Intervening separator: http://example.com/1,2,3
4311 !! html
4312 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4313 </p>
4314 !! end
4315
4316 !! test
4317 External links: old bug with URL in query
4318 !! wikitext
4319 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4320 !! html
4321 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4322 </p>
4323 !! end
4324
4325 !! test
4326 External links: old URL-in-URL bug, mixed protocols
4327 !! wikitext
4328 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4329 !! html
4330 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4331 </p>
4332 !!end
4333
4334 !! test
4335 External links: URL in text
4336 !! wikitext
4337 URL in text: [http://example.com http://example.com]
4338 !! html
4339 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4340 </p>
4341 !! end
4342
4343 !! test
4344 External links: Clickable images
4345 !! wikitext
4346 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4347 !! html/php
4348 <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>
4349 </p>
4350 !! html/parsoid
4351 <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>
4352 !! end
4353
4354 !! test
4355 External links: raw ampersand
4356 !! wikitext
4357 Old &amp; use: http://x&y
4358 !! html
4359 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4360 </p>
4361 !! end
4362
4363 !! test
4364 External links: encoded ampersand
4365 !! wikitext
4366 Old &amp; use: http://x&amp;y
4367 !! html/php
4368 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4369 </p>
4370 !! html/parsoid
4371 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4372 !! end
4373
4374 !! test
4375 External links: encoded equals (bug 6102)
4376 !! wikitext
4377 http://example.com/?foo&#61;bar
4378 !! html/php
4379 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4380 </p>
4381 !! html/parsoid
4382 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4383 !! end
4384
4385 ##
4386 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4387 ## does it number them. As discussed in bug 53505, we can identify
4388 ## autonumbered links via CSS.
4389 ##
4390
4391 !! test
4392 External links: [raw ampersand]
4393 !! wikitext
4394 Old &amp; use: [http://x&y]
4395 !! html/php
4396 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4397 </p>
4398 !! html/parsoid
4399 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4400 !! end
4401
4402 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4403 # mode will return the [raw ampersand] wikitext
4404 !! test
4405 External links: [encoded ampersand]
4406 !! options
4407 parsoid=wt2html,wt2wt,html2html
4408 !! wikitext
4409 Old &amp; use: [http://x&amp;y]
4410 !! html/php
4411 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4412 </p>
4413 !! html/parsoid
4414 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4415 !! end
4416
4417 !! test
4418 External links: [raw equals]
4419 !! wikitext
4420 [http://example.com/?foo=bar]
4421 !! html/php
4422 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4423 </p>
4424 !! html/parsoid
4425 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4426 !! end
4427
4428 # note that parsoid html is identical to [raw equals] case; so html2wt
4429 # mode will return the [raw equals] wikitext
4430 !! test
4431 External links: [encoded equals] (bug 6102)
4432 !! options
4433 parsoid=wt2html,wt2wt,html2html
4434 !! wikitext
4435 [http://example.com/?foo&#61;bar]
4436 !! html/php
4437 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4438 </p>
4439 !! html/parsoid
4440 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4441 !! end
4442
4443 # xxx parsoid strips the IDN character, so the round-trip tests will
4444 # obviously fail and are disabled. --cscott
4445 !! test
4446 External links: [IDN ignored character reference in hostname; strip it right off]
4447 !! options
4448 parsoid=wt2html,wt2wt,html2html
4449 !! wikitext
4450 [http://e&zwnj;xample.com/]
4451 !! html/php
4452 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4453 </p>
4454 !! html/parsoid
4455 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4456 !! end
4457
4458 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4459 # Where an external link could easily circumvent the sanitization of the text of
4460 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4461 # test demands a higher standard. That's a bit strange.
4462 #
4463 # Example:
4464 #
4465 # http://e‌xample.com -> [http://example.com|http://example.com]
4466 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4467 #
4468 # The first example is sanitized, but the second is not. Any security benefits
4469 # from this production are trivial to circumvent. Either remove this test and
4470 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4471 # the test accordingly.
4472 #
4473 # All our love,
4474 # The Parsoid team.
4475 # xxx parsoid strips the IDN character, so the round-trip tests will
4476 # obviously fail and are disabled. --cscott
4477 !! test
4478 External links: IDN ignored character reference in hostname; strip it right off
4479 !! options
4480 parsoid=wt2html,html2html
4481 !! wikitext
4482 http://e&zwnj;xample.com/
4483 !! html/php
4484 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4485 </p>
4486 !! html/parsoid
4487 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4488 !! end
4489
4490 !! test
4491 External links: www.jpeg.org (bug 554)
4492 !! wikitext
4493 http://www.jpeg.org
4494 !! html
4495 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4496 </p>
4497 !! end
4498
4499 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4500 !! test
4501 External links: URL within URL (original bug 2)
4502 !! wikitext
4503 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4504 !! html/php
4505 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4506 </p>
4507 !! html/parsoid
4508 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4509 !! end
4510
4511 !! test
4512 BUG 361: URL inside bracketed URL
4513 !! wikitext
4514 [http://www.example.com/foo http://www.example.com/bar]
4515 !! html
4516 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4517 </p>
4518 !! end
4519
4520 !! test
4521 BUG 361: URL within URL, not bracketed
4522 !! wikitext
4523 http://www.example.com/foo?=http://www.example.com/bar
4524 !! html
4525 <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>
4526 </p>
4527 !! end
4528
4529 !! test
4530 BUG 289: ">"-token in URL-tail
4531 !! wikitext
4532 http://www.example.com/<hello>
4533 !! html
4534 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4535 </p>
4536 !!end
4537
4538 !! test
4539 BUG 289: literal ">"-token in URL-tail
4540 !! wikitext
4541 http://www.example.com/<b>html</b>
4542 !! html/php
4543 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4544 </p>
4545 !! html/parsoid
4546 <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>
4547 !! end
4548
4549 !! test
4550 BUG 289: ">"-token in bracketed URL
4551 !! wikitext
4552 [http://www.example.com/<hello> stuff]
4553 !! html
4554 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4555 </p>
4556 !!end
4557
4558 !! test
4559 BUG 289: literal ">"-token in bracketed URL
4560 !! wikitext
4561 [http://www.example.com/<b>html</b> stuff]
4562 !! html
4563 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4564 </p>
4565 !!end
4566
4567 !! test
4568 BUG 289: literal double quote at end of URL
4569 !! wikitext
4570 http://www.example.com/"hello"
4571 !! html
4572 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4573 </p>
4574 !!end
4575
4576 !! test
4577 BUG 289: literal double quote in bracketed URL
4578 !! wikitext
4579 [http://www.example.com/"hello" stuff]
4580 !! html
4581 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4582 </p>
4583 !!end
4584
4585 !! test
4586 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4587 !! wikitext
4588 [http://www.example.com test]
4589 !! html
4590 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4591 </p>
4592 !! end
4593
4594 !! test
4595 External links: link text with spaces
4596 !! wikitext
4597 [http://www.example.com a b c]
4598 [http://www.example.com ''a'' ''b'']
4599 !! html
4600 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4601 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4602 </p>
4603 !! end
4604
4605 !! test
4606 External links: wiki links within external link (Bug 3695)
4607 !! wikitext
4608 [http://example.com [[wikilink]] embedded in ext link]
4609 !! html/php
4610 <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>
4611 </p>
4612 !! html/parsoid
4613 <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>
4614 !! end
4615
4616 !! test
4617 BUG 787: Links with one slash after the url protocol are invalid
4618 !! wikitext
4619 http:/example.com
4620
4621 [http:/example.com title]
4622 !! html
4623 <p>http:/example.com
4624 </p><p>[http:/example.com title]
4625 </p>
4626 !! end
4627
4628 !! test
4629 Bracketed external links with template-generated invalid target
4630 !! wikitext
4631 [{{echo|http:/example.com}} title]
4632 !! html
4633 <p>[http:/example.com title]
4634 </p>
4635 !! end
4636
4637 !! test
4638 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4639 !! wikitext
4640 ''[http://example.com text'']
4641 [http://example.com '''text]'''
4642 ''Something [http://example.com in italic'']
4643 ''Something [http://example.com mixed''''', even bold]'''
4644 '''''Now [http://example.com both''''']
4645 !! html
4646 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4647 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4648 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4649 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4650 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4651 </p>
4652 !! end
4653
4654
4655 !! test
4656 Bug 4781: %26 in URL
4657 !! wikitext
4658 http://www.example.com/?title=AT%26T
4659 !! html/php
4660 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4661 </p>
4662 !! html/parsoid
4663 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4664 !! end
4665
4666 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4667 # % is actually legal in HTML5. Any change in output would need testing though.
4668 !! test
4669 Bug 4781, 5267: %25 in URL
4670 !! wikitext
4671 http://www.example.com/?title=100%25_Bran
4672 !! html/php
4673 <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>
4674 </p>
4675 !! html/parsoid
4676 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4677 !! end
4678
4679 !! test
4680 Bug 4781, 5267: %28, %29 in URL
4681 !! wikitext
4682 http://www.example.com/?title=Ben-Hur_%281959_film%29
4683 !! html/php
4684 <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>
4685 </p>
4686 !! html/parsoid
4687 <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>
4688 !! end
4689
4690
4691 !! test
4692 Bug 4781: %26 in autonumber URL
4693 !! wikitext
4694 [http://www.example.com/?title=AT%26T]
4695 !! html/php
4696 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4697 </p>
4698 !! html/parsoid
4699 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4700 !! end
4701
4702 !! test
4703 Bug 4781, 5267: %26 in autonumber URL
4704 !! wikitext
4705 [http://www.example.com/?title=100%25_Bran]
4706 !! html/php
4707 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4708 </p>
4709 !! html/parsoid
4710 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4711 !! end
4712
4713 !! test
4714 Bug 4781, 5267: %28, %29 in autonumber URL
4715 !! wikitext
4716 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4717 !! html/php
4718 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4719 </p>
4720 !! html/parsoid
4721 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4722 !! end
4723
4724
4725 !! test
4726 Bug 4781: %26 in bracketed URL
4727 !! wikitext
4728 [http://www.example.com/?title=AT%26T link]
4729 !! html/php
4730 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4731 </p>
4732 !! html/parsoid
4733 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4734 !! end
4735
4736 !! test
4737 Bug 4781, 5267: %25 in bracketed URL
4738 !! wikitext
4739 [http://www.example.com/?title=100%25_Bran link]
4740 !! html
4741 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4742 </p>
4743 !! end
4744
4745 !! test
4746 Bug 4781, 5267: %28, %29 in bracketed URL
4747 !! wikitext
4748 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4749 !! html/php
4750 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4751 </p>
4752 !! html/parsoid
4753 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4754 !! end
4755
4756 !! test
4757 External link containing a period in the anchor. (bug 63947)
4758 !! wikitext
4759 [//foo.org/bar#baz. bang]
4760
4761 [//foo.org/bar. bang]
4762 !! html/php
4763 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4764 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4765 </p>
4766 !! html/parsoid
4767 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4768 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4769 !! end
4770
4771 !! test
4772 External link containing a single quote. (bug 63947)
4773 !! wikitext
4774 [//foo.org/bar'baz]
4775
4776 [//foo.org/bar'baz bang]
4777 !! html/php
4778 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4779 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4780 </p>
4781 !! html/parsoid
4782 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4783 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4784 !! end
4785
4786
4787 !! test
4788 External link containing a period in the anchor. (bug 63947)
4789 !! wikitext
4790 [//foo.org/bar#baz. bang]
4791
4792 [//foo.org/bar. bang]
4793 !! html/php
4794 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4795 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4796 </p>
4797 !! html/parsoid
4798 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4799 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4800 !! end
4801
4802 !! test
4803 External link containing a single quote. (bug 63947)
4804 !! wikitext
4805 [//foo.org/bar'baz]
4806
4807 [//foo.org/bar'baz bang]
4808 !! html/php
4809 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4810 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4811 </p>
4812 !! html/parsoid
4813 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4814 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4815 !! end
4816
4817
4818 !! test
4819 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4820 !! wikitext
4821 Some [http://example.com/ pretty ''italics'' and stuff]!
4822 !! html
4823 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4824 </p>
4825 !! end
4826
4827 !! test
4828 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4829 !! wikitext
4830 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4831 !! html
4832 <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>
4833 </p>
4834 !! end
4835
4836 !! test
4837 External link containing double-single-quotes with no space separating the url from text in italics
4838 !! wikitext
4839 [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]].]
4840 !! html/php
4841 <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>
4842 </p>
4843 !! html/php+tidy
4844 <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>
4845 !! html/parsoid
4846 <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>
4847 !! end
4848
4849 !! test
4850 External link with comments in link text
4851 !! wikitext
4852 [http://www.google.com Google <!-- comment -->]
4853 !! html
4854 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4855 </p>
4856 !! end
4857
4858 !! test
4859 URL-encoding in URL functions (single parameter)
4860 !! wikitext
4861 {{localurl:Some page|amp=&}}
4862 !! html
4863 <p>/index.php?title=Some_page&amp;amp=&amp;
4864 </p>
4865 !! end
4866
4867 !! test
4868 URL-encoding in URL functions (multiple parameters)
4869 !! wikitext
4870 {{localurl:Some page|q=?&amp=&}}
4871 !! html
4872 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4873 </p>
4874 !! end
4875
4876 !! test
4877 Brackets in urls
4878 !! wikitext
4879 http://example.com/index.php?foozoid%5B%5D=bar
4880
4881 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4882 !! html/php
4883 <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>
4884 </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>
4885 </p>
4886 !! html/parsoid
4887 <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>
4888
4889 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4890 !! end
4891
4892 !! test
4893 IPv6 urls (bug 21261)
4894 !! options
4895 disabled
4896 !! wikitext
4897 http://[2404:130:0:1000::187:2]/index.php
4898 !! html
4899 <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>
4900 </p>
4901 !! end
4902
4903 !! test
4904 Non-extlinks in brackets
4905 !! wikitext
4906 [foo]
4907 [foo bar]
4908 [foo ''bar'']
4909 [fool's] errand
4910 [fool's errand]
4911 [{{echo|foo}}]
4912 [{{echo|foo}} bar]
4913 [{{echo|foo}} ''bar'']
4914 [{{echo|foo}}l's] errand
4915 [{{echo|foo}}l's errand]
4916 [url={{echo|foo}}]
4917 [url=http://example.com]
4918 !! html
4919 <p>[foo]
4920 [foo bar]
4921 [foo <i>bar</i>]
4922 [fool's] errand
4923 [fool's errand]
4924 [foo]
4925 [foo bar]
4926 [foo <i>bar</i>]
4927 [fool's] errand
4928 [fool's errand]
4929 [url=foo]
4930 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4931 </p>
4932 !! end
4933
4934 !! test
4935 Percent encoding in external links
4936 !! wikitext
4937 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4938 !! html/php
4939 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4940 </p>
4941 !! html/parsoid
4942 <p><a rel="mw:ExtLink"
4943 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4944 !! end
4945
4946 !! test
4947 Use url link syntax for links where the content is equal the link target
4948 !! wikitext
4949 http://example.com
4950 !! html/php
4951 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4952 </p>
4953 !! html/parsoid
4954 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4955 !! end
4956
4957 !! test
4958 Parenthesis in external links, especially URL links
4959 !! wikitext
4960 http://example.com)
4961
4962 http://example.com/test)
4963
4964 http://example.com/(test)
4965
4966 http://example.com/((test)
4967
4968 (http://example.com/(test))
4969
4970 (http://example.com/(test)))))
4971
4972 http://example.com/a)b
4973
4974 [http://example.com) foo]
4975 !! html/php
4976 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4977 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4978 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4979 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4980 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4981 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4982 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4983 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4984 </p>
4985 !! html/parsoid
4986 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4987 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4988 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4989 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4990 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4991 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4992 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4993 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4994 !! end
4995
4996 !! test
4997 Parenthesis in external links, w/ transclusion or comment
4998 !! wikitext
4999 (http://example.com/{{echo|hi}})
5000
5001 (http://example.com<!-- hi -->)
5002 !! html/php
5003 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5004 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5005 </p>
5006 !! html/parsoid
5007 <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>
5008
5009 <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>
5010 !! end
5011
5012 !! test
5013 Replace invalid link targets when serializing
5014 !! options
5015 parsoid=html2wt
5016 !! html
5017 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
5018 !! wikitext
5019 [[MediaWiki:Badtitletext|Manual]]
5020 !! end
5021
5022 ###
5023 ### Quotes
5024 ###
5025
5026 !! test
5027 Quotes
5028 !! wikitext
5029 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5030
5031 Normal text. '''''Bold italic text.''''' Normal text.
5032 !! html
5033 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5034 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5035 </p>
5036 !! end
5037
5038
5039 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5040 # parser strips. The wikitext contains just the first half of the bold
5041 # quote pair.
5042 !! test
5043 Unclosed and unmatched quotes
5044 !! wikitext
5045 '''''Bold italic text '''with bold deactivated''' in between.'''''
5046
5047 '''''Bold italic text ''with italic deactivated'' in between.'''''
5048
5049 '''Bold text..
5050
5051 ..spanning two paragraphs (should not work).'''
5052
5053 '''Bold tag left open
5054
5055 ''Italic tag left open
5056
5057 Normal text.
5058
5059 <!-- Unmatching number of opening, closing tags: -->
5060 '''This year''''s election ''should'' beat '''last year''''s.
5061
5062 ''Tom'''s car is bigger than ''Susan'''s.
5063
5064 Plain ''italic'''s plain
5065 !! html/php
5066 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5067 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5068 </p><p><b>Bold text..</b>
5069 </p><p>..spanning two paragraphs (should not work).
5070 </p><p><b>Bold tag left open</b>
5071 </p><p><i>Italic tag left open</i>
5072 </p><p>Normal text.
5073 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5074 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5075 </p><p>Plain <i>italic'</i>s plain
5076 </p>
5077 !! html/parsoid
5078 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5079 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5080 </p><p><b>Bold text..</b>
5081 </p><p>..spanning two paragraphs (should not work).<b></b>
5082 </p><p><b>Bold tag left open</b>
5083 </p><p><i>Italic tag left open</i>
5084 </p><p>Normal text.
5085 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5086 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5087 </p><p>Plain <i>italic'</i>s plain
5088 </p>
5089 !! end
5090
5091 ###
5092 ### Tables
5093 ###
5094 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5095 ###
5096
5097 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5098 # is the bare minimum required by the spec, see:
5099 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5100 # Parsoid team replies: empty table tags are legal in HTML5
5101 !! test
5102 A table with no data.
5103 !! options
5104 parsoid=wt2html
5105 !! wikitext
5106 {||}
5107 !! html/php
5108
5109 !! html/parsoid
5110 <table></table>
5111
5112 !! end
5113
5114 !! test
5115 A table with stray table end tags on start tag line (wt2html)
5116 !! options
5117 parsoid=wt2html
5118 !! wikitext
5119 {|style="color: red;"|}
5120
5121 {|style="color: red;" |}
5122 |foo
5123 |}
5124
5125 {|style="color: red;"|} id="foo"
5126 |foo
5127 |}
5128
5129 {|style="color: red;" |} id="foo"
5130 |foo
5131 |}
5132 !! html
5133 <table style="color: red;"></table>
5134
5135 <table style="color: red;">
5136 <tbody><tr>
5137 <td>foo</td>
5138 </tr></tbody>
5139 </table>
5140
5141 <table style="color: red;" id="foo">
5142 <tbody><tr>
5143 <td>foo</td>
5144 </tr></tbody>
5145 </table>
5146
5147 <table style="color: red;" id="foo">
5148 <tbody><tr>
5149 <td>foo</td>
5150 </tr></tbody>
5151 </table>
5152
5153 !! end
5154
5155 !! test
5156 A table with no data (take 2)
5157 !! wikitext
5158 {|
5159 |}
5160 !! html/parsoid
5161 <table></table>
5162 !! end
5163
5164 # A table with nothing but a caption is invalid XHTML, we might want to render
5165 # this as <p>caption</p>
5166 # Parsoid team replies: table with only a caption is legal in HTML5
5167 !! test
5168 A table with nothing but a caption
5169 !! wikitext
5170 {|
5171 |+ caption
5172 |}
5173 !! html/php
5174 <table>
5175 <caption> caption
5176 </caption><tr><td></td></tr></table>
5177
5178 !! html/parsoid
5179 <table><caption> caption</caption></table>
5180 !! end
5181
5182 !! test
5183 A table with caption with default-spaced attributes and a table row
5184 !! wikitext
5185 {|
5186 |+ style="color: red;" | caption1
5187 |-
5188 | foo
5189 |}
5190 !! html
5191 <table>
5192 <caption style="color: red;"> caption1
5193 </caption>
5194 <tr>
5195 <td> foo
5196 </td></tr></table>
5197
5198 !! end
5199
5200 !! test
5201 A table with captions with non-default spaced attributes and a table row
5202 !! wikitext
5203 {|
5204 |+style="color: red;"|caption2
5205 |+ style="color: red;"| caption3
5206 |-
5207 | foo
5208 |}
5209 !! html
5210 <table>
5211 <caption style="color: red;">caption2
5212 </caption>
5213 <caption style="color: red;"> caption3
5214 </caption>
5215 <tr>
5216 <td> foo
5217 </td></tr></table>
5218
5219 !! end
5220
5221 !! test
5222 Table td-cell syntax variations
5223 !! wikitext
5224 {|
5225 | foo bar foo | baz
5226 | foo bar foo || baz
5227 | style='color:red;' | baz
5228 | style='color:red;' || baz
5229 |}
5230 !! html
5231 <table>
5232 <tr>
5233 <td> baz
5234 </td>
5235 <td> foo bar foo </td>
5236 <td> baz
5237 </td>
5238 <td style="color:red;"> baz
5239 </td>
5240 <td> style='color:red;' </td>
5241 <td> baz
5242 </td></tr></table>
5243
5244 !! end
5245
5246 !! test
5247 Simple table
5248 !! wikitext
5249 {|
5250 | 1 || 2
5251 |-
5252 | 3 || 4
5253 |}
5254 !! html
5255 <table>
5256 <tr>
5257 <td> 1 </td>
5258 <td> 2
5259 </td></tr>
5260 <tr>
5261 <td> 3 </td>
5262 <td> 4
5263 </td></tr></table>
5264
5265 !! end
5266
5267 !! test
5268 Simple table but with multiple dashes for row wikitext
5269 !! wikitext
5270 {|
5271 | foo
5272 |-----
5273 | bar
5274 |}
5275 !! html
5276 <table>
5277 <tr>
5278 <td> foo
5279 </td></tr>
5280 <tr>
5281 <td> bar
5282 </td></tr></table>
5283
5284 !! end
5285 !! test
5286 Multiplication table
5287 !! wikitext
5288 {| border="1" cellpadding="2"
5289 |+Multiplication table
5290 |-
5291 ! &times; !! 1 !! 2 !! 3
5292 |-
5293 ! 1
5294 | 1 || 2 || 3
5295 |-
5296 ! 2
5297 | 2 || 4 || 6
5298 |-
5299 ! 3
5300 | 3 || 6 || 9
5301 |-
5302 ! 4
5303 | 4 || 8 || 12
5304 |-
5305 ! 5
5306 | 5 || 10 || 15
5307 |}
5308 !! html
5309 <table border="1" cellpadding="2">
5310 <caption>Multiplication table
5311 </caption>
5312 <tr>
5313 <th> &#215; </th>
5314 <th> 1 </th>
5315 <th> 2 </th>
5316 <th> 3
5317 </th></tr>
5318 <tr>
5319 <th> 1
5320 </th>
5321 <td> 1 </td>
5322 <td> 2 </td>
5323 <td> 3
5324 </td></tr>
5325 <tr>
5326 <th> 2
5327 </th>
5328 <td> 2 </td>
5329 <td> 4 </td>
5330 <td> 6
5331 </td></tr>
5332 <tr>
5333 <th> 3
5334 </th>
5335 <td> 3 </td>
5336 <td> 6 </td>
5337 <td> 9
5338 </td></tr>
5339 <tr>
5340 <th> 4
5341 </th>
5342 <td> 4 </td>
5343 <td> 8 </td>
5344 <td> 12
5345 </td></tr>
5346 <tr>
5347 <th> 5
5348 </th>
5349 <td> 5 </td>
5350 <td> 10 </td>
5351 <td> 15
5352 </td></tr></table>
5353
5354 !! end
5355
5356 !! test
5357 Accept "||" in table headings
5358 !! wikitext
5359 {|
5360 !h1 || h2
5361 |}
5362 !! html
5363 <table>
5364 <tr>
5365 <th>h1 </th>
5366 <th> h2
5367 </th></tr></table>
5368
5369 !! end
5370
5371 !! test
5372 Accept "!!" in table data
5373 !! wikitext
5374 {|
5375 | Foo!! ||
5376 |}
5377 !! html
5378 <table>
5379 <tr>
5380 <td> Foo!! </td>
5381 <td>
5382 </td></tr></table>
5383
5384 !! html/parsoid
5385 <table>
5386 <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>
5387 </tbody></table>
5388 !! end
5389
5390 !! test
5391 Accept "||" in indented table headings
5392 !! wikitext
5393 :{|
5394 !h1 || h2
5395 |}
5396 !! html
5397 <dl><dd><table>
5398 <tr>
5399 <th>h1 </th>
5400 <th> h2
5401 </th></tr></table></dd></dl>
5402
5403 !! end
5404
5405 !! test
5406 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5407 !! wikitext
5408 {|
5409 !| h1
5410 || a
5411 |}
5412 !! html
5413 <table>
5414 <tr>
5415 <th> h1
5416 </th>
5417 <td> a
5418 </td></tr></table>
5419
5420 !! end
5421
5422 !!test
5423 Accept "| !" at start of line in tables (ignore !-attribute)
5424 !! wikitext
5425 {|
5426 |-
5427 | !style="color:red" | bar
5428 |}
5429 !! html
5430 <table>
5431
5432 <tr>
5433 <td> bar
5434 </td></tr></table>
5435
5436 !!end
5437
5438 !!test
5439 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 +/-
5440 !! wikitext
5441 {|
5442 |-
5443 |style='color:red;'|+1
5444 |style='color:blue;'|-1
5445 |-
5446 | 1 || 2 || 3
5447 | 1 ||+2 ||-3
5448 |-
5449 | +1
5450 | -1
5451 |}
5452 !! html
5453 <table>
5454
5455 <tr>
5456 <td style="color:red;">+1
5457 </td>
5458 <td style="color:blue;">-1
5459 </td></tr>
5460 <tr>
5461 <td> 1 </td>
5462 <td> 2 </td>
5463 <td> 3
5464 </td>
5465 <td> 1 </td>
5466 <td>+2 </td>
5467 <td>-3
5468 </td></tr>
5469 <tr>
5470 <td> +1
5471 </td>
5472 <td> -1
5473 </td></tr></table>
5474
5475 !!end
5476
5477 !! test
5478 Table rowspan
5479 !! wikitext
5480 {| border=1
5481 | Cell 1, row 1
5482 |rowspan=2| Cell 2, row 1 (and 2)
5483 | Cell 3, row 1
5484 |-
5485 | Cell 1, row 2
5486 | Cell 3, row 2
5487 |}
5488 !! html
5489 <table border="1">
5490 <tr>
5491 <td> Cell 1, row 1
5492 </td>
5493 <td rowspan="2"> Cell 2, row 1 (and 2)
5494 </td>
5495 <td> Cell 3, row 1
5496 </td></tr>
5497 <tr>
5498 <td> Cell 1, row 2
5499 </td>
5500 <td> Cell 3, row 2
5501 </td></tr></table>
5502
5503 !! end
5504
5505 !! test
5506 Nested table
5507 !! wikitext
5508 {| border=1
5509 | &alpha;
5510 |
5511 {| bgcolor=#ABCDEF border=2
5512 |nested
5513 |-
5514 |table
5515 |}
5516 |the original table again
5517 |}
5518 !! html
5519 <table border="1">
5520 <tr>
5521 <td> &#945;
5522 </td>
5523 <td>
5524 <table bgcolor="#ABCDEF" border="2">
5525 <tr>
5526 <td>nested
5527 </td></tr>
5528 <tr>
5529 <td>table
5530 </td></tr></table>
5531 </td>
5532 <td>the original table again
5533 </td></tr></table>
5534
5535 !! end
5536
5537 !! test
5538 Invalid attributes in table cell (bug 1830)
5539 !! wikitext
5540 {|
5541 |Cell:|broken
5542 |}
5543 !! html
5544 <table>
5545 <tr>
5546 <td>broken
5547 </td></tr></table>
5548
5549 !! end
5550
5551
5552 # The "|}" to close the table is missing from the input, so parsoid's
5553 # *2wt modes will fail.
5554 !! test
5555 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5556 !! options
5557 parsoid=wt2html,html2html
5558 !! wikitext
5559 {|
5560 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5561 !! html/php
5562 <table>
5563 <tr>
5564 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5565 <td>]" onmouseover="alert(document.cookie)"&gt;test
5566 </td>
5567 </tr>
5568 </table>
5569
5570 !! html/parsoid
5571 <table><tbody>
5572 <tr>
5573 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5574 !! end
5575
5576
5577 !! test
5578 Indented table markup mixed with indented pre content (proposed in bug 6200)
5579 !! wikitext
5580 <table>
5581 <tr>
5582 <td>
5583 Text that should be rendered preformatted
5584 </td>
5585 </tr>
5586 </table>
5587 !! html
5588 <table>
5589 <tr>
5590 <td>
5591 <pre>Text that should be rendered preformatted
5592 </pre>
5593 </td>
5594 </tr>
5595 </table>
5596
5597 !! end
5598
5599 !! test
5600 Template-generated table cell attributes and cell content
5601 !! wikitext
5602 {|
5603 |{{table_attribs}}
5604 | {{table_attribs}}
5605 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5606 |align=center {{table_attribs}}
5607 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5608 |}
5609 !! html
5610 <table>
5611 <tr>
5612 <td style="color: red"> Foo
5613 </td>
5614 <td style="color: red"> Foo
5615 </td>
5616 <td style="color: red"> Foo
5617 </td>
5618 <td align="center" style="color: red"> Foo
5619 </td>
5620 <td align="center" style="color: red"> Foo
5621 </td></tr></table>
5622
5623 !! end
5624
5625 !! test
5626 Template-generated table cell attributes and cell content (2)
5627 !! wikitext
5628 {|
5629 |align=center {{table_cells}}
5630 |}
5631 !! html
5632 <table>
5633 <tr>
5634 <td align="center" style="color: red"> Foo </td>
5635 <td> Bar </td>
5636 <td> Baz
5637 </td></tr></table>
5638
5639 !! end
5640
5641 !! test
5642 Table with row followed by newlines and table heading
5643 !! wikitext
5644 {|
5645 |-
5646
5647 ! foo
5648 |}
5649 !! html
5650 <table>
5651
5652
5653 <tr>
5654 <th> foo
5655 </th></tr></table>
5656
5657 !! end
5658
5659 !! test
5660 Table with empty line following the start tag
5661 !! wikitext
5662 {|
5663
5664 |-
5665 | foo
5666 |}
5667 !! html
5668 <table>
5669
5670
5671 <tr>
5672 <td> foo
5673 </td></tr></table>
5674
5675 !! end
5676
5677 # FIXME: Preserve the attribute properly (with an empty string as value) in
5678 # the PHP parser. Parsoid implements the behavior below.
5679 !! test
5680 Table attributes with empty value
5681 !! wikitext
5682 {|
5683 | style=| hello
5684 |}
5685 !! html/parsoid
5686 <table>
5687 <tbody>
5688 <tr>
5689 <td style=""> hello
5690 </td></tr></tbody></table>
5691
5692 !! end
5693
5694 !! test
5695 Wikitext table with a lot of comments
5696 !! wikitext
5697 {|
5698 <!-- c0 -->
5699 | foo
5700 <!-- c1 -->
5701 |- <!-- c2 -->
5702 <!-- c3 -->
5703 |<!-- c4 -->
5704 <!-- c5 -->
5705 |}
5706 !! html
5707 <table>
5708 <tr>
5709 <td> foo
5710 </td></tr>
5711 <tr>
5712 <td>
5713 </td></tr></table>
5714
5715 !! end
5716
5717 !! test
5718 Wikitext table with double-line table cell
5719 !! wikitext
5720 {|
5721 |a
5722 b
5723 |}
5724 !! html
5725 <table>
5726 <tr>
5727 <td>a
5728 <p>b
5729 </p>
5730 </td></tr></table>
5731
5732 !! end
5733
5734 !! test
5735 Table cell with a single comment
5736 !! wikitext
5737 {|
5738 | <!-- c1 -->
5739 | a
5740 |}
5741 !! html
5742 <table>
5743 <tr>
5744 <td>
5745 </td>
5746 <td> a
5747 </td></tr></table>
5748
5749 !! end
5750
5751 !! test
5752 Table-cell after a comment-only-empty-line
5753 !! wikitext
5754 {|
5755 |a
5756 <!--c1-->
5757 <!--c2-->| b
5758 |}
5759 !! html
5760 <table>
5761 <tr>
5762 <td>a
5763 </td>
5764 <td> b
5765 </td></tr></table>
5766
5767 !! html/parsoid
5768 <table>
5769 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5770 <!--c1-->
5771 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5772 </tbody></table>
5773
5774 !! end
5775
5776 !! test
5777 Build table with {{!}}
5778 !! wikitext
5779 {{{!}} class="wikitable"
5780 ! header
5781 ! second header
5782 {{!}}- style="color:red;"
5783 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5784 {{!}}}
5785 !! html
5786 <table class="wikitable">
5787 <tr>
5788 <th> header
5789 </th>
5790 <th> second header
5791 </th></tr>
5792 <tr style="color:red;">
5793 <td> data </td>
5794 <td style="color:red;"> second data
5795 </td></tr></table>
5796
5797 !! end
5798
5799 !! test
5800 Build table with pipe as data
5801 !! wikitext
5802 {| class="wikitable"
5803 ! header
5804 ! second header
5805 |- style="color:red;"
5806 | data || style="color:red;" | second data
5807 |-
5808 | style="color:red;" | data with | || style="color:red;" | second data with |
5809 |-
5810 || data with | ||| second data with |
5811 |}
5812 !! html
5813 <table class="wikitable">
5814 <tr>
5815 <th> header
5816 </th>
5817 <th> second header
5818 </th></tr>
5819 <tr style="color:red;">
5820 <td> data </td>
5821 <td style="color:red;"> second data
5822 </td></tr>
5823 <tr>
5824 <td style="color:red;"> data with | </td>
5825 <td style="color:red;"> second data with |
5826 </td></tr>
5827 <tr>
5828 <td> data with | </td>
5829 <td> second data with |
5830 </td></tr></table>
5831
5832 !! end
5833
5834 !! test
5835 Build table with wikilink
5836 !! wikitext
5837 {| class="wikitable"
5838 ! header || second header
5839 |- style="color:red;"
5840 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5841 |-
5842 | data || second data [[Main Page|link|text with pipe]]
5843 |}
5844 !! html
5845 <table class="wikitable">
5846 <tr>
5847 <th> header </th>
5848 <th> second header
5849 </th></tr>
5850 <tr style="color:red;">
5851 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5852 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5853 </td></tr>
5854 <tr>
5855 <td> data </td>
5856 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5857 </td></tr></table>
5858
5859 !! end
5860
5861 # The expected HTML structure in this test is debatable. The PHP parser does
5862 # not parse this kind of table at all. The main focus for Parsoid is on
5863 # round-tripping, so this output is ok for now. TODO: revisit!
5864 !! test
5865 Wikitext table with html-syntax row
5866 !! wikitext
5867 {|
5868 |-
5869 <td>foo</td>
5870 |}
5871 !! html/parsoid
5872 <table>
5873 <tbody>
5874 <tr>
5875 <td>foo</td></tr></tbody></table>
5876 !! end
5877
5878 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5879 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5880 ## PHP parser, which tidy then compounds by fostering the content
5881 ## entirely out of the table. Parsoid recognizes the table context
5882 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5883 ## depends on PHP's treatment of broken table markup!
5884 !! test
5885 Implicit <td> after a |-
5886 !! options
5887 parsoid=wt2html,html2html
5888 !! wikitext
5889 {|
5890 |-
5891 a
5892 |}
5893 !! html/php
5894 <table>
5895
5896 a
5897 </table>
5898
5899 !! html/php+tidy
5900 <p>a</p>
5901 !! html/parsoid
5902 <table>
5903 <tr><td>a</td></tr>
5904 </table>
5905 !! end
5906
5907 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5908 !! test
5909 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5910 !! options
5911 parsoid=wt2html,html2html
5912 !! wikitext
5913 {|
5914 |-
5915 |
5916 a
5917 |-
5918 b
5919 |}
5920 !! html/php
5921 <table>
5922
5923 <tr>
5924 <td>
5925 <pre>a
5926 </pre>
5927 </td></tr>
5928 b
5929 </table>
5930
5931 !! html/php+tidy
5932 <p>b</p>
5933 <table>
5934 <tr>
5935 <td>
5936 <pre>
5937 a
5938 </pre></td>
5939 </tr>
5940 </table>
5941 !! html/parsoid
5942 <table>
5943 <tbody>
5944 <tr><td><pre>a</pre></td></tr>
5945 <tr><td> b</td></tr>
5946 </tbody>
5947 </table>
5948 !! end
5949
5950 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5951 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5952 !! test
5953 Lists should be recognized in an implicit <td> context
5954 !! options
5955 parsoid=wt2html,html2html
5956 !! wikitext
5957 {|
5958 |-
5959 *a
5960 |}
5961 !! html/php
5962 <table>
5963
5964 <ul><li>a</li></ul>
5965 </table>
5966
5967 !! html/php+tidy
5968 <ul>
5969 <li>a</li>
5970 </ul>
5971 !! html/parsoid
5972 <table>
5973 <tr>
5974 <td><ul>
5975 <li>a</li>
5976 </ul></td>
5977 </tr>
5978 </table>
5979 !! end
5980
5981 !! test
5982 Parsoid: Round-trip tables directly followed by content (bug 51219)
5983 !! options
5984 parsoid=wt2html,wt2wt
5985 !! wikitext
5986 {|
5987 |foo
5988 |} bar
5989
5990 {|
5991 |baz
5992 |}<b>quux</b>
5993 !! html+tidy
5994 <table>
5995 <tr>
5996 <td>foo</td>
5997 </tr>
5998 </table>
5999 <p>bar</p>
6000 <table>
6001 <tr>
6002 <td>baz</td>
6003 </tr>
6004 </table>
6005 <p><b>quux</b></p>
6006 !! end
6007
6008 !! test
6009 Parsoid: Default to a newline after tables in new content (bug 51219)
6010 !! options
6011 parsoid=html2wt
6012 !! html
6013 <table><tbody>
6014 <tr><td>foo</td></tr></tbody></table> bar
6015 <table><tbody>
6016 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6017 !! wikitext
6018 {|
6019 |foo
6020 |}
6021 <nowiki> </nowiki>bar
6022 {|
6023 |baz
6024 |}
6025 '''quux'''
6026 !! end
6027
6028 !! test
6029 Parsoid: newline inducing block nodes don't suppress <nowiki>
6030 !! options
6031 parsoid=html2wt
6032 !! html
6033 a<h1>foo</h1>
6034 !! wikitext
6035 <nowiki> </nowiki>a
6036
6037 = foo =
6038 !! end
6039
6040 !! test
6041 Parsoid: Row-syntax table headings followed by comment & table cells
6042 !! options
6043 parsoid=wt2html,wt2wt
6044 !! wikitext
6045 {|
6046 ! foo || bar
6047 <!-- foo --> || baz || quux
6048 |}
6049 !! html/php
6050 <table>
6051 <tr>
6052 <th> foo </th>
6053 <th> bar
6054 </th>
6055 <td> baz </td>
6056 <td> quux
6057 </td></tr></table>
6058
6059 !! html/parsoid
6060 <table>
6061 <tbody><tr><th> foo </th><th> bar
6062 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6063 </tbody></table>
6064 !! end
6065
6066
6067 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6068 # preserves it.
6069 !!test
6070 Parsoid: Recover better from broken table attributes
6071 !!options
6072 parsoid=wt2html
6073 !!wikitext
6074 {| class="foo
6075 | class="bar" |
6076 foo
6077 |}
6078 !!html/php+tidy
6079 <table>
6080 <tr>
6081 <td class="bar">
6082 <p>foo</p>
6083 </td>
6084 </tr>
6085 </table>
6086 !!html/parsoid
6087 <table class="foo">
6088 <tr>
6089 <td class="bar">
6090 <p>foo</p></td></tr>
6091 </tbody></table>
6092 !!end
6093
6094 !! test
6095 Strip unsupported table tags
6096 !! options
6097 parsoid=html2wt
6098 !! html
6099 <table>
6100 <thead>
6101 <tr>
6102 <th>Month</th>
6103 <th>Savings</th>
6104 </tr>
6105 </thead>
6106 <tbody>
6107 <tr>
6108 <td>January</td>
6109 <td>$100</td>
6110 </tr>
6111 <tr>
6112 <td>February</td>
6113 <td>$80</td>
6114 </tr>
6115 </tbody>
6116 <tfoot>
6117 <tr>
6118 <td>Sum</td>
6119 <td>$180</td>
6120 </tr>
6121 </tfoot>
6122 </table>
6123 !! wikitext
6124 {|
6125
6126 !Month
6127 !Savings
6128
6129 |January
6130 |$100
6131
6132 |-
6133 |February
6134 |$80
6135
6136 |Sum
6137 |$180
6138
6139 |}
6140 !! end
6141
6142 ###
6143 ### Internal links
6144 ###
6145 !! test
6146 Plain link, capitalized
6147 !! wikitext
6148 [[Main Page]]
6149 !! html
6150 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6151 </p>
6152 !! end
6153
6154 !! test
6155 Plain link, uncapitalized
6156 !! wikitext
6157 [[main Page]]
6158 !! html
6159 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6160 </p>
6161 !! end
6162
6163 !! test
6164 Piped link
6165 !! wikitext
6166 [[Main Page|The Main Page]]
6167 !! html
6168 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6169 </p>
6170 !! end
6171
6172 !! test
6173 Piped link with comment in link text
6174 !! wikitext
6175 [[Main Page|The Main<!--front--> Page]]
6176 !! html
6177 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6178 </p>
6179 !! end
6180
6181 !! test
6182 Piped link with multiple pipe characters in link text
6183 !! wikitext
6184 [[Main Page||The|Main|Page|]]
6185 !! html/php
6186 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6187 </p>
6188 !! html/parsoid
6189 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6190 !! end
6191
6192 !! test
6193 Broken link
6194 !! wikitext
6195 [[Zigzagzogzagzig]]
6196 !! html
6197 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6198 </p>
6199 !! end
6200
6201 !! test
6202 Broken link with fragment
6203 !! wikitext
6204 [[Zigzagzogzagzig#zug]]
6205 !! html
6206 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6207 </p>
6208 !! end
6209
6210 !! test
6211 Special page link with fragment
6212 !! wikitext
6213 [[Special:Version#anchor]]
6214 !! html
6215 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6216 </p>
6217 !! end
6218
6219 !! test
6220 Nonexistent special page link with fragment
6221 !! wikitext
6222 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6223 !! html
6224 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6225 </p>
6226 !! end
6227
6228 !! test
6229 Link with prefix
6230 !! wikitext
6231 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6232 !! html
6233 <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>
6234 </p>
6235 !! end
6236
6237 !! test
6238 Link with suffix
6239 !! wikitext
6240 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6241 !! html
6242 <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>!!!
6243 </p>
6244 !! end
6245
6246 !! article
6247 prefixed article
6248 !! text
6249 Some text
6250 !! endarticle
6251
6252 !! test
6253 Bug 43661: Piped links with identical prefixes
6254 !! wikitext
6255 [[prefixed article|prefixed articles with spaces]]
6256
6257 [[prefixed article|prefixed articlesaoeu]]
6258
6259 [[Main Page|Main Page test]]
6260 !! html
6261 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6262 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6263 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6264 </p>
6265 !! end
6266
6267
6268 !! test
6269 Link with HTML entity in suffix / tail
6270 !! wikitext
6271 [[Main Page]]&quot;, [[Main Page]]&#97;
6272 !! html/php
6273 <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;
6274 </p>
6275 !! html/parsoid
6276 <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>
6277 !! end
6278
6279 !! test
6280 Link with 3 brackets
6281 !! wikitext
6282 [[[Main Page]]]
6283 !! html
6284 <p>[[[Main Page]]]
6285 </p>
6286 !! end
6287
6288 !! test
6289 Link with 4 brackets
6290 !! wikitext
6291 [[[[Main Page]]]]
6292 !! html
6293 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6294 </p>
6295 !! end
6296
6297 !! test
6298 Piped link with 3 brackets
6299 !! wikitext
6300 [[[main page|the main page]]]
6301 !! html
6302 <p>[[[main page|the main page]]]
6303 </p>
6304 !! end
6305
6306 !! test
6307 Piped link with extlink-like text
6308 !! wikitext
6309 [[Main Page|[bar]]]
6310 [[Main Page|This is a [bar]]]
6311 !! html/php
6312 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6313 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6314 </p>
6315 !! html/parsoid
6316 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6317 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6318 !! end
6319
6320 !! test
6321 Link with multiple pipes
6322 !! wikitext
6323 [[Main Page|The|Main|Page]]
6324 !! html
6325 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6326 </p>
6327 !! end
6328
6329 # Note that parsoid does not munge anchor text; all non-space
6330 # characters are valid in HTML5 ids.
6331 !! test
6332 Anchor containing a #. (bug 63430)
6333 !! wikitext
6334 [[Main Page#And#Link]]
6335 !! html/php
6336 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6337 </p>
6338 !! html/parsoid
6339 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6340 !! end
6341
6342 !! test
6343 Link to namespaces
6344 !! wikitext
6345 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6346 !! html
6347 <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>
6348 </p>
6349 !! end
6350
6351 !! test
6352 Link with space in namespace
6353 !! wikitext
6354 [[User talk:Foo bar]]
6355 !! html
6356 <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>
6357 </p>
6358 !! end
6359
6360 !! article
6361 MemoryAlpha:AlphaTest
6362 !! text
6363 This is an article in the MemoryAlpha namespace
6364 (which shadows the memoryalpha interwiki link).
6365 !! endarticle
6366
6367 !! test
6368 Namespace takes precedence over interwiki link (bug 51680)
6369 !! wikitext
6370 [[MemoryAlpha:AlphaTest]]
6371 !! html
6372 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6373 </p>
6374 !! end
6375
6376 # The previous test doesn't work correctly in html2*, due to not recognizing the
6377 # link as an internal one. This one checks for the correct behavior.
6378 !! test
6379 Link to namespace preferred over interwiki with correct rel attribute
6380 !! options
6381 parsoid=html2wt,html2html
6382 !! html
6383 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6384 !! wikitext
6385 [[MemoryAlpha:AlphaTest]]
6386 !! end
6387
6388 !! test
6389 Piped link to namespace
6390 !! wikitext
6391 [[Meta:Disclaimers|The disclaimers]]
6392 !! html
6393 <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>
6394 </p>
6395 !! end
6396
6397 !! test
6398 Link containing }
6399 !! wikitext
6400 [[Usually caused by a typo (oops}]]
6401 !! html
6402 <p>[[Usually caused by a typo (oops}]]
6403 </p>
6404 !! end
6405
6406 !! article
6407 7% Solution
6408 !! text
6409 Just a test of an article title containing a percent.
6410 !! endarticle
6411
6412 !! test
6413 Link containing % (not as a hex sequence)
6414 !! wikitext
6415 [[7% Solution]]
6416 !! html/php
6417 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6418 </p>
6419 !! html/parsoid
6420 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6421 !! end
6422
6423 # note that the parsoid HTML is identical to the previous test output,
6424 # so the previous test ensures that the html2wt mode will generate the
6425 # "not as a hex sequence" wikitext.
6426 !! test
6427 Link containing % as a single hex sequence interpreted to char
6428 !! options
6429 parsoid=wt2wt,wt2html,html2html
6430 !! wikitext
6431 [[7%25 Solution]]
6432 !! html/php
6433 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6434 </p>
6435 !! html/parsoid
6436 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6437 !!end
6438
6439 !! test
6440 Link containing % as a double hex sequence interpreted to hex sequence
6441 !! wikitext
6442 [[7%2525 Solution]]
6443 !! html
6444 <p>[[7%2525 Solution]]
6445 </p>
6446 !!end
6447
6448 # note that parsoid does not munge anchor text; all non-space
6449 # characters are valid in HTML5 anchors.
6450 !! test
6451 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6452 Example for such a section: == < ==
6453 !! wikitext
6454 [[%23%3c]][[%23%3e]]
6455 !! html/php
6456 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6457 </p>
6458 !! html/parsoid
6459 <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>
6460 !! end
6461
6462 !! test
6463 Link containing "<#" and ">#" as a hex sequences
6464 !! wikitext
6465 [[%3c%23]][[%3e%23]]
6466 !! html
6467 <p>[[%3c%23]][[%3e%23]]
6468 </p>
6469 !! end
6470
6471 !! test
6472 Link containing an equals sign
6473 !! wikitext
6474 [[Special:BookSources/isbn=4-00-026157-6]]
6475 !! html/php
6476 <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>
6477 </p>
6478 !! html/parsoid
6479 <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>
6480 !! end
6481
6482 !! article
6483 Foo~bar
6484 !! text
6485 Just a test of an article title containing a tilde.
6486 !! endarticle
6487
6488 # note that links containing signatures, like [[Foo~~~~]], are
6489 # massaged by the pre-save transform (PST) and so the tildes are never
6490 # seen by the parser.
6491 !! test
6492 Link containing a tilde
6493 !! wikitext
6494 [[Foo~bar]]
6495 !! html/php
6496 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6497 </p>
6498 !! html/parsoid
6499 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6500 !! end
6501
6502 !! test
6503 Link containing double-single-quotes '' (bug 4598)
6504 !! wikitext
6505 [[Lista d''e paise d''o munno]]
6506 !! html/php
6507 <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>
6508 </p>
6509 !! html/parsoid
6510 <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>
6511 !! end
6512
6513 !! test
6514 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6515 !! wikitext
6516 Some [[Link|pretty ''italics'' and stuff]]!
6517 !! html/php
6518 <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>!
6519 </p>
6520 !! html/parsoid
6521 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6522 !! end
6523
6524 !! test
6525 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6526 !! wikitext
6527 ''Some [[Link|pretty ''italics'' and stuff]]!''
6528 !! html
6529 <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>
6530 </p>
6531 !! end
6532
6533 !! test
6534 Link with double quotes in title part (literal) and alternate part (interpreted)
6535 !! wikitext
6536 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6537
6538 [[''Pentecoste'']]
6539
6540 [[''Pentecoste''|Pentecoste]]
6541
6542 [[''Pentecoste''|''Pentecoste'']]
6543 !! html/php
6544 <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>
6545 </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>
6546 </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>
6547 </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>
6548 </p>
6549 !! html/parsoid
6550 <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>
6551 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6552 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6553 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6554 !! end
6555
6556 !! test
6557 Broken image links with HTML captions (bug 39700)
6558 !! wikitext
6559 [[File:Nonexistent|<script></script>]]
6560 [[File:Nonexistent|100x100px|<script></script>]]
6561 [[File:Nonexistent|&lt;]]
6562 [[File:Nonexistent|a<i>b</i>c]]
6563 !! html/php
6564 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6565 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6566 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6567 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6568 </p>
6569 !! html/parsoid
6570 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6571 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
6572 <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;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6573 <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>b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
6574 !! end
6575
6576 !! test
6577 Plain link to URL
6578 !! wikitext
6579 [[http://www.example.com]]
6580 !! html/php
6581 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6582 </p>
6583 !! html/parsoid
6584 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6585 !! end
6586
6587 !! test
6588 Plain link to URL with link text
6589 !! wikitext
6590 [[http://www.example.com Link text]]
6591 !! html
6592 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6593 </p>
6594 !! end
6595
6596 !! test
6597 Plain link to protocol-relative URL
6598 !! wikitext
6599 [[//www.example.com]]
6600 !! html/php
6601 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6602 </p>
6603 !! html/parsoid
6604 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6605 !! end
6606
6607 !! test
6608 Plain link to protocol-relative URL with link text
6609 !! wikitext
6610 [[//www.example.com Link text]]
6611 !! html
6612 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6613 </p>
6614 !! end
6615
6616 !! test
6617 Plain link to page with question mark in title
6618 !! wikitext
6619 [[A?b]]
6620
6621 [[A?b|Baz]]
6622 !! html
6623 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6624 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6625 </p>
6626 !! end
6627
6628
6629 # I'm fairly sure the expected result here is wrong.
6630 # We want these to be URL links, not pseudo-pages with URLs for titles....
6631 # However the current output is also pretty screwy.
6632 #
6633 # ----
6634 # I'm changing it to match the current output--it arguably makes more
6635 # sense in the light of the test above. Old expected result was:
6636 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6637 #</p>
6638 # But I think this test is bordering on "garbage in, garbage out" anyway.
6639 # -- wtm
6640 !! test
6641 Piped link to URL
6642 !! wikitext
6643 Piped link to URL: [[http://www.example.com|an example URL]]
6644 !! html/php
6645 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6646 </p>
6647 !! html/parsoid
6648 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6649 !! end
6650
6651 !! test
6652 BUG 2: [[page|http://url/]] should link to page, not http://url/
6653 !! wikitext
6654 [[Main Page|http://url/]]
6655 !! html/php
6656 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6657 </p>
6658 !! html/parsoid
6659 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6660 !! end
6661
6662 # Parsoid does not mark self-links, by design.
6663 !! test
6664 BUG 337: Escaped self-links should be bold
6665 !! options
6666 title=[[Bug462]]
6667 !! wikitext
6668 [[Bu&#103;462]] [[Bug462]]
6669 !! html/php
6670 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6671 </p>
6672 !! html/php+tidy
6673 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6674 !! html/parsoid
6675 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6676 !! end
6677
6678 !! test
6679 Self-link to section should not be bold
6680 !! options
6681 title=[[Main Page]]
6682 !! wikitext
6683 [[Main Page#section]]
6684 !! html
6685 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6686 </p>
6687 !! end
6688
6689 !! article
6690 00
6691 !! text
6692 This is 00.
6693 !! endarticle
6694
6695 !!test
6696 Self-link to numeric title
6697 !!options
6698 title=[[0]]
6699 !! wikitext
6700 [[0]]
6701 !! html
6702 <p><strong class="selflink">0</strong>
6703 </p>
6704 !!end
6705
6706 !!test
6707 Link to numeric-equivalent title
6708 !!options
6709 title=[[0]]
6710 !! wikitext
6711 [[00]]
6712 !! html
6713 <p><a href="/wiki/00" title="00">00</a>
6714 </p>
6715 !!end
6716
6717 !! test
6718 <nowiki> inside a link
6719 !! wikitext
6720 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6721 !! html
6722 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6723 </p>
6724 !! end
6725
6726 !! test
6727 Non-breaking spaces in title
6728 !! wikitext
6729 [[&nbsp; Main &nbsp; Page &nbsp;]]
6730 !! html
6731 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6732 </p>
6733 !!end
6734
6735 !! test
6736 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6737 !! options
6738 language=ca
6739 !! wikitext
6740 '''[[Main Page]]'''
6741 !! html
6742 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6743 </p>
6744 !! end
6745
6746 !! test
6747 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6748 !! options
6749 language=ca
6750 !! wikitext
6751 ''[[Main Page]]''
6752 !! html
6753 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6754 </p>
6755 !! end
6756
6757 !! test
6758 Internal link with en linktrail: no apostrophes (bug 27473)
6759 !! options
6760 language=en
6761 !! wikitext
6762 [[Something]]'nice
6763 !! html
6764 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6765 </p>
6766 !! end
6767
6768 !! test
6769 Internal link with ca linktrail with apostrophes (bug 27473)
6770 !! options
6771 language=ca
6772 !! wikitext
6773 [[Something]]'nice
6774 !! html
6775 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6776 </p>
6777 !! end
6778
6779 !! test
6780 Internal link with kaa linktrail with apostrophes (bug 27473)
6781 !! options
6782 language=kaa
6783 !! wikitext
6784 [[Something]]'nice
6785 !! html
6786 <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>
6787 </p>
6788 !! end
6789
6790 !! test
6791 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6792 !! wikitext
6793 [[User:Foo/Test/63636:Bar|Test]]
6794 !! html/php
6795 <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>
6796 </p>
6797 !! html/parsoid
6798 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6799 !! end
6800
6801 !! test
6802 Purely hash wikilink
6803 !! options
6804 title=[[User:test/123]]
6805 !! wikitext
6806 [[#a|b]]
6807 !! html/php
6808 <p><a href="#a">b</a>
6809 </p>
6810 !! html/parsoid
6811 <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>
6812 !! end
6813
6814 !! test
6815 1. Interaction of linktrail and template encapsulation
6816 !! options
6817 parsoid
6818 !! wikitext
6819 {{echo|[[Foo]]}}l
6820 !! html
6821 <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>
6822 !! end
6823
6824 !! test
6825 2. Interaction of linktrail and template encapsulation
6826 !! options
6827 parsoid
6828 !! wikitext
6829 {{echo|Some [[Fool]]}}s
6830 !! html
6831 <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>
6832 !! end
6833
6834 !! test
6835 3. Interaction of linktrail and template encapsulation
6836 !! options
6837 parsoid
6838 !! wikitext
6839 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6840 !! html
6841 <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>
6842 !! end
6843
6844 !! article
6845 Söfnuður
6846 !! text
6847 Test.
6848 !! endarticle
6849
6850 !! test
6851 Internal link with is link prefix
6852 !! options
6853 language=is
6854 !! wikitext
6855 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6856 !! html
6857 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6858 </p>
6859 !! end
6860
6861 !! article
6862 Mótmælendatrú
6863 !! text
6864 Test.
6865 !! endarticle
6866
6867 !! test
6868 Internal link with is link trail and link prefix
6869 !! options
6870 language=is
6871 !! wikitext
6872 [[mótmælendatrú|xxx]]ar
6873 [[mótmælendatrú]]ar
6874 mótmælenda[[söfnuður]]
6875 mótmælenda[[söfnuður|söfnuðir]]
6876 mótmælenda[[söfnuður|söfnuðir]]xxx
6877 !! html
6878 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6879 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6880 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6881 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6882 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6883 </p>
6884 !! end
6885
6886 !! test
6887 Parsoid link trail escaping
6888 !! options
6889 parsoid=html2wt,html2html
6890 !! html
6891 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6892 !! wikitext
6893 [[apple]]<nowiki/>s
6894 !! end
6895
6896 !! test
6897 Parsoid link prefix escaping
6898 !! options
6899 language=is
6900 parsoid=html2wt,html2html
6901 !! html
6902 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6903 !! wikitext
6904 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6905 !! end
6906
6907 !! test
6908 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6909 !! wikitext
6910 [[Foo| bar]]
6911
6912 [[Foo| ''bar'']]
6913
6914 [http://wp.org foo]
6915
6916 [http://wp.org ''foo'']
6917 !! html
6918 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6919 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6920 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6921 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6922 </p>
6923 !! end
6924
6925 !! test
6926 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6927 !! options
6928 parsoid
6929 !! wikitext
6930 [[Foo|{{echo|a}} b {{echo|c}}]]
6931 !! html
6932 <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>
6933 !! end
6934
6935 !! test
6936 Link with angle bracket after anchor
6937 !! wikitext
6938 [[Foo#<bar>]]
6939 !! html/php
6940 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6941 </p>
6942 !! html/parsoid
6943 <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>
6944 !! end
6945
6946 ###
6947 ### Interwiki links (see maintenance/interwiki.sql)
6948 ###
6949
6950 !! test
6951 Inline interwiki link
6952 !! options
6953 parsoid=wt2html,wt2wt,html2html
6954 !! wikitext
6955 [[MeatBall:SoftSecurity]]
6956 !! html/php
6957 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6958 </p>
6959 !! html/parsoid
6960 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
6961 !! end
6962
6963 !! test
6964 Inline interwiki link with empty title (bug 2372)
6965 !! options
6966 parsoid=wt2html,wt2wt,html2html
6967 !! wikitext
6968 [[MeatBall:]]
6969 !! html/php
6970 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6971 </p>
6972 !! html/parsoid
6973 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
6974 !! end
6975
6976 !! test
6977 Interwiki link encoding conversion (bug 1636)
6978 !! wikitext
6979 *[[Wikipedia:ro:Olteni&#0355;a]]
6980 *[[Wikipedia:ro:Olteni&#355;a]]
6981 !! html
6982 <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>
6983 <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>
6984
6985 !! html+tidy
6986 <ul>
6987 <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>
6988 <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>
6989 </ul>
6990 !! end
6991
6992 !! test
6993 Interwiki link with fragment (bug 2130)
6994 !! wikitext
6995 [[MeatBall:SoftSecurity#foo]]
6996 !! html
6997 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6998 </p>
6999 !! end
7000
7001 # Ideally the wikipedia: prefix here should be proto-relative too
7002 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7003 # define the 'en' prefix, and originally the test used 'wikipedia',
7004 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7005 # article.
7006 !! test
7007 Different interwiki prefixes mapping to the same URL
7008 !! wikitext
7009 [[:en:Foo]]
7010
7011 [[:en:Foo|Foo]]
7012
7013 [[wikipedia:Foo]]
7014
7015 [[:wikipedia:Foo|Foo]]
7016
7017 [[wikipedia:en:Foo]]
7018
7019 [[:wikipedia:en:Foo]]
7020
7021 [[ wikiPEdia :Foo]]
7022 !! html/parsoid
7023 <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>
7024
7025 <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>
7026
7027 <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>
7028
7029 <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>
7030
7031 <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>
7032
7033 <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>
7034
7035 <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>
7036 !! end
7037
7038 !! test
7039 Interwiki links that cannot be represented in wiki syntax
7040 !! wikitext
7041 [[meatball:ok]]
7042 [[meatball:ok#foo|ok with fragment]]
7043 [[meatball:ok_as_well?|ok ending with ? mark]]
7044 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7045 [http://de.wikipedia.org/wiki/#foo is just fragment]
7046
7047 !! html/php
7048 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7049 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7050 <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>
7051 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7052 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7053 </p>
7054 !! html/parsoid
7055 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7056 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7057 <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>
7058 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7059 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7060 !! end
7061
7062 !! test
7063 Interwiki links: trail
7064 !! wikitext
7065 [[wikipedia:Foo|Ba]]r
7066 !! html/php
7067 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7068 </p>
7069 !! html/parsoid
7070 <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>
7071 !! end
7072
7073 !! test
7074 Local interwiki link
7075 !! options
7076 parsoid=wt2html,wt2wt,html2html
7077 !! wikitext
7078 [[local:Template:Foo]]
7079 !! html/php
7080 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7081 </p>
7082 !! html/parsoid
7083 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7084 !! end
7085
7086 # Parsoid does not mark self-links, by design.
7087 !! test
7088 Local interwiki link: self-link to current page
7089 !! options
7090 title=[[Main Page]]
7091 parsoid=wt2html,wt2wt,html2html
7092 !! wikitext
7093 [[local:Main Page]]
7094 !! html/php
7095 <p><strong class="selflink">local:Main Page</strong>
7096 </p>
7097 !! html/parsoid
7098 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7099 !! end
7100
7101 !! test
7102 Local interwiki link: prefix only (bug 64167)
7103 !! options
7104 parsoid=wt2html,wt2wt,html2html
7105 !! wikitext
7106 [[local:]]
7107 !! html/php
7108 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7109 </p>
7110 !! html/parsoid
7111 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7112 !! end
7113
7114 !! test
7115 Local interwiki link: with additional interwiki prefix (bug 61357)
7116 !! options
7117 parsoid=wt2html,wt2wt,html2html
7118 !! wikitext
7119 [[local:meatball:Hello]]
7120 !! html/php
7121 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7122 </p>
7123 !! html/parsoid
7124 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7125 !! end
7126
7127 !! test
7128 Multiple local interwiki link prefixes
7129 !! wikitext
7130 [[local:local:local:local:mi:local:Foo]]
7131 !! options
7132 parsoid=wt2html,wt2wt,html2html
7133 !! html/php
7134 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7135 </p>
7136 !! html/parsoid
7137 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7138 !! end
7139
7140 ###
7141 ### Interlanguage links
7142 ### Language links (so that searching for '### language' matches..)
7143 ###
7144
7145 !! test
7146 Interlanguage link
7147 !! options
7148 parsoid=wt2html,wt2wt,html2html
7149 !! wikitext
7150 Blah blah blah
7151 [[zh:Chinese]]
7152 !! html/php
7153 <p>Blah blah blah
7154 </p>
7155 !! html/parsoid
7156 <p>Blah blah blah</p>
7157 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7158 !! end
7159
7160 !! test
7161 Interlanguage link with spacing
7162 !! options
7163 parsoid=wt2html,wt2wt,html2html
7164 !! wikitext
7165 Blah blah blah
7166 [[ zh : Chinese ]]
7167 !! html/php
7168 <p>Blah blah blah
7169 </p>
7170 !! html/parsoid
7171 <p>Blah blah blah</p>
7172 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7173 !! end
7174
7175 !! test
7176 Double interlanguage link
7177 !! options
7178 parsoid=wt2html,wt2wt,html2html
7179 !! wikitext
7180 Blah blah blah
7181 [[es:Spanish]]
7182 [[zh:Chinese]]
7183 !! html/php
7184 <p>Blah blah blah
7185 </p>
7186 !! html/parsoid
7187 <p>Blah blah blah</p>
7188 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7189 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7190 !! end
7191
7192 !! test
7193 Interlanguage link variations
7194 !! options
7195 parsoid=wt2html,wt2wt,html2html
7196 !! wikitext
7197 Blah blah blah
7198 [[ es :Spanish]]
7199 [[ ZH :Chinese]]
7200 [[es:Foo_bar]]
7201 [[es:Foo bar]]
7202 !! html/php
7203 <p>Blah blah blah
7204 </p>
7205 !! html/parsoid
7206 <p>Blah blah blah</p>
7207 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7208 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7209 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7210 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7211 !! end
7212
7213 !! test
7214 Interlanguage link, with prefix links
7215 !! options
7216 language=ln
7217 !! wikitext
7218 Blah blah blah
7219 [[zh:Chinese]]
7220 !! html/php
7221 <p>Blah blah blah
7222 </p>
7223 !! html/parsoid
7224 <p>Blah blah blah</p>
7225 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7226 !! end
7227
7228 !! test
7229 Double interlanguage link, with prefix links (bug 8897)
7230 !! options
7231 language=ln
7232 !! wikitext
7233 Blah blah blah
7234 [[es:Spanish]]
7235 [[zh:Chinese]]
7236 !! html/php
7237 <p>Blah blah blah
7238 </p>
7239 !! html/parsoid
7240 <p>Blah blah blah</p>
7241 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7242 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7243 !! end
7244
7245 !! test
7246 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7247 !! wikitext
7248 Blah blah blah
7249 [[mul:Article]]
7250 !! html/php
7251 <p>Blah blah blah
7252 </p>
7253 !! html/parsoid
7254 <p>Blah blah blah</p>
7255 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7256 !! end
7257
7258 !! test
7259 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7260 !! options
7261 language=ln
7262 !! wikitext
7263 [[WW&nbsp;II]]
7264 !! html
7265 <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>
7266 </p>
7267 !! end
7268
7269 !! test
7270 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7271 !! options
7272 parsoid=html2wt
7273 !! html
7274 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7275 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7276 !! wikitext
7277 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7278
7279 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7280 !! end
7281
7282 !! test
7283 Parsoid: handle constructor well
7284 !! wikitext
7285 [[constructor]]
7286
7287 [[constructor:foo]]
7288 !! html/php
7289 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7290 </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>
7291 </p>
7292 !! html/parsoid
7293 <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>
7294
7295 <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>
7296 !! end
7297
7298 !! article
7299 ko:
7300 !! text
7301 Test.
7302 !! endarticle
7303
7304 # Note that `ko` isn't a known interlanguage prefix
7305 !! test
7306 Parsoid: recognize interlanguage links without a target page
7307 !! options
7308 ill
7309 !! wikitext
7310 [[es:]]
7311
7312 [[ko:]]
7313 !! html/php
7314 es:
7315 !! html/parsoid
7316 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7317
7318 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7319 !! end
7320
7321 # Note that `ko` isn't a known interwiki prefix
7322 !! test
7323 Parsoid: recognize interwiki links without a target page
7324 !! options
7325 parsoid=wt2html,wt2wt,html2html
7326 !! wikitext
7327 [[:es:]]
7328
7329 [[:ko:]]
7330 !! html/php
7331 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7332 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7333 </p>
7334 !! html/parsoid
7335 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7336 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7337 !! end
7338
7339 !! test
7340 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7341 !! wikitext
7342 [[mi:Foo]]
7343 !! html/php
7344 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7345 </p>
7346 !! html/parsoid
7347 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7348 !! end
7349
7350 !! test
7351 Interlanguage link with preceding local interwiki link (bug 68085)
7352 !! options
7353 parsoid=wt2html,wt2wt,html2html
7354 !! wikitext
7355 Blah blah blah
7356 [[local:es:Spanish]]
7357 !! html/php
7358 <p>Blah blah blah
7359 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7360 </p>
7361 !! html/parsoid
7362 <p>Blah blah blah
7363 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7364 !! end
7365
7366 !! test
7367 Looks like an interlanguage link, but is actually a local interwiki
7368 !! options
7369 parsoid=wt2html,wt2wt,html2html
7370 !! wikitext
7371 Blah blah blah
7372 [[mi:Template:Foo]]
7373 !! html/php
7374 <p>Blah blah blah
7375 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7376 </p>
7377 !! html/parsoid
7378 <p>Blah blah blah
7379 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7380 !! end
7381
7382 ###
7383 ### Redirects, Parsoid-only
7384 ###
7385 !! test
7386 1. Simple redirect to page
7387 !! options
7388 parsoid
7389 !! wikitext
7390 #REDIRECT [[Main Page]]
7391 !! html
7392 <link rel="mw:PageProp/redirect" href="./Main_Page">
7393 !! end
7394
7395 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7396 !! test
7397 2. Other redirect variants
7398 !! options
7399 parsoid=wt2html,wt2wt
7400 !! wikitext
7401 #REDIRECT [[Main_Page]]
7402 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7403 !! html/parsoid
7404 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7405 !! end
7406
7407 !! test
7408 Empty redirect
7409 !! options
7410 parsoid=wt2html,wt2wt
7411 !! wikitext
7412 #REDIRECT [[]]
7413 !! html
7414 <ol>
7415 <li>REDIRECT [[]]</li></ol>
7416 !! end
7417
7418 !! test
7419 Optional colon in #REDIRECT
7420 !! options
7421 # the colon is archaic syntax. we support it for wt2html, but we
7422 # don't care that it roundtrips back to the modern syntax.
7423 parsoid=wt2html,html2html
7424 !! wikitext
7425 #REDIRECT:[[Main Page]]
7426 !! html
7427 <link rel="mw:PageProp/redirect" href="./Main_Page">
7428 !! end
7429
7430 !! test
7431 Whitespace in #REDIRECT with optional colon
7432 !! options
7433 # the colon and gratuitous whitespace is archaic syntax. we support
7434 # it for wt2html, but we don't care that it roundtrips back to the
7435 # modern syntax (without extra whitespace)
7436 parsoid=wt2html,html2html
7437 !! wikitext
7438
7439 #REDIRECT
7440 :
7441 [[Main Page]]
7442 !! html
7443 <link rel="mw:PageProp/redirect" href="./Main_Page">
7444 !! end
7445
7446 !! test
7447 Piped link in #REDIRECT
7448 !! options
7449 # content after piped link is ignored. we support this syntax,
7450 # but don't care that the piped link is lost when we roundtrip this.
7451 parsoid=wt2html
7452 !! wikitext
7453 #REDIRECT [[Main Page|bar]]
7454 !! html
7455 <link rel="mw:PageProp/redirect" href="./Main_Page">
7456 !! end
7457
7458 !! test
7459 Redirect to category
7460 !! options
7461 parsoid=wt2html
7462 !! wikitext
7463 #REDIRECT [[Category:Foo]]
7464 !! html
7465 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7466 !! end
7467
7468 !! test
7469 Redirect to category with URL encoding
7470 !! options
7471 parsoid=wt2html
7472 !! wikitext
7473 #REDIRECT [[Category%3AFoo]]
7474 !! html
7475 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7476 !! end
7477
7478 !! test
7479 Redirect to category page
7480 !! options
7481 parsoid=wt2html,html2html
7482 !! wikitext
7483 #REDIRECT [[:Category:Foo]]
7484 !! html
7485 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7486 !! end
7487
7488 !! test
7489 Redirect to image page (1)
7490 !! options
7491 parsoid
7492 !! wikitext
7493 #REDIRECT [[File:Wiki.png]]
7494 !! html
7495 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7496 !! end
7497
7498 !! test
7499 Redirect to image page (2)
7500 !! options
7501 parsoid
7502 !! wikitext
7503 #REDIRECT [[Image:Wiki.png]]
7504 !! html
7505 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7506 !! end
7507
7508 !! test
7509 Redirect to language
7510 !! options
7511 parsoid
7512 !! wikitext
7513 #REDIRECT [[en:File:Wiki.png]]
7514 !! html
7515 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7516 !! end
7517
7518 !! test
7519 Redirect to interwiki
7520 !! options
7521 parsoid
7522 !! wikitext
7523 #REDIRECT [[meatball:File:Wiki.png]]
7524 !! html
7525 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7526 !! end
7527
7528 !! test
7529 Non-English #REDIRECT
7530 !! options
7531 parsoid
7532 language=is
7533 !! wikitext
7534 #TILVÍSUN [[Main Page]]
7535 !! html
7536 <link rel="mw:PageProp/redirect" href="./Main_Page">
7537 !! end
7538
7539 !! test
7540 New redirect
7541 !! options
7542 parsoid=html2wt
7543 !! html
7544 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7545 !! wikitext
7546 Foo
7547 #REDIRECT [[Foo]]
7548 !! end
7549
7550 ##
7551 ## XHTML tidiness
7552 ###
7553
7554 !! test
7555 <br> to <br />
7556 !! wikitext
7557 1<br>2<br />3
7558 !! html
7559 <p>1<br />2<br />3
7560 </p>
7561 !! end
7562
7563 !! test
7564 Broken br tag sanitization
7565 !! wikitext
7566 </br>
7567 !! html/php
7568 <p>&lt;/br&gt;
7569 </p>
7570 !! end
7571
7572 # TODO: Fix html2html mode (bug 51055)!
7573 # This </br> handling was added as part of bug 50831; but it
7574 # differs from how PHP+tidy handles this. We should investigate
7575 # this.
7576 !! test
7577 Parsoid: Broken br tag recognition
7578 !! options
7579 parsoid=wt2html
7580 !! wikitext
7581 </br>
7582
7583 <br/ >
7584 !! html/php+tidy
7585 <p>&lt;/br&gt;</p>
7586 <p><br /></p>
7587 !! html/parsoid
7588 <p><br></p>
7589 <p><br/></p>
7590 !! end
7591
7592 !! test
7593 Incorrecly removing closing slashes from correctly formed XHTML
7594 !! wikitext
7595 <br style="clear:both;" />
7596 !! html
7597 <p><br style="clear:both;" />
7598 </p>
7599 !! end
7600
7601 !! test
7602 Failing to transform badly formed HTML into correct XHTML
7603 !! wikitext
7604 <br style="clear: left;">
7605 <br style="clear: right;">
7606 <br style="clear: both;">
7607 !! html
7608 <p><br style="clear: left;" />
7609 <br style="clear: right;" />
7610 <br style="clear: both;" />
7611 </p>
7612 !!end
7613
7614 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7615 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7616 !! test
7617 Handling html with a div self-closing tag
7618 !! wikitext
7619 <div title />
7620 <div title/>
7621 <div title/ >
7622 <div title=bar />
7623 <div title=bar/>
7624 <div title=bar/ >
7625 !! html/php
7626 <p>&lt;div title /&gt;
7627 &lt;div title/&gt;
7628 </p>
7629 <div>
7630 <p>&lt;div title=bar /&gt;
7631 &lt;div title=bar/&gt;
7632 </p>
7633 <div title="bar/"></div>
7634 </div>
7635
7636 !! html/parsoid
7637 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7638 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7639 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7640 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7641 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7642 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7643 !! end
7644
7645 !! test
7646 Handling html with a br self-closing tag
7647 !! wikitext
7648 <br title />
7649 <br title/>
7650 <br title/ >
7651 <br title=bar />
7652 <br title=bar/>
7653 <br title=bar/ >
7654 !! html/php
7655 <p><br title="title" />
7656 <br title="title" />
7657 <br />
7658 <br title="bar" />
7659 <br title="bar" />
7660 <br title="bar/" />
7661 </p>
7662 !! html/parsoid
7663 <p><br title="" />
7664 <br title="" />
7665 <br title="" />
7666 <br title="bar" />
7667 <br title="bar" />
7668 <br title="bar/" />
7669 </p>
7670 !! end
7671
7672 !! test
7673 Horizontal ruler (should it add that extra space?)
7674 !! wikitext
7675 <hr>
7676 <hr >
7677 foo <hr
7678 > bar
7679 !! html+tidy
7680 <hr />
7681 <hr />
7682 <p>foo</p>
7683 <hr />
7684 <p>bar</p>
7685 !! end
7686
7687 !! test
7688 Horizontal ruler -- 4+ dashes render hr
7689 !! wikitext
7690 ----
7691 !! html
7692 <hr />
7693
7694 !! end
7695
7696 !! test
7697 Horizontal ruler -- eats additional dashes on the same line
7698 !! wikitext
7699 ---------
7700 !! html
7701 <hr />
7702
7703 !! end
7704
7705 !! test
7706 Horizontal ruler -- does not collapse dashes on consecutive lines
7707 !! wikitext
7708 ----
7709 ----
7710 !! html
7711 <hr />
7712 <hr />
7713
7714 !! end
7715
7716 !! test
7717 Horizontal ruler -- <4 dashes render as plain text
7718 !! wikitext
7719 ---
7720 !! html
7721 <p>---
7722 </p>
7723 !! end
7724
7725 !! test
7726 Horizontal ruler -- Supports content following dashes on same line
7727 !! wikitext
7728 ---- Foo
7729 !! html
7730 <hr /> Foo
7731
7732 !! html+tidy
7733 <hr />
7734 <p>Foo</p>
7735 !! end
7736
7737 ###
7738 ### Block-level elements
7739 ###
7740 !! test
7741 Common list
7742 !! wikitext
7743 *Common list
7744 * item 2
7745 *item 3
7746 !! html
7747 <ul><li>Common list</li>
7748 <li> item 2</li>
7749 <li>item 3</li></ul>
7750
7751 !! end
7752
7753 !! test
7754 Numbered list
7755 !! wikitext
7756 #Numbered list
7757 #item 2
7758 # item 3
7759 !! html
7760 <ol><li>Numbered list</li>
7761 <li>item 2</li>
7762 <li> item 3</li></ol>
7763
7764 !! end
7765
7766 !! test
7767 Mixed list
7768 !! wikitext
7769 *Mixed list
7770 *# with numbers
7771 ** and bullets
7772 *# and numbers
7773 *bullets again
7774 **bullet level 2
7775 ***bullet level 3
7776 ***#Number on level 4
7777 **bullet level 2
7778 **#Number on level 3
7779 **#Number on level 3
7780 *#number level 2
7781 *Level 1
7782 *** Level 3
7783 #** Level 3, but ordered
7784 !! html
7785 <ul><li>Mixed list
7786 <ol><li> with numbers</li></ol>
7787 <ul><li> and bullets</li></ul>
7788 <ol><li> and numbers</li></ol></li>
7789 <li>bullets again
7790 <ul><li>bullet level 2
7791 <ul><li>bullet level 3
7792 <ol><li>Number on level 4</li></ol></li></ul></li>
7793 <li>bullet level 2
7794 <ol><li>Number on level 3</li>
7795 <li>Number on level 3</li></ol></li></ul>
7796 <ol><li>number level 2</li></ol></li>
7797 <li>Level 1
7798 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7799 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7800
7801 !! end
7802
7803 !! test
7804 Nested lists 1
7805 !! wikitext
7806 *foo
7807 **bar
7808 !! html
7809 <ul><li>foo
7810 <ul><li>bar</li></ul></li></ul>
7811
7812 !! end
7813
7814 !! test
7815 Nested lists 2
7816 !! wikitext
7817 **foo
7818 *bar
7819 !! html
7820 <ul><li><ul><li>foo</li></ul></li>
7821 <li>bar</li></ul>
7822
7823 !! end
7824
7825 !! test
7826 Nested lists 3 (first element empty)
7827 !! wikitext
7828 *
7829 **bar
7830 !! html
7831 <ul><li>
7832 <ul><li>bar</li></ul></li></ul>
7833
7834 !! end
7835
7836 !! test
7837 Nested lists 4 (first element empty)
7838 !! wikitext
7839 **
7840 *bar
7841 !! html
7842 <ul><li><ul><li></li></ul></li>
7843 <li>bar</li></ul>
7844
7845 !! end
7846
7847 !! test
7848 Nested lists 5 (both elements empty)
7849 !! wikitext
7850 **
7851 *
7852 !! html
7853 <ul><li><ul><li></li></ul></li>
7854 <li></li></ul>
7855
7856 !! end
7857
7858 !! test
7859 Nested lists 6 (both elements empty)
7860 !! wikitext
7861 *
7862 **
7863 !! html
7864 <ul><li>
7865 <ul><li></li></ul></li></ul>
7866
7867 !! end
7868
7869 !! test
7870 Nested lists 7 (skip initial nesting levels)
7871 !! wikitext
7872 *** foo
7873 !! html
7874 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7875
7876 !! end
7877
7878 !! test
7879 Nested lists 8 (multiple nesting transitions)
7880 !! wikitext
7881 * foo
7882 *** bar
7883 ** baz
7884 * boo
7885 !! html
7886 <ul><li> foo
7887 <ul><li><ul><li> bar</li></ul></li>
7888 <li> baz</li></ul></li>
7889 <li> boo</li></ul>
7890
7891 !! end
7892
7893 !! test
7894 1. Lists with start-of-line-transparent tokens before bullets: Comments
7895 !! wikitext
7896 *foo
7897 *<!--cmt-->bar
7898 <!--cmt-->*baz
7899 !! html
7900 <ul><li>foo</li>
7901 <li>bar</li>
7902 <li>baz</li></ul>
7903
7904 !! end
7905
7906 !! test
7907 2. Lists with start-of-line-transparent tokens before bullets: Template close
7908 !! wikitext
7909 *foo {{echo|bar
7910 }}*baz
7911 !! html
7912 <ul><li>foo bar</li>
7913 <li>baz</li></ul>
7914
7915 !! end
7916
7917 !! test
7918 List items are not parsed correctly following a <pre> block (bug 785)
7919 !! wikitext
7920 * <pre>foo</pre>
7921 * <pre>bar</pre>
7922 * zar
7923 !! html
7924 <ul><li> <pre>foo</pre></li>
7925 <li> <pre>bar</pre></li>
7926 <li> zar</li></ul>
7927
7928 !! end
7929
7930 !! test
7931 List items from template
7932 !! wikitext
7933
7934 {{inner list}}
7935 * item 2
7936
7937 * item 0
7938 {{inner list}}
7939 * item 2
7940
7941 * item 0
7942 * notSOL{{inner list}}
7943 * item 2
7944 !! html
7945 <ul><li> item 1</li>
7946 <li> item 2</li></ul>
7947 <ul><li> item 0</li>
7948 <li> item 1</li>
7949 <li> item 2</li></ul>
7950 <ul><li> item 0</li>
7951 <li> notSOL</li>
7952 <li> item 1</li>
7953 <li> item 2</li></ul>
7954
7955 !! end
7956
7957 !! test
7958 List interrupted by empty line or heading
7959 !! wikitext
7960 * foo
7961
7962 ** bar
7963 == A heading ==
7964 * Another list item
7965 !! html
7966 <ul><li> foo</li></ul>
7967 <ul><li><ul><li> bar</li></ul></li></ul>
7968 <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>
7969 <ul><li> Another list item</li></ul>
7970
7971 !!end
7972
7973 !!test
7974 Multiple list tags generated by templates
7975 !! wikitext
7976 {{echo|<li>}}a
7977 {{echo|<li>}}b
7978 {{echo|<li>}}c
7979 !! html
7980 <li>a
7981 <li>b
7982 <li>c</li>
7983 </li>
7984 </li>
7985
7986 !! html+tidy
7987 <ul>
7988 <li>a</li>
7989 <li>b</li>
7990 <li>c</li>
7991 </ul>
7992 !!end
7993
7994 !!test
7995 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7996 !! wikitext
7997 *a
7998 <!--This line will NOT split the list-->
7999 *b
8000 <!--This line will NOT split the list either-->
8001 *c
8002 <!--foo--> <!----> <!--This line NOT split the list either-->
8003 *d
8004 !! html
8005 <ul><li>a</li>
8006 <li>b</li>
8007 <li>c</li>
8008 <li>d</li></ul>
8009
8010 !!end
8011
8012 !!test
8013 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8014 !! wikitext
8015 *a
8016 <!--This line will NOT split the list-->
8017 *b
8018 <!--This line will NOT split the list either-->
8019 *c
8020 <!--foo--> <!----> <!--This line NOT split the list
8021 either-->
8022 *d
8023 !! html
8024 <ul><li>a</li>
8025 <li>b</li>
8026 <li>c</li>
8027 <li>d</li></ul>
8028
8029 !!end
8030
8031 !!test
8032 Test the li-hack
8033 (The PHP parser relies on Tidy for the hack)
8034 !!options
8035 parsoid=wt2html,wt2wt
8036 !! wikitext
8037 * foo
8038 * <li>li-hack
8039 * {{echo|<li>templated li-hack}}
8040 * <!--foo--> <li> unsupported li-hack with preceding comments
8041
8042 <ul>
8043 <li><li>not a li-hack
8044 </li>
8045 </ul>
8046 !! html+tidy
8047 <ul>
8048 <li>foo</li>
8049 <li>li-hack</li>
8050 <li>templated li-hack</li>
8051 <li>unsupported li-hack with preceding comments</li>
8052 </ul>
8053 <ul>
8054 <li>not a li-hack</li>
8055 </ul>
8056 !!end
8057
8058 !! test
8059 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8060 !! options
8061 parsoid
8062 !! wikitext
8063 # foo
8064 ## bar
8065 * foo
8066 ** bar
8067 : foo
8068 :: bar
8069 !! html
8070 <ol>
8071 <li> foo<ol>
8072 <li> bar</li>
8073 </ol></li>
8074 </ol><ul>
8075 <li> foo<ul>
8076 <li> bar</li>
8077 </ul></li>
8078 </ul><dl>
8079 <dd> foo<dl>
8080 <dd> bar</dd>
8081 </dl></dd>
8082 </dl>
8083 !! end
8084
8085 !! test
8086 Parsoid: Test of whitespace serialization with Templated bullets
8087 !! options
8088 parsoid
8089 !! wikitext
8090 * {{bullet}}
8091 !! html
8092 <ul>
8093 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8094 </ul>
8095 !! end
8096
8097 # ------------------------------------------------------------------------
8098 # The next set of tests are about Parsoid's ability to handle badly nested
8099 # tags (parse, minimize scope of fixup, and roundtrip back)
8100 # ------------------------------------------------------------------------
8101
8102 !! test
8103 Unbalanced closing block tags break a list
8104 (php parser relies on Tidy to fix up)
8105 !! wikitext
8106 <div>
8107 *a</div><div>
8108 *b</div>
8109 !! html+tidy
8110 <div>
8111 <ul>
8112 <li>a</li>
8113 </ul>
8114 </div>
8115 <div>
8116 <ul>
8117 <li>b</li>
8118 </ul>
8119 </div>
8120 !! end
8121
8122 # Parsoid fails this test, but it might be tricky to support properly.
8123 # See bug 68395.
8124 !! test
8125 Unbalanced closing non-block tags don't break a list
8126 (php parser relies on Tidy to fix up)
8127 !! wikitext
8128 <span>
8129 *a</span><span>
8130 *b</span>
8131 !! html/php+tidy
8132 <ul>
8133 <li><span>a</span></li>
8134 <li><span>b</span></li>
8135 </ul>
8136 !! html/parsoid
8137 <span>
8138 <ul>
8139 <li>a<span></span>
8140 </li>
8141 <li>b
8142 </li>
8143 </ul>
8144 </span>
8145 !! end
8146
8147 !! test
8148 Unclosed formatting tags that straddle lists are closed and reopened
8149 (php parser relies on Tidy to fix up)
8150 !! options
8151 parsoid=wt2html,wt2wt,html2html
8152 !! wikitext
8153 # <s> a
8154 # b </s>
8155 !! html/php+tidy
8156 <ol>
8157 <li><s>a</s></li>
8158 <li><s>b</s></li>
8159 </ol>
8160 !! html/parsoid
8161 <ol><li> <s> a</s></li>
8162 <li><s> b </s></li></ol>
8163 !! end
8164
8165 # Parsoid fails this test, but it might be tricky to support properly.
8166 # See bug 68395.
8167 !!test
8168 List embedded in a non-block tag
8169 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8170 !! wikitext
8171 <small>
8172 * foo
8173 </small>
8174 !! html/php+tidy
8175 <ul>
8176 <li><small>foo</small></li>
8177 </ul>
8178 !! html/parsoid
8179 <small>
8180 <ul>
8181 <li> foo</li>
8182 </ul>
8183 </small>
8184 !!end
8185
8186 # This is a bug in the PHP parser + tidy combination.
8187 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8188 # and then fostered out of the table by tidy.)
8189 # We believe the Parsoid output to be correct.
8190 !! test
8191 Table with missing opening <tr> tag
8192 !! options
8193 parsoid=wt2html,wt2wt
8194 !! wikitext
8195 <table>
8196 <td>foo</td>
8197 </tr>
8198 </table>
8199 !! html/php+tidy
8200 <p>&lt;/tr&gt;</p>
8201 <table>
8202 <tr>
8203 <td>foo</td>
8204 </tr>
8205 </table>
8206 !! html/parsoid
8207 <table>
8208 <tr>
8209 <td>foo</td>
8210 </tr>
8211 </table>
8212 !! end
8213
8214 ###
8215 ### Magic Words
8216 ###
8217
8218 # Note that the current date is hard-coded as
8219 # 1970-01-01T00:02:03Z (a Thursday)
8220 # when running parser tests. The timezone is also fixed to GMT, so
8221 # local date will be identical to current date.
8222
8223 !! test
8224 Magic Word: {{CURRENTDAY}}
8225 !! wikitext
8226 {{CURRENTDAY}}
8227 !! html
8228 <p>1
8229 </p>
8230 !! end
8231
8232 !! test
8233 Magic Word: {{CURRENTDAY2}}
8234 !! wikitext
8235 {{CURRENTDAY2}}
8236 !! html
8237 <p>01
8238 </p>
8239 !! end
8240
8241 !! test
8242 Magic Word: {{CURRENTDAYNAME}}
8243 !! wikitext
8244 {{CURRENTDAYNAME}}
8245 !! html
8246 <p>Thursday
8247 </p>
8248 !! end
8249
8250 !! test
8251 Magic Word: {{CURRENTDOW}}
8252 !! wikitext
8253 {{CURRENTDOW}}
8254 !! html
8255 <p>4
8256 </p>
8257 !! end
8258
8259 !! test
8260 Magic Word: {{CURRENTMONTH}}
8261 !! wikitext
8262 {{CURRENTMONTH}}
8263 !! html
8264 <p>01
8265 </p>
8266 !! end
8267
8268 !! test
8269 Magic Word: {{CURRENTMONTH1}}
8270 !! wikitext
8271 {{CURRENTMONTH1}}
8272 !! html
8273 <p>1
8274 </p>
8275 !! end
8276
8277 !! test
8278 Magic Word: {{CURRENTMONTHABBREV}}
8279 !! wikitext
8280 {{CURRENTMONTHABBREV}}
8281 !! html
8282 <p>Jan
8283 </p>
8284 !! end
8285
8286 !! test
8287 Magic Word: {{CURRENTMONTHNAME}}
8288 !! wikitext
8289 {{CURRENTMONTHNAME}}
8290 !! html
8291 <p>January
8292 </p>
8293 !! end
8294
8295 !! test
8296 Magic Word: {{CURRENTMONTHNAMEGEN}}
8297 !! wikitext
8298 {{CURRENTMONTHNAMEGEN}}
8299 !! html
8300 <p>January
8301 </p>
8302 !! end
8303
8304 !! test
8305 Magic Word: {{CURRENTTIME}}
8306 !! wikitext
8307 {{CURRENTTIME}}
8308 !! html
8309 <p>00:02
8310 </p>
8311 !! end
8312
8313 !! test
8314 Magic Word: {{CURRENTHOUR}}
8315 !! wikitext
8316 {{CURRENTHOUR}}
8317 !! html
8318 <p>00
8319 </p>
8320 !! end
8321
8322 !! test
8323 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8324 !! wikitext
8325 {{CURRENTWEEK}}
8326 !! html
8327 <p>1
8328 </p>
8329 !! end
8330
8331 !! test
8332 Magic Word: {{CURRENTYEAR}}
8333 !! wikitext
8334 {{CURRENTYEAR}}
8335 !! html
8336 <p>1970
8337 </p>
8338 !! end
8339
8340 !! test
8341 Magic Word: {{CURRENTTIMESTAMP}}
8342 !! wikitext
8343 {{CURRENTTIMESTAMP}}
8344 !! html
8345 <p>19700101000203
8346 </p>
8347 !! end
8348
8349 !! test
8350 Magic Words LOCAL (UTC)
8351 !! wikitext
8352 * {{LOCALMONTH}}
8353 * {{LOCALMONTH1}}
8354 * {{LOCALMONTHNAME}}
8355 * {{LOCALMONTHNAMEGEN}}
8356 * {{LOCALMONTHABBREV}}
8357 * {{LOCALDAY}}
8358 * {{LOCALDAY2}}
8359 * {{LOCALDAYNAME}}
8360 * {{LOCALYEAR}}
8361 * {{LOCALTIME}}
8362 * {{LOCALHOUR}}
8363 * {{LOCALWEEK}}
8364 * {{LOCALDOW}}
8365 * {{LOCALTIMESTAMP}}
8366 !! html
8367 <ul><li> 01</li>
8368 <li> 1</li>
8369 <li> January</li>
8370 <li> January</li>
8371 <li> Jan</li>
8372 <li> 1</li>
8373 <li> 01</li>
8374 <li> Thursday</li>
8375 <li> 1970</li>
8376 <li> 00:02</li>
8377 <li> 00</li>
8378 <li> 1</li>
8379 <li> 4</li>
8380 <li> 19700101000203</li></ul>
8381
8382 !! end
8383
8384 !! test
8385 Magic Word: {{FULLPAGENAME}}
8386 !! options
8387 title=[[User:Ævar Arnfjörð Bjarmason]]
8388 !! wikitext
8389 {{FULLPAGENAME}}
8390 !! html
8391 <p>User:Ævar Arnfjörð Bjarmason
8392 </p>
8393 !! end
8394
8395 !! test
8396 Magic Word: {{FULLPAGENAMEE}}
8397 !! options
8398 title=[[User:Ævar Arnfjörð Bjarmason]]
8399 !! wikitext
8400 {{FULLPAGENAMEE}}
8401 !! html
8402 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8403 </p>
8404 !! end
8405
8406 !! test
8407 Magic Word: {{TALKSPACE}}
8408 !! options
8409 title=[[User:Ævar Arnfjörð Bjarmason]]
8410 !! wikitext
8411 {{TALKSPACE}}
8412 !! html
8413 <p>User talk
8414 </p>
8415 !! end
8416
8417 !! test
8418 Magic Word: {{TALKSPACE}}, same namespace
8419 !! options
8420 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8421 !! wikitext
8422 {{TALKSPACE}}
8423 !! html
8424 <p>User talk
8425 </p>
8426 !! end
8427
8428 !! test
8429 Magic Word: {{TALKSPACE}}, main namespace
8430 !! options
8431 title=[[Parser Test]]
8432 !! wikitext
8433 {{TALKSPACE}}
8434 !! html
8435 <p>Talk
8436 </p>
8437 !! end
8438
8439 !! test
8440 Magic Word: {{TALKSPACEE}}
8441 !! options
8442 title=[[User:Ævar Arnfjörð Bjarmason]]
8443 !! wikitext
8444 {{TALKSPACEE}}
8445 !! html
8446 <p>User_talk
8447 </p>
8448 !! end
8449
8450 !! test
8451 Magic Word: {{SUBJECTSPACE}}
8452 !! options
8453 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8454 !! wikitext
8455 {{SUBJECTSPACE}}
8456 !! html
8457 <p>User
8458 </p>
8459 !! end
8460
8461 !! test
8462 Magic Word: {{SUBJECTSPACE}}, same namespace
8463 !! options
8464 title=[[User:Ævar Arnfjörð Bjarmason]]
8465 !! wikitext
8466 {{SUBJECTSPACE}}
8467 !! html
8468 <p>User
8469 </p>
8470 !! end
8471
8472 !! test
8473 Magic Word: {{SUBJECTSPACE}}, main namespace
8474 !! options
8475 title=[[Parser Test]]
8476 !! wikitext
8477 {{SUBJECTSPACE}}
8478 !! html
8479
8480 !! end
8481
8482 !! test
8483 Magic Word: {{SUBJECTSPACEE}}
8484 !! options
8485 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8486 !! wikitext
8487 {{SUBJECTSPACEE}}
8488 !! html
8489 <p>User
8490 </p>
8491 !! end
8492
8493 !! test
8494 Magic Word: {{NAMESPACE}}
8495 !! options
8496 title=[[User:Ævar Arnfjörð Bjarmason]]
8497 !! wikitext
8498 {{NAMESPACE}}
8499 !! html
8500 <p>User
8501 </p>
8502 !! end
8503
8504 !! test
8505 Magic Word: {{NAMESPACEE}}
8506 !! options
8507 title=[[User:Ævar Arnfjörð Bjarmason]]
8508 !! wikitext
8509 {{NAMESPACEE}}
8510 !! html
8511 <p>User
8512 </p>
8513 !! end
8514
8515 !! test
8516 Magic Word: {{NAMESPACENUMBER}}
8517 !! options
8518 title=[[User:Ævar Arnfjörð Bjarmason]]
8519 !! wikitext
8520 {{NAMESPACENUMBER}}
8521 !! html
8522 <p>2
8523 </p>
8524 !! end
8525
8526 !! test
8527 Magic Word: {{SUBPAGENAME}}
8528 !! options
8529 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8530 !! wikitext
8531 {{SUBPAGENAME}}
8532 !! html
8533 <p>sub ö
8534 </p>
8535 !! end
8536
8537 !! test
8538 Magic Word: {{SUBPAGENAMEE}}
8539 !! options
8540 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8541 !! wikitext
8542 {{SUBPAGENAMEE}}
8543 !! html
8544 <p>sub_%C3%B6
8545 </p>
8546 !! end
8547
8548 !! test
8549 Magic Word: {{ROOTPAGENAME}}
8550 !! options
8551 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8552 !! wikitext
8553 {{ROOTPAGENAME}}
8554 !! html
8555 <p>Ævar Arnfjörð Bjarmason
8556 </p>
8557 !! end
8558
8559 !! test
8560 Magic Word: {{ROOTPAGENAMEE}}
8561 !! options
8562 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8563 !! wikitext
8564 {{ROOTPAGENAMEE}}
8565 !! html
8566 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8567 </p>
8568 !! end
8569
8570 !! test
8571 Magic Word: {{BASEPAGENAME}}
8572 !! options
8573 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8574 !! wikitext
8575 {{BASEPAGENAME}}
8576 !! html
8577 <p>Ævar Arnfjörð Bjarmason
8578 </p>
8579 !! end
8580
8581 !! test
8582 Magic Word: {{BASEPAGENAMEE}}
8583 !! options
8584 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8585 !! wikitext
8586 {{BASEPAGENAMEE}}
8587 !! html
8588 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8589 </p>
8590 !! end
8591
8592 !! test
8593 Magic Word: {{TALKPAGENAME}}
8594 !! options
8595 title=[[User:Ævar Arnfjörð Bjarmason]]
8596 !! wikitext
8597 {{TALKPAGENAME}}
8598 !! html
8599 <p>User talk:Ævar Arnfjörð Bjarmason
8600 </p>
8601 !! end
8602
8603 !! test
8604 Magic Word: {{TALKPAGENAMEE}}
8605 !! options
8606 title=[[User:Ævar Arnfjörð Bjarmason]]
8607 !! wikitext
8608 {{TALKPAGENAMEE}}
8609 !! html
8610 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8611 </p>
8612 !! end
8613
8614 !! test
8615 Magic Word: {{SUBJECTPAGENAME}}
8616 !! options
8617 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8618 !! wikitext
8619 {{SUBJECTPAGENAME}}
8620 !! html
8621 <p>User:Ævar Arnfjörð Bjarmason
8622 </p>
8623 !! end
8624
8625 !! test
8626 Magic Word: {{SUBJECTPAGENAMEE}}
8627 !! options
8628 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8629 !! wikitext
8630 {{SUBJECTPAGENAMEE}}
8631 !! html
8632 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8633 </p>
8634 !! end
8635
8636 !! test
8637 Magic Word: {{NUMBEROFFILES}}
8638 !! wikitext
8639 {{NUMBEROFFILES}}
8640 !! html
8641 <p>5
8642 </p>
8643 !! end
8644
8645 !! test
8646 Magic Word: {{PAGENAME}}
8647 !! options
8648 title=[[User:Ævar Arnfjörð Bjarmason]]
8649 !! wikitext
8650 {{PAGENAME}}
8651 !! html
8652 <p>Ævar Arnfjörð Bjarmason
8653 </p>
8654 !! end
8655
8656 !! test
8657 Magic Word: {{PAGENAME}} with metacharacters
8658 !! options
8659 title=[['foo & bar = baz']]
8660 !! wikitext
8661 ''{{PAGENAME}}''
8662 !! html/php
8663 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8664 </p>
8665 !! html+tidy
8666 <p><i>'foo &amp; bar = baz'</i></p>
8667 !! end
8668
8669 !! test
8670 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8671 !! options
8672 title=[[*RFC 1234 http://example.com/]]
8673 !! wikitext
8674 {{PAGENAME}}
8675 !! html/php
8676 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8677 </p>
8678 !! html+tidy
8679 <p>*RFC 1234 http://example.com/</p>
8680 !! end
8681
8682 !! test
8683 Magic Word: {{PAGENAMEE}}
8684 !! options
8685 title=[[User:Ævar Arnfjörð Bjarmason]]
8686 !! wikitext
8687 {{PAGENAMEE}}
8688 !! html
8689 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8690 </p>
8691 !! end
8692
8693 !! test
8694 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8695 !! options
8696 title=[[*RFC 1234 http://example.com/]]
8697 !! wikitext
8698 {{PAGENAMEE}}
8699 !! html/php
8700 <p>&#42;RFC_1234_http&#58;//example.com/
8701 </p>
8702 !! html+tidy
8703 <p>*RFC_1234_http://example.com/</p>
8704 !! end
8705
8706 !! test
8707 Magic Word: {{REVISIONID}}
8708 !! wikitext
8709 {{REVISIONID}}
8710 !! html
8711 <p>1337
8712 </p>
8713 !! end
8714
8715 !! test
8716 Magic Word: {{SCRIPTPATH}}
8717 !! wikitext
8718 {{SCRIPTPATH}}
8719 !! html
8720 <p>/
8721 </p>
8722 !! end
8723
8724 !! test
8725 Magic Word: {{STYLEPATH}}
8726 !! wikitext
8727 {{STYLEPATH}}
8728 !! html
8729 <p>/skins
8730 </p>
8731 !! end
8732
8733 !! test
8734 Magic Word: {{SERVER}}
8735 !! wikitext
8736 {{SERVER}}
8737 !! html
8738 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8739 </p>
8740 !! end
8741
8742 !! test
8743 Magic Word: {{SERVERNAME}}
8744 !! wikitext
8745 {{SERVERNAME}}
8746 !! html
8747 <p>example.org
8748 </p>
8749 !! end
8750
8751 !! test
8752 Magic Word: {{SITENAME}}
8753 !! wikitext
8754 {{SITENAME}}
8755 !! html
8756 <p>MediaWiki
8757 </p>
8758 !! end
8759
8760 !! test
8761 Case-sensitive magic words, when cased differently, should just be template transclusions
8762 !! wikitext
8763 {{CurrentMonth}}
8764 {{currentday}}
8765 {{cURreNTweEK}}
8766 {{currentHour}}
8767 !! html
8768 <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>
8769 <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>
8770 <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>
8771 <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>
8772 </p>
8773 !! end
8774
8775 !! test
8776 Case-insensitive magic words should still work with weird casing.
8777 !! wikitext
8778 {{sErVeRNaMe}}
8779 {{LCFirst:AOEU}}
8780 {{ucFIRST:aoeu}}
8781 {{SERver}}
8782 !! html
8783 <p>example.org
8784 aOEU
8785 Aoeu
8786 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8787 </p>
8788 !! end
8789
8790 !! test
8791 Namespace 1 {{ns:1}}
8792 !! wikitext
8793 {{ns:1}}
8794 !! html
8795 <p>Talk
8796 </p>
8797 !! end
8798
8799 !! test
8800 Namespace 1 {{ns:01}}
8801 !! wikitext
8802 {{ns:01}}
8803 !! html
8804 <p>Talk
8805 </p>
8806 !! end
8807
8808 !! test
8809 Namespace 0 {{ns:0}} (bug 4783)
8810 !! wikitext
8811 {{ns:0}}
8812 !! html
8813
8814 !! end
8815
8816 !! test
8817 Namespace 0 {{ns:00}} (bug 4783)
8818 !! wikitext
8819 {{ns:00}}
8820 !! html
8821
8822 !! end
8823
8824 !! test
8825 Namespace -1 {{ns:-1}}
8826 !! wikitext
8827 {{ns:-1}}
8828 !! html
8829 <p>Special
8830 </p>
8831 !! end
8832
8833 !! test
8834 Namespace User {{ns:User}}
8835 !! wikitext
8836 {{ns:User}}
8837 !! html
8838 <p>User
8839 </p>
8840 !! end
8841
8842 !! test
8843 Namespace User talk {{ns:User_talk}}
8844 !! wikitext
8845 {{ns:User_talk}}
8846 !! html
8847 <p>User talk
8848 </p>
8849 !! end
8850
8851 !! test
8852 Namespace User talk {{ns:uSeR tAlK}}
8853 !! wikitext
8854 {{ns:uSeR tAlK}}
8855 !! html
8856 <p>User talk
8857 </p>
8858 !! end
8859
8860 !! test
8861 Namespace File {{ns:File}}
8862 !! wikitext
8863 {{ns:File}}
8864 !! html
8865 <p>File
8866 </p>
8867 !! end
8868
8869 !! test
8870 Namespace File {{ns:Image}}
8871 !! wikitext
8872 {{ns:Image}}
8873 !! html
8874 <p>File
8875 </p>
8876 !! end
8877
8878 !! test
8879 Namespace (lang=de) Benutzer {{ns:User}}
8880 !! options
8881 language=de
8882 !! wikitext
8883 {{ns:User}}
8884 !! html
8885 <p>Benutzer
8886 </p>
8887 !! end
8888
8889 !! test
8890 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8891 !! options
8892 language=de
8893 !! wikitext
8894 {{ns:3}}
8895 !! html
8896 <p>Benutzer Diskussion
8897 </p>
8898 !! end
8899
8900
8901 !! test
8902 Urlencode
8903 !! wikitext
8904 {{urlencode:hi world?!}}
8905 {{urlencode:hi world?!|WIKI}}
8906 {{urlencode:hi world?!|PATH}}
8907 {{urlencode:hi world?!|QUERY}}
8908 !! html
8909 <p>hi+world%3F%21
8910 hi_world%3F!
8911 hi%20world%3F%21
8912 hi+world%3F%21
8913 </p>
8914 !! end
8915
8916 !! test
8917 Magic Word: prioritize type info over data-parsoid
8918 !! options
8919 parsoid=html2wt
8920 !! html
8921 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8922 !! wikitext
8923 __FORCETOC__
8924 !! end
8925
8926 !! test
8927 Magic Word: serialize on separate line (parsoid)
8928 !! options
8929 parsoid=wt2wt,html2wt
8930 !! wikitext
8931 foo
8932 __NOTOC__
8933 bar
8934 !! html
8935 foo<meta property="mw:PageProp/notoc"/>bar
8936 !! end
8937
8938 !! test
8939 Magic Word: rt non-english wikis
8940 !! options
8941 parsoid=wt2wt
8942 language=de
8943 !! wikitext
8944 __NOEDITSECTION__
8945 !! html
8946 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8947 !! end
8948
8949 ###
8950 ### Magic links
8951 ###
8952 !! test
8953 Magic links: internal link to RFC (bug 479)
8954 !! wikitext
8955 [[RFC 123]]
8956 !! html
8957 <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>
8958 </p>
8959 !! end
8960
8961 !! test
8962 Magic links: RFC (bug 479)
8963 !! wikitext
8964 RFC 822
8965 !! html
8966 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8967 </p>
8968 !! end
8969
8970 !! test
8971 Magic links: RFC (bug 65278)
8972 !! wikitext
8973 This is RFC 822 but thisRFC 822 is not RFC 822linked.
8974 !! html
8975 <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.
8976 </p>
8977 !! end
8978
8979 !! test
8980 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
8981 !! wikitext
8982 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
8983 RFC
8984 822
8985 !! html
8986 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8987 RFC
8988 822
8989 </p>
8990 !! end
8991
8992 !! test
8993 Magic links: ISBN (bug 1937)
8994 !! wikitext
8995 ISBN 0-306-40615-2
8996 !! html
8997 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8998 </p>
8999 !! end
9000
9001 !! test
9002 Magic links: ISBN (bug 65278)
9003 !! wikitext
9004 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9005 !! html/php
9006 <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.
9007 </p>
9008 !! html/parsoid
9009 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9010 !! end
9011
9012 !! test
9013 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9014 !! wikitext
9015 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9016 ISBN
9017 9780316098113
9018 ISBN 978
9019 0316098113
9020 !! html
9021 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9022 ISBN
9023 9780316098113
9024 ISBN 978
9025 0316098113
9026 </p>
9027 !! end
9028
9029 !! test
9030 Magic links: PMID incorrectly converts space to underscore
9031 !! wikitext
9032 PMID 1234
9033 !! html
9034 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9035 </p>
9036 !! end
9037
9038 !! test
9039 Magic links: PMID (bug 65278)
9040 !! wikitext
9041 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9042 !! html
9043 <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.
9044 </p>
9045 !! end
9046
9047 !! test
9048 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9049 !! wikitext
9050 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9051 PMID
9052 1234
9053 !! html
9054 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9055 PMID
9056 1234
9057 </p>
9058 !! end
9059
9060 ###
9061 ### Templates
9062 ####
9063
9064 !! test
9065 Nonexistent template
9066 !! wikitext
9067 {{thistemplatedoesnotexist}}
9068 !! html
9069 <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>
9070 </p>
9071 !! end
9072
9073 !! test
9074 Template with invalid target containing tags
9075 !! wikitext
9076 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9077 !! html
9078 <p>{{a<b>b</b>|foo|a=b|a = b}}
9079 </p>
9080 !! end
9081
9082 !! test
9083 Template with invalid target containing unclosed tag
9084 !! wikitext
9085 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9086 !! html
9087 <p>{{a<b>|foo|a=b|a = b}}</b>
9088 </p>
9089 !! end
9090
9091 !! test
9092 Template with invalid target containing wikilink
9093 !! wikitext
9094 {{[[Main Page]]}}
9095 !! html/php
9096 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9097 </p>
9098 !! html/parsoid
9099 <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>
9100 !! end
9101
9102 !! test
9103 Template with just whitespace in it, bug #68421
9104 !! wikitext
9105 {{echo|{{ }}}}
9106 !! html/parsoid
9107 <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>
9108 !! end
9109
9110 !! article
9111 Template:test
9112 !! text
9113 This is a test template
9114 !! endarticle
9115
9116 !! test
9117 Simple template
9118 !! wikitext
9119 {{test}}
9120 !! html
9121 <p>This is a test template
9122 </p>
9123 !! end
9124
9125 !! test
9126 Template with explicit namespace
9127 !! wikitext
9128 {{Template:test}}
9129 !! html
9130 <p>This is a test template
9131 </p>
9132 !! end
9133
9134
9135 !! article
9136 Template:paramtest
9137 !! text
9138 This is a test template with parameter {{{param}}}
9139 !! endarticle
9140
9141 !! test
9142 Template parameter
9143 !! wikitext
9144 {{paramtest|param=foo}}
9145 !! html
9146 <p>This is a test template with parameter foo
9147 </p>
9148 !! end
9149
9150 !! article
9151 Template:paramtestnum
9152 !! text
9153 [[{{{1}}}|{{{2}}}]]
9154 !! endarticle
9155
9156 !! test
9157 Template unnamed parameter
9158 !! wikitext
9159 {{paramtestnum|Main Page|the main page}}
9160 !! html
9161 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9162 </p>
9163 !! end
9164
9165 !! article
9166 Template:templatesimple
9167 !! text
9168 (test)
9169 !! endarticle
9170
9171 !! article
9172 Template:templateredirect
9173 !! text
9174 #redirect [[Template:templatesimple]]
9175 !! endarticle
9176
9177 !! article
9178 Template:templateasargtestnum
9179 !! text
9180 {{{{{1}}}}}
9181 !! endarticle
9182
9183 !! article
9184 Template:templateasargtest
9185 !! text
9186 {{template{{{templ}}}}}
9187 !! endarticle
9188
9189 !! article
9190 Template:templateasargtest2
9191 !! text
9192 {{{{{templ}}}}}
9193 !! endarticle
9194
9195 !! test
9196 Template with template name as unnamed argument
9197 !! wikitext
9198 {{templateasargtestnum|templatesimple}}
9199 !! html
9200 <p>(test)
9201 </p>
9202 !! end
9203
9204 !! test
9205 Template with template name as argument
9206 !! wikitext
9207 {{templateasargtest|templ=simple}}
9208 !! html
9209 <p>(test)
9210 </p>
9211 !! end
9212
9213 !! test
9214 Template with template name as argument (2)
9215 !! wikitext
9216 {{templateasargtest2|templ=templatesimple}}
9217 !! html
9218 <p>(test)
9219 </p>
9220 !! end
9221
9222 !! article
9223 Template:templateasargtestdefault
9224 !! text
9225 {{{{{templ|templatesimple}}}}}
9226 !! endarticle
9227
9228 !! article
9229 Template:templa
9230 !! text
9231 '''templ'''
9232 !! endarticle
9233
9234 !! test
9235 Template with default value
9236 !! wikitext
9237 {{templateasargtestdefault}}
9238 !! html
9239 <p>(test)
9240 </p>
9241 !! end
9242
9243 !! test
9244 Template with default value (value set)
9245 !! wikitext
9246 {{templateasargtestdefault|templ=templa}}
9247 !! html
9248 <p><b>templ</b>
9249 </p>
9250 !! end
9251
9252 !! test
9253 Template redirect
9254 !! wikitext
9255 {{templateredirect}}
9256 !! html
9257 <p>(test)
9258 </p>
9259 !! end
9260
9261 !! test
9262 Template with argument in separate line
9263 !! wikitext
9264 {{ templateasargtest |
9265 templ = simple }}
9266 !! html
9267 <p>(test)
9268 </p>
9269 !! end
9270
9271 !! test
9272 Template with complex template as argument
9273 !! wikitext
9274 {{paramtest|
9275 param ={{ templateasargtest |
9276 templ = simple }}}}
9277 !! html
9278 <p>This is a test template with parameter (test)
9279 </p>
9280 !! end
9281
9282 !! test
9283 Template with thumb image (with link in description)
9284 !! wikitext
9285 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9286 !! html/php
9287 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>
9288
9289 !! html+tidy
9290 <p>This is a test template with parameter</p>
9291 <div class="thumb tright">
9292 <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>
9293 <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>
9294 </div>
9295 </div>
9296 !! html/parsoid
9297 <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>
9298 !! end
9299
9300 !! article
9301 Template:complextemplate
9302 !! text
9303 {{{1}}} {{paramtest|
9304 param ={{{param}}}}}
9305 !! endarticle
9306
9307 !! test
9308 Template with complex arguments
9309 !! wikitext
9310 {{complextemplate|
9311 param ={{ templateasargtest |
9312 templ = simple }}|[[Template:complextemplate|link]]}}
9313 !! html
9314 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9315 </p>
9316 !! end
9317
9318 !! test
9319 BUG 553: link with two variables in a piped link
9320 !! wikitext
9321 {|
9322 |[[{{{1}}}|{{{2}}}]]
9323 |}
9324 !! html
9325 <table>
9326 <tr>
9327 <td>[[{{{1}}}|{{{2}}}]]
9328 </td></tr></table>
9329
9330 !! end
9331
9332 !! test
9333 Magic variable as template parameter
9334 !! wikitext
9335 {{paramtest|param={{SITENAME}}}}
9336 !! html
9337 <p>This is a test template with parameter MediaWiki
9338 </p>
9339 !! end
9340
9341 !! article
9342 Template:linktest
9343 !! text
9344 [[{{{param}}}|link]]
9345 !! endarticle
9346
9347 !! test
9348 Template parameter as link source
9349 !! wikitext
9350 {{linktest|param=Main Page}}
9351 !! html
9352 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9353 </p>
9354 !! end
9355
9356 !!article
9357 Template:paramtest2
9358 !! text
9359 including another template, {{paramtest|param={{{arg}}}}}
9360 !! endarticle
9361
9362 !! test
9363 Template passing argument to another template
9364 !! wikitext
9365 {{paramtest2|arg='hmm'}}
9366 !! html
9367 <p>including another template, This is a test template with parameter 'hmm'
9368 </p>
9369 !! end
9370
9371 !! article
9372 Template:Linktest2
9373 !! text
9374 Main Page
9375 !! endarticle
9376
9377 !! test
9378 Template as link source
9379 !! wikitext
9380 [[{{linktest2}}]]
9381
9382 [[{{linktest2}}|Main Page]]
9383
9384 [[{{linktest2}}]]Page
9385 !! html
9386 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9387 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9388 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9389 </p>
9390 !! end
9391
9392
9393 !! article
9394 Template:loop1
9395 !! text
9396 {{loop2}}
9397 !! endarticle
9398
9399 !! article
9400 Template:loop2
9401 !! text
9402 {{loop1}}
9403 !! endarticle
9404
9405 !! test
9406 Template infinite loop
9407 !! wikitext
9408 {{loop1}}
9409 !! html
9410 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9411 </p>
9412 !! end
9413
9414 !! test
9415 Template from main namespace
9416 !! wikitext
9417 {{:Main Page}}
9418 !! html
9419 <p>blah blah
9420 </p>
9421 !! end
9422
9423 !! article
9424 Template:table
9425 !! text
9426 {|
9427 | 1 || 2
9428 |-
9429 | 3 || 4
9430 |}
9431 !! endarticle
9432
9433 !! test
9434 BUG 529: Template with table, not included at beginning of line
9435 !! wikitext
9436 foo {{table}}
9437 !! html
9438 <p>foo
9439 </p>
9440 <table>
9441 <tr>
9442 <td> 1 </td>
9443 <td> 2
9444 </td></tr>
9445 <tr>
9446 <td> 3 </td>
9447 <td> 4
9448 </td></tr></table>
9449
9450 !! end
9451
9452 !! test
9453 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9454 !! wikitext
9455 foo
9456 {{table}}
9457 !! html
9458 <p>foo
9459 </p>
9460 <table>
9461 <tr>
9462 <td> 1 </td>
9463 <td> 2
9464 </td></tr>
9465 <tr>
9466 <td> 3 </td>
9467 <td> 4
9468 </td></tr></table>
9469
9470 !! end
9471
9472 !! test
9473 BUG 41: Template parameters shown as broken links
9474 !! wikitext
9475 {{{parameter}}}
9476 !! html
9477 <p>{{{parameter}}}
9478 </p>
9479 !! end
9480
9481 !! test
9482 Template with targets containing wikilinks
9483 !! wikitext
9484 {{[[foo]]}}
9485
9486 {{[[{{echo|foo}}]]}}
9487
9488 {{{{echo|[[foo}}]]}}
9489 !! html
9490 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9491 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9492 </p><p>{{[[foo}}]]
9493 </p>
9494 !! end
9495
9496 !! article
9497 Template:MSGNW test
9498 !! text
9499 ''None'' of '''this''' should be
9500 * interpreted
9501 but rather passed unmodified
9502 {{test}}
9503 <gallery>
9504 File:Foobar.jpg
9505 </gallery>
9506 !! endarticle
9507
9508 # hmm, fix this or just deprecate msgnw and document its behavior?
9509 !! test
9510 msgnw keyword
9511 !! wikitext
9512 {{msgnw:MSGNW test}}
9513 !! html
9514 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9515 &#42; interpreted
9516 &#32;but rather passed unmodified
9517 &#123;&#123;test&#125;&#125;
9518 &#60;gallery&#62;
9519 File:Foobar.jpg
9520 &#60;/gallery&#62;
9521 </p>
9522 !! end
9523
9524 !! test
9525 int keyword
9526 !! wikitext
9527 {{int:youhavenewmessages|lots of money|not!}}
9528 !! html
9529 <p>You have lots of money (not!).
9530 </p>
9531 !! end
9532
9533 !! article
9534 Template:Includes
9535 !! text
9536 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9537 !! endarticle
9538
9539 !! test
9540 <includeonly> and <noinclude> being included
9541 !! wikitext
9542 {{Includes}}
9543 !! html
9544 <p>Foobar
9545 </p>
9546 !! end
9547
9548 !! article
9549 Template:Includes2
9550 !! text
9551 <onlyinclude>Foo</onlyinclude>bar
9552 !! endarticle
9553
9554 !! test
9555 <onlyinclude> being included
9556 !! wikitext
9557 {{Includes2}}
9558 !! html
9559 <p>Foo
9560 </p>
9561 !! end
9562
9563
9564 !! article
9565 Template:Includes3
9566 !! text
9567 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9568 !! endarticle
9569
9570 !! test
9571 <onlyinclude> and <includeonly> being included
9572 !! wikitext
9573 {{Includes3}}
9574 !! html
9575 <p>Foo
9576 </p>
9577 !! end
9578
9579 !! test
9580 <includeonly> and <noinclude> on a page
9581 !! wikitext
9582 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9583 !! html
9584 <p>Foozar
9585 </p>
9586 !! end
9587
9588 !! test
9589 Un-closed <noinclude>
9590 !! wikitext
9591 <noinclude>
9592 !! html
9593 !! end
9594
9595 !! test
9596 <onlyinclude> on a page
9597 !! wikitext
9598 <onlyinclude>Foo</onlyinclude>bar
9599 !! html
9600 <p>Foobar
9601 </p>
9602 !! end
9603
9604 !! test
9605 Un-closed <onlyinclude>
9606 !! wikitext
9607 <onlyinclude>
9608 !! html
9609 !! end
9610
9611 !!test
9612 Self-closed noinclude, includeonly, onlyinclude tags
9613 !! wikitext
9614 <noinclude />
9615 <includeonly />
9616 <onlyinclude />
9617 !! html
9618 <p><br />
9619 </p>
9620 !!end
9621
9622 !!test
9623 Unbalanced includeonly and noinclude tags
9624 !! wikitext
9625 {|
9626 |a</noinclude>
9627 |b</noinclude></noinclude>
9628 |c</noinclude></includeonly>
9629 |d</includeonly></includeonly>
9630 |}
9631 !! html
9632 <table>
9633 <tr>
9634 <td>a
9635 </td>
9636 <td>b
9637 </td>
9638 <td>c&lt;/includeonly&gt;
9639 </td>
9640 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9641 </td></tr></table>
9642
9643 !!end
9644
9645 !! article
9646 Template:Includeonly section
9647 !! text
9648 <includeonly>
9649 ==Includeonly section==
9650 </includeonly>
9651 ==Section T-1==
9652 !!endarticle
9653
9654 !! test
9655 Bug 6563: Edit link generation for section shown by <includeonly>
9656 !! wikitext
9657 {{includeonly section}}
9658 !! html
9659 <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>
9660 <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>
9661
9662 !! end
9663
9664 # Uses same input as the contents of [[Template:Includeonly section]]
9665 !! test
9666 Bug 6563: Section extraction for section shown by <includeonly>
9667 !! options
9668 section=T-2
9669 !! wikitext
9670 <includeonly>
9671 ==Includeonly section==
9672 </includeonly>
9673 ==Section T-2==
9674 !! html
9675 ==Section T-2==
9676 !! end
9677
9678 !! test
9679 Bug 6563: Edit link generation for section suppressed by <includeonly>
9680 !! wikitext
9681 <includeonly>
9682 ==Includeonly section==
9683 </includeonly>
9684 ==Section 1==
9685 !! html
9686 <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>
9687
9688 !! end
9689
9690 !! test
9691 Bug 6563: Section extraction for section suppressed by <includeonly>
9692 !! options
9693 section=1
9694 !! wikitext
9695 <includeonly>
9696 ==Includeonly section==
9697 </includeonly>
9698 ==Section 1==
9699 !! html
9700 ==Section 1==
9701 !! end
9702
9703 !! test
9704 Un-closed <includeonly>
9705 !! wikitext
9706 <includeonly>
9707 !! html
9708 !! end
9709
9710 !! test
9711 Includes and comments at SOL
9712 !! wikitext
9713 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9714
9715 <noinclude>
9716 some
9717 </noinclude>* stuff
9718 * here
9719
9720 <includeonly>can have stuff</includeonly>=== here ===
9721
9722 !! html/php
9723 <h2><span class="mw-headline" id="hu">hu</span></h2>
9724 <p>some
9725 </p>
9726 <ul><li> stuff</li>
9727 <li> here</li></ul>
9728 <h3><span class="mw-headline" id="here">here</span></h3>
9729
9730 !! html/parsoid
9731 <!-- 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>
9732
9733 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9734 <p>some</p>
9735 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9736 <li> here</li></ul>
9737
9738 <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>
9739
9740 !! end
9741
9742 # TODO: test with DOM fragment reuse!
9743 !! test
9744 Parsoid: DOM fragment reuse
9745 !! options
9746 parsoid=wt2wt,wt2html
9747 !! wikitext
9748 a{{echo|b<table></table>c}}d
9749
9750 a{{echo|b
9751 <table></table>
9752 c}}d
9753
9754 {{echo|a
9755
9756 <table></table>
9757
9758 b}}
9759 !! html
9760 <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>
9761
9762 <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">
9763 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9764 </span><p about="#mwt2">cd</p>
9765
9766 <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">
9767
9768 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9769
9770 </span><p about="#mwt3">b</p>
9771 !! end
9772
9773 !! test
9774 Parsoid: Merge double tds (bug 50603)
9775 !! options
9776 parsoid
9777 !! wikitext
9778 {|
9779 |{{echo|{{!}} foo}}
9780 |}
9781 !! html
9782 <table><tbody>
9783 <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>
9784 </tbody></table>
9785 !! end
9786
9787 !! test
9788 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9789 !! options
9790 parsoid
9791 !! wikitext
9792 {{echo|<div>}}
9793 {|
9794 |{{echo|{{!}} foo}}
9795 |}
9796 {{echo|</div>}}
9797 !! html
9798 <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}}]}'>
9799 <table><tbody>
9800 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9801 </tbody></table>
9802 </div>
9803 !! end
9804
9805 ###
9806 ### <includeonly> and <noinclude> in attributes
9807 ###
9808 !!test
9809 0. includeonly around the entire attribute
9810 !! wikitext
9811 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9812 !! html
9813 <p><span id="v2">bar</span>
9814 </p>
9815 !!end
9816
9817 !!test
9818 1. includeonly in html attr key
9819 !! wikitext
9820 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9821 !! html
9822 <p><span id="foo">bar</span>
9823 </p>
9824 !!end
9825
9826 !!test
9827 2. includeonly in html attr value
9828 !! wikitext
9829 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9830 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9831 !! html
9832 <p><span id="v1">bar</span>
9833 <span id="v1">bar</span>
9834 </p>
9835 !!end
9836
9837 !!test
9838 3. includeonly in part of an attr value
9839 !! wikitext
9840 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9841 !! html
9842 <p><span style="color:red;">bar</span>
9843 </p>
9844 !!end
9845
9846 !!test
9847 4. includeonly in table attributes
9848 !! wikitext
9849 {|
9850 |- <noinclude>
9851 |-
9852 |a
9853 </noinclude>
9854 |- <includeonly>
9855 |-
9856 |b
9857 </includeonly>
9858 |}
9859 !! html
9860 <table>
9861
9862
9863 <tr>
9864 <td>a
9865 </td></tr>
9866 </table>
9867
9868 !!end
9869
9870 ###
9871 ### Token Stream Patcher tests
9872 ###
9873 ### These tests won't always pass wt2wt and other modes because
9874 ### on serialization, the table will be output on a new line.
9875 ### For now, we are blacklisting them, and using this to test selser.
9876 ###
9877
9878 !!test
9879 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9880 !!options
9881 parsoid=wt2html,wt2wt
9882 !!wikitext
9883 {{echo|}}{| width = '100%'
9884 |foo
9885 |}
9886 !!html/parsoid
9887 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9888 <tbody><tr><td>foo</td></tr>
9889 </tbody></table>
9890 !!end
9891
9892 !!test
9893 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9894 !!options
9895 parsoid=wt2html,wt2wt
9896 !!wikitext
9897 <includeonly>a</includeonly>{| {{{b}}}
9898 |c
9899 |}
9900 !!html/parsoid
9901 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><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}}}":""}}'>
9902 <tbody><tr><td>c</td></tr>
9903 </tbody></table>
9904
9905 !!end
9906
9907 ###
9908 ### Testing parsing of templates where a template arg
9909 ### has the same name as the template itself.
9910 ###
9911
9912 !! article
9913 Template:quote
9914 !! text
9915 {{{quote|{{{1}}}}}}
9916 !! endarticle
9917
9918 !!test
9919 Templates: Template Name/Arg clash: 1. Use of positional param
9920 !! wikitext
9921 {{quote|foo}}
9922 !! html
9923 <p>foo
9924 </p>
9925 !!end
9926
9927 !!test
9928 Templates: Template Name/Arg clash: 2. Use of named param
9929 !! wikitext
9930 {{quote|quote=foo}}
9931 !! html
9932 <p>foo
9933 </p>
9934 !!end
9935
9936 !!test
9937 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9938 !! wikitext
9939 {{quote|quote}}
9940 !! html
9941 <p>quote
9942 </p>
9943 !!end
9944
9945 ###
9946 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9947 ###
9948
9949 !!test
9950 Templates: 1. Simple use
9951 !! wikitext
9952 {{echo|Foo}}
9953 !! html
9954 <p>Foo
9955 </p>
9956 !!end
9957
9958 !!test
9959 Templates: 2. Inside a block tag
9960 !! wikitext
9961 <div>{{echo|Foo}}</div>
9962 <blockquote>{{echo|Foo}}</blockquote>
9963 !! html
9964 <div>Foo</div>
9965 <blockquote>Foo</blockquote>
9966
9967 !! html+tidy
9968 <div>Foo</div>
9969 <blockquote>
9970 <p>Foo</p>
9971 </blockquote>
9972 !!end
9973
9974 !!test
9975 Templates: P-wrapping: 1a. Templates on consecutive lines
9976 !! wikitext
9977 {{echo|Foo}}
9978 {{echo|bar}}
9979 !! html
9980 <p>Foo
9981 bar
9982 </p>
9983 !!end
9984
9985 !!test
9986 Templates: P-wrapping: 1b. Templates on consecutive lines
9987 !! wikitext
9988 Foo
9989
9990 {{echo|bar}}
9991 {{echo|baz}}
9992 !! html
9993 <p>Foo
9994 </p><p>bar
9995 baz
9996 </p>
9997 !!end
9998
9999 !!test
10000 Templates: P-wrapping: 1c. Templates on consecutive lines
10001 !! wikitext
10002 {{echo|Foo}}
10003 {{echo|bar}} <div>baz</div>
10004 !! html
10005 <p>Foo
10006 </p>
10007 bar <div>baz</div>
10008
10009 !! html+tidy
10010 <p>Foo</p>
10011 <p>bar</p>
10012 <div>baz</div>
10013 !! end
10014
10015 !!test
10016 Templates: P-wrapping: 1d. Template preceded by comment-only line
10017 !!options
10018 parsoid
10019 !! wikitext
10020 <!-- foo -->
10021 {{echo|Bar}}
10022 !! html
10023 <!-- foo -->
10024
10025 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10026 !!end
10027
10028 !!test
10029 Templates: Inline Text: 1. Multiple template uses
10030 !! wikitext
10031 {{echo|Foo}}bar{{echo|baz}}
10032 !! html
10033 <p>Foobarbaz
10034 </p>
10035 !!end
10036
10037 !!test
10038 Templates: Inline Text: 2. Back-to-back template uses
10039 !! wikitext
10040 {{echo|Foo}}{{echo|bar}}
10041 !! html
10042 <p>Foobar
10043 </p>
10044 !!end
10045
10046 !!test
10047 Templates: Block Tags: 1. Multiple template uses
10048 !! wikitext
10049 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10050 !! html
10051 <div>Foo</div><div>bar</div><div>baz</div>
10052
10053 !!end
10054
10055 !!test
10056 Templates: Block Tags: 2. Back-to-back template uses
10057 !! wikitext
10058 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10059 !! html
10060 <div>Foo</div><div>bar</div>
10061
10062 !!end
10063
10064 # This is an edge case relating to paragraph wrapping.
10065 !!test
10066 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10067 !! wikitext
10068 {{echo|a
10069 b</p>}}
10070 !! html/parsoid
10071 <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
10072 b</p>
10073 !!end
10074
10075 !!test
10076 Templates: Links: 1. Simple example
10077 !! wikitext
10078 {{echo|[[Foo|bar]]}}
10079 !! html
10080 <p><a href="/wiki/Foo" title="Foo">bar</a>
10081 </p>
10082 !!end
10083
10084 !!test
10085 Templates: Links: 2. Generation of link href
10086 !! wikitext
10087 [[{{echo|Foo}}|bar]]
10088 !! html
10089 <p><a href="/wiki/Foo" title="Foo">bar</a>
10090 </p>
10091 !!end
10092
10093 !!test
10094 Templates: Links: 3. Generation of part of a link href
10095 !! wikitext
10096 [[Fo{{echo|o}}|bar]]
10097
10098 [[Foo{{echo|bar}}]]
10099
10100 [[Foo{{echo|bar}}baz]]
10101
10102 [[Foo{{echo|bar}}|bar]]
10103
10104 [[:Foo{{echo|bar}}]]
10105
10106 [[:Foo{{echo|bar}}|bar]]
10107 !! html
10108 <p><a href="/wiki/Foo" title="Foo">bar</a>
10109 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10110 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10111 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10112 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10113 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10114 </p>
10115 !!end
10116
10117 !!test
10118 Templates: Links: 4. Multiple templates generating link href
10119 !! wikitext
10120 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10121 !! html
10122 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10123 </p>
10124 !!end
10125
10126 !!test
10127 Templates: Links: 5. Generation of link text
10128 !! wikitext
10129 [[Foo|{{echo|bar}}]]
10130 !! html
10131 <p><a href="/wiki/Foo" title="Foo">bar</a>
10132 </p>
10133 !!end
10134
10135 !!test
10136 Templates: Links: 5. Nested templates (only outermost template should be marked)
10137 !! wikitext
10138 {{echo|[[{{echo|Foo}}|bar]]}}
10139 !! html
10140 <p><a href="/wiki/Foo" title="Foo">bar</a>
10141 </p>
10142 !!end
10143
10144 !!test
10145 Templates: HTML Tag: 1. Generation of HTML attr. key
10146 !! wikitext
10147 <div {{echo|style}}="color:red;">foo</div>
10148 !! html
10149 <div style="color:red;">foo</div>
10150
10151 !!end
10152
10153 !!test
10154 Templates: HTML Tag: 2. Generation of HTML attr. value
10155 !! wikitext
10156 <div style={{echo|'color:red;'}}>foo</div>
10157 !! html
10158 <div style="color:red;">foo</div>
10159
10160 !!end
10161
10162 !!test
10163 Templates: HTML Tag: 3. Generation of HTML attr key and value
10164 !! wikitext
10165 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10166 !! html
10167 <div style="color:red;">foo</div>
10168
10169 !!end
10170
10171 !!test
10172 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10173 !! wikitext
10174 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10175 !! html
10176 <div title="This is a long title with just one piece templated">foo</div>
10177
10178 !!end
10179
10180 !!test
10181 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10182 !! wikitext
10183 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10184 !! html
10185 <div title="This is a long title with just one piece templated">foo</div>
10186
10187 !!end
10188
10189 !!test
10190 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10191 !! wikitext
10192 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10193 !! html
10194 <div title="This is a long title with just one piece templated">foo</div>
10195
10196 !!end
10197
10198 # SSS FIXME: While it is great we added support for all this,
10199 # do we want to make this part of the spec? Maybe we want to
10200 # deprecate this kind of usage in the future?
10201 !!test
10202 Templates: HTML Tag: 7. Generation of partial attribute key string
10203 !! wikitext
10204 <div st{{echo|yle}}="color:red;">foo</div>
10205 !! html
10206 <div style="color:red;">foo</div>
10207
10208 !!end
10209
10210 !! test
10211 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10212 !! wikitext
10213 <div {{echo|1=id="v1"}}>bar</div>
10214 !! html
10215 <div id="v1">bar</div>
10216
10217 !!end
10218
10219 !! test
10220 Templates: HTML Tag: 9. Multiple template-generated attributes
10221 !! wikitext
10222 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10223 !! html
10224 <div id="v1" title="foo">bar</div>
10225
10226 !!end
10227
10228 !! test
10229 Templates: Support for templates generating attributes and content
10230 !! wikitext
10231 {| {{mixed_attr_content_template}}
10232 |-
10233 |bar
10234 |}
10235 !! html/php
10236 <table style="color:red;" title="T48811">
10237
10238 <tr>
10239 <td>foo
10240 </td></tr>
10241 <tr>
10242 <td>bar
10243 </td></tr></table>
10244
10245 !! html/parsoid
10246 <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|}"]}'>
10247 <tbody><tr>
10248 <td>foo</td></tr>
10249 <tr>
10250 <td>bar</td></tr>
10251 </tbody></table>
10252 !!end
10253
10254 !!test
10255 Templates: HTML Tables: 1. Generating start of a HTML table
10256 !! wikitext
10257 {{echo|<table><tr><td>foo</td>}}</tr></table>
10258 !! html
10259 <table><tr><td>foo</td></tr></table>
10260
10261 !!end
10262
10263 !!test
10264 Templates: HTML Tables: 2a. Generating middle of a HTML table
10265 !! wikitext
10266 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10267 !! html
10268 <table><tr><td>foo</td></tr></table>
10269
10270 !!end
10271
10272 !!test
10273 Templates: HTML Tables: 2b. Generating middle of a HTML table
10274 !! wikitext
10275 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10276 !! html
10277 <table><tr><td>foo</td></tr></table>
10278
10279 !!end
10280
10281 !!test
10282 Templates: HTML Tables: 3. Generating end of a HTML table
10283 !! wikitext
10284 <table><tr>{{echo|<td>foo</td></tr></table>}}
10285 !! html
10286 <table><tr><td>foo</td></tr></table>
10287
10288 !!end
10289
10290 !!test
10291 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10292 !! wikitext
10293 {{echo|<table>}}<tr><td>foo</td></tr></table>
10294 !! html
10295 <table><tr><td>foo</td></tr></table>
10296
10297 !!end
10298
10299 !!test
10300 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10301 !! wikitext
10302 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10303 !! html
10304 <table><tr><td>foo</td></tr></table>
10305
10306 !!end
10307
10308 !!test
10309 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10310 !! wikitext
10311 <table><tr>{{echo|<td>}}foo</td></tr></table>
10312 !! html
10313 <table><tr><td>foo</td></tr></table>
10314
10315 !!end
10316
10317 !!test
10318 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10319 !! wikitext
10320 <table><tr><td>foo{{echo|</td>}}</tr></table>
10321 !! html
10322 <table><tr><td>foo</td></tr></table>
10323
10324 !!end
10325
10326 !!test
10327 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10328 !! wikitext
10329 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10330 !! html
10331 <table><tr><td>foo</td></tr></table>
10332
10333 !!end
10334
10335 !!test
10336 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10337 !! wikitext
10338 <table><tr><td>foo</td></tr>{{echo|</table>}}
10339 !! html
10340 <table><tr><td>foo</td></tr></table>
10341
10342 !!end
10343
10344 !!test
10345 Templates: HTML Tables: 5. Proper fostering of categories from inside
10346 !!options
10347 parsoid=wt2html,wt2wt
10348 !! wikitext
10349 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10350 <!--Two categories (Bug 50330)-->
10351 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10352 !! html
10353 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10354 <!--Two categories (Bug 50330)-->
10355 <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>
10356 !!end
10357
10358 !!test
10359 Templates: Wiki Tables: 1a. Fostering of entire template content
10360 !! wikitext
10361 {|
10362 {{echo|a}}
10363 |}
10364 !! html
10365 <table>
10366 a
10367 <tr><td></td></tr></table>
10368
10369 !! html+tidy
10370 <p>a</p>
10371 <table>
10372 <tr>
10373 <td></td>
10374 </tr>
10375 </table>
10376 !! end
10377
10378 !!test
10379 Templates: Wiki Tables: 1b. Fostering of entire template content
10380 !! wikitext
10381 {|
10382 {{echo|<div>}}
10383 foo
10384 {{echo|</div>}}
10385 |}
10386 !! html
10387 <table>
10388 <div>
10389 <p>foo
10390 </p>
10391 </div>
10392 <tr><td></td></tr></table>
10393
10394 !! html+tidy
10395 <div>
10396 <p>foo</p>
10397 </div>
10398 <table>
10399 <tr>
10400 <td></td>
10401 </tr>
10402 </table>
10403 !! end
10404
10405 !!test
10406 Templates: Wiki Tables: 2. Fostering of partial template content
10407 !! wikitext
10408 {|
10409 {{echo|a
10410 <div>b</div>}}
10411 |}
10412 !! html
10413 <table>
10414 a
10415 <div>b</div>
10416 <tr><td></td></tr></table>
10417
10418 !! html+tidy
10419 <p>a</p>
10420 <div>b</div>
10421 <table>
10422 <tr>
10423 <td></td>
10424 </tr>
10425 </table>
10426 !! end
10427
10428 !!test
10429 Templates: Wiki Tables: 3. td-content via multiple templates
10430 !! wikitext
10431 {|
10432 {{echo|{{pipe}}a}}{{echo|b}}
10433 |}
10434 !! html
10435 <table>
10436 <tr>
10437 <td>ab
10438 </td></tr></table>
10439
10440 !!end
10441
10442 !!test
10443 Templates: Wiki Tables: 4. Templated tags, no content
10444 !! wikitext
10445 {{tbl-start}}
10446 {{tbl-end}}
10447 !! html
10448 <table>
10449 <tr><td></td></tr></table>
10450
10451 !!end
10452
10453 !!test
10454 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10455 !! wikitext
10456 {{tbl-start}}
10457 |foo
10458 {{tbl-end}}
10459 !! html
10460 <table>
10461 <tr>
10462 <td>foo
10463 </td></tr></table>
10464
10465 !!end
10466
10467 !!test
10468 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10469 !! wikitext
10470 {{tbl-start}}
10471 {{!}}foo
10472 {{tbl-end}}
10473 !! html
10474 <table>
10475 <tr>
10476 <td>foo
10477 </td></tr></table>
10478
10479 !!end
10480
10481 !!test
10482 Templates: Lists: Multi-line list-items via templates
10483 !! wikitext
10484 *{{echo|a {{nonexistent|
10485 unused}}}}
10486 *{{echo|b {{nonexistent|
10487 unused}}}}
10488 !! html
10489 <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>
10490 <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>
10491
10492 !!end
10493
10494 !!test
10495 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10496 !! wikitext
10497 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10498 !! html
10499 <p><i>ab</i>c<i>d</i>e
10500 </p>
10501 !!end
10502
10503 !!test
10504 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10505 (PHP parser generates misnested html)
10506 !! wikitext
10507 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10508 !! html/parsoid
10509 <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>
10510 !!end
10511
10512 !!test
10513 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10514 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10515 !! options
10516 parsoid=wt2html,wt2wt
10517 !! wikitext
10518 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10519 !! html
10520 <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>
10521 <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>
10522 <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>
10523 !!end
10524
10525 !!test
10526 Templates: Ugly nesting: 4. Divs opened/closed across templates
10527 !! wikitext
10528 a<div>b{{echo|c</div>d}}e
10529 !! html
10530 a<div>bc</div>de
10531
10532 !! html+tidy
10533 <p>a</p>
10534 <div>bc</div>
10535 <p>de</p>
10536 !! end
10537
10538 !!test
10539 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10540 (Parsoid-centric)
10541 !! options
10542 parsoid
10543 !! wikitext
10544 {|
10545 |{{echo|foo</table>}}
10546 |bar
10547 |}
10548 !! html
10549 <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|}"]}'>
10550
10551 <tbody>
10552 <tr>
10553 <td>foo</td></tr></tbody></table><span about="#mwt1">
10554 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10555 |}</span>
10556 !!end
10557
10558 !!test
10559 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10560 (Parsoid-centric)
10561 !! options
10562 parsoid
10563 !! wikitext
10564 <table>
10565 <tr>
10566 <td>
10567 <table>
10568 <tr>
10569 <td>1. {{echo|foo </table>}}</td>
10570 <td> bar </td>
10571 <td>2. {{echo|baz </table>}}</td>
10572 </tr>
10573 <tr>
10574 <td>abc</td>
10575 </tr>
10576 </table>
10577 </td>
10578 </tr>
10579 <tr>
10580 <td>xyz</td>
10581 </tr>
10582 </table>
10583 !! html
10584 <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>"]}'>
10585 <tbody><tr>
10586 <td>
10587 <table>
10588 <tbody><tr>
10589 <td>1. foo </td></tr></tbody></table></td>
10590 <td> bar </td>
10591 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10592 </span><span about="#mwt2">
10593 </span><span about="#mwt2">
10594 </span><span about="#mwt2">abc</span><span about="#mwt2">
10595 </span><span about="#mwt2">
10596 </span><span about="#mwt2">
10597 </span><span about="#mwt2">
10598 </span><span about="#mwt2">
10599 </span><span about="#mwt2">
10600 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10601 </span><span about="#mwt2">
10602 </span>
10603 !!end
10604
10605 !! test
10606 Templates: Ugly templates: 3. newline-only template parameter
10607 !! wikitext
10608 foo {{echo|
10609 }}
10610 !! html
10611 <p>foo
10612 </p>
10613 !! end
10614
10615 # This looks like a bug: a single newline triggers p/br for some reason.
10616 !! test
10617 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10618 !! wikitext
10619 {{echo|
10620 }}
10621 !! html
10622 <p><br />
10623 </p>
10624 !! end
10625
10626 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10627 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10628 !! test
10629 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10630 !! wikitext
10631 {{echo|<table>}}
10632 {{echo|<div>foo}}
10633 {{echo|</table>}}
10634 !! html/parsoid
10635 <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
10636 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10637 </table>
10638 !! end
10639
10640 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10641 # that are "identical" and generate nesting cycles in the algorithm
10642 !! test
10643 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10644 !! wikitext
10645 {{echo|<table><tr><td><table>}}
10646 {{echo|<div>}}
10647 {{echo|</div>}}
10648 !! html/parsoid
10649 <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"}'>
10650 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10651 </table></td></tr></tbody></table>
10652 !! end
10653
10654 !!test
10655 Parser Functions: 1. Simple example
10656 !! wikitext
10657 {{uc:foo}}
10658 !! html
10659 <p>FOO
10660 </p>
10661 !!end
10662
10663 !!test
10664 Parser Functions: 2. Nested use (only outermost should be marked up)
10665 !! wikitext
10666 {{uc:{{lc:FOO}}}}
10667 !! html
10668 <p>FOO
10669 </p>
10670 !!end
10671
10672 ###
10673 ### Pre-save transform tests
10674 ###
10675 !! test
10676 pre-save transform: subst:
10677 !! options
10678 PST
10679 !! wikitext
10680 {{subst:test}}
10681 !! html
10682 This is a test template
10683 !! end
10684
10685 !! test
10686 pre-save transform: normal template
10687 !! options
10688 PST
10689 !! wikitext
10690 {{test}}
10691 !! html
10692 {{test}}
10693 !! end
10694
10695 !! test
10696 pre-save transform: nonexistent template
10697 !! options
10698 PST
10699 !! wikitext
10700 {{thistemplatedoesnotexist}}
10701 !! html
10702 {{thistemplatedoesnotexist}}
10703 !! end
10704
10705
10706 !! test
10707 pre-save transform: subst magic variables
10708 !! options
10709 PST
10710 !! wikitext
10711 {{subst:SITENAME}}
10712 !! html
10713 MediaWiki
10714 !! end
10715
10716 # This is bug 89, which I fixed. -- wtm
10717 !! test
10718 pre-save transform: subst: templates with parameters
10719 !! options
10720 pst
10721 !! wikitext
10722 {{subst:paramtest|param="something else"}}
10723 !! html
10724 This is a test template with parameter "something else"
10725 !! end
10726
10727 !! article
10728 Template:nowikitest
10729 !! text
10730 <nowiki>'''not wiki'''</nowiki>
10731 !! endarticle
10732
10733 !! test
10734 pre-save transform: nowiki in subst (bug 1188)
10735 !! options
10736 pst
10737 !! wikitext
10738 {{subst:nowikitest}}
10739 !! html
10740 <nowiki>'''not wiki'''</nowiki>
10741 !! end
10742
10743
10744 !! article
10745 Template:commenttest
10746 !! text
10747 This template has <!-- a comment --> in it.
10748 !! endarticle
10749
10750 !! test
10751 pre-save transform: comment in subst (bug 1936)
10752 !! options
10753 pst
10754 !! wikitext
10755 {{subst:commenttest}}
10756 !! html
10757 This template has <!-- a comment --> in it.
10758 !! end
10759
10760 !! test
10761 pre-save transform: unclosed tag
10762 !! options
10763 pst noxml
10764 !! wikitext
10765 <nowiki>'''not wiki'''
10766 !! html
10767 <nowiki>'''not wiki'''
10768 !! end
10769
10770 !! test
10771 pre-save transform: mixed tag case
10772 !! options
10773 pst noxml
10774 !! wikitext
10775 <NOwiki>'''not wiki'''</noWIKI>
10776 !! html
10777 <NOwiki>'''not wiki'''</noWIKI>
10778 !! end
10779
10780 !! test
10781 pre-save transform: unclosed comment in <nowiki>
10782 !! options
10783 pst noxml
10784 !! wikitext
10785 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10786 !! html
10787 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10788 !!end
10789
10790 # Leading @ in this template definition works around a limitation
10791 # in parsoid's parserTests which otherwise strips the <span> from the
10792 # result (confusing it for a template wrapper)
10793 !! article
10794 Template:dangerous
10795 !!text
10796 @<span onmouseover="alert('crap')">Oh no</span>
10797 !!endarticle
10798
10799 !!test
10800 (confirming safety of fix for subst bug 1936)
10801 !! wikitext
10802 {{Template:dangerous}}
10803 !! html
10804 <p>@<span>Oh no</span>
10805 </p>
10806 !! end
10807
10808 !! test
10809 pre-save transform: comment containing gallery (bug 5024)
10810 !! options
10811 pst
10812 !! wikitext
10813 <!-- <gallery>data</gallery> -->
10814 !! html
10815 <!-- <gallery>data</gallery> -->
10816 !!end
10817
10818 !! test
10819 pre-save transform: comment containing extension
10820 !! options
10821 pst
10822 !! wikitext
10823 <!-- <tag>data</tag> -->
10824 !! html
10825 <!-- <tag>data</tag> -->
10826 !!end
10827
10828 !! test
10829 pre-save transform: comment containing nowiki
10830 !! options
10831 pst
10832 !! wikitext
10833 <!-- <nowiki>data</nowiki> -->
10834 !! html
10835 <!-- <nowiki>data</nowiki> -->
10836 !!end
10837
10838 !! test
10839 pre-save transform: <noinclude> in subst (bug 3298)
10840 !! options
10841 pst
10842 !! wikitext
10843 {{subst:Includes}}
10844 !! html
10845 Foobar
10846 !! end
10847
10848 !! test
10849 pre-save transform: <onlyinclude> in subst (bug 3298)
10850 !! options
10851 pst
10852 !! wikitext
10853 {{subst:Includes2}}
10854 !! html
10855 Foo
10856 !! end
10857
10858 !! article
10859 Template:SubstTest
10860 !!text
10861 {{<includeonly>subst:</includeonly>Includes}}
10862 !! endarticle
10863
10864 !! article
10865 Template:SafeSubstTest
10866 !! text
10867 {{<includeonly>safesubst:</includeonly>Includes}}
10868 !! endarticle
10869
10870 !! test
10871 bug 22297: safesubst: works during PST
10872 !! options
10873 pst
10874 !! wikitext
10875 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10876 !! html
10877 FoobarFoobar
10878 !! end
10879
10880 !! test
10881 bug 22297: safesubst: works during normal parse
10882 !! wikitext
10883 {{SafeSubstTest}}
10884 !! html
10885 <p>Foobar
10886 </p>
10887 !! end
10888
10889 !! test
10890 subst: does not work during normal parse
10891 !! wikitext
10892 {{SubstTest}}
10893 !! html
10894 <p>{{subst:Includes}}
10895 </p>
10896 !! end
10897
10898 !! test
10899 pre-save transform: context links ("pipe trick")
10900 !! options
10901 pst
10902 !! wikitext
10903 [[Article (context)|]]
10904 [[Bar:Article|]]
10905 [[:Bar:Article|]]
10906 [[Bar:Article (context)|]]
10907 [[:Bar:Article (context)|]]
10908 [[|Article]]
10909 [[|Article (context)]]
10910 [[Bar:X (Y) Z|]]
10911 [[:Bar:X (Y) Z|]]
10912 !! html
10913 [[Article (context)|Article]]
10914 [[Bar:Article|Article]]
10915 [[:Bar:Article|Article]]
10916 [[Bar:Article (context)|Article]]
10917 [[:Bar:Article (context)|Article]]
10918 [[Article]]
10919 [[Article (context)]]
10920 [[Bar:X (Y) Z|X (Y) Z]]
10921 [[:Bar:X (Y) Z|X (Y) Z]]
10922 !! end
10923
10924 !! test
10925 pre-save transform: context links ("pipe trick") with interwiki prefix
10926 !! options
10927 pst
10928 !! wikitext
10929 [[interwiki:Article|]]
10930 [[:interwiki:Article|]]
10931 [[interwiki:Bar:Article|]]
10932 [[:interwiki:Bar:Article|]]
10933 !! html
10934 [[interwiki:Article|Article]]
10935 [[:interwiki:Article|Article]]
10936 [[interwiki:Bar:Article|Bar:Article]]
10937 [[:interwiki:Bar:Article|Bar:Article]]
10938 !! end
10939
10940 !! test
10941 pre-save transform: context links ("pipe trick") with parens in title
10942 !! options
10943 pst title=[[Somearticle (context)]]
10944 !! wikitext
10945 [[|Article]]
10946 !! html
10947 [[Article (context)|Article]]
10948 !! end
10949
10950 !! test
10951 pre-save transform: context links ("pipe trick") with comma in title
10952 !! options
10953 pst title=[[Someplace, Somewhere]]
10954 !! wikitext
10955 [[|Otherplace]]
10956 [[Otherplace, Elsewhere|]]
10957 [[Otherplace, Elsewhere, Anywhere|]]
10958 !! html
10959 [[Otherplace, Somewhere|Otherplace]]
10960 [[Otherplace, Elsewhere|Otherplace]]
10961 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10962 !! end
10963
10964 !! test
10965 pre-save transform: context links ("pipe trick") with parens and comma
10966 !! options
10967 pst title=[[Someplace (IGNORED), Somewhere]]
10968 !! wikitext
10969 [[|Otherplace]]
10970 [[Otherplace (place), Elsewhere|]]
10971 !! html
10972 [[Otherplace, Somewhere|Otherplace]]
10973 [[Otherplace (place), Elsewhere|Otherplace]]
10974 !! end
10975
10976 !! test
10977 pre-save transform: context links ("pipe trick") with comma and parens
10978 !! options
10979 pst title=[[Who, me? (context)]]
10980 !! wikitext
10981 [[|Yes, you.]]
10982 [[Me, Myself, and I (1937 song)|]]
10983 !! html
10984 [[Yes, you. (context)|Yes, you.]]
10985 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10986 !! end
10987
10988 !! test
10989 pre-save transform: context links ("pipe trick") with namespace
10990 !! options
10991 pst title=[[Ns:Somearticle]]
10992 !! wikitext
10993 [[|Article]]
10994 !! html
10995 [[Ns:Article|Article]]
10996 !! end
10997
10998 !! test
10999 pre-save transform: context links ("pipe trick") with namespace and parens
11000 !! options
11001 pst title=[[Ns:Somearticle (context)]]
11002 !! wikitext
11003 [[|Article]]
11004 !! html
11005 [[Ns:Article (context)|Article]]
11006 !! end
11007
11008 !! test
11009 pre-save transform: context links ("pipe trick") with namespace and comma
11010 !! options
11011 pst title=[[Ns:Somearticle, Context, Whatever]]
11012 !! wikitext
11013 [[|Article]]
11014 !! html
11015 [[Ns:Article, Context, Whatever|Article]]
11016 !! end
11017
11018 !! test
11019 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11020 !! options
11021 pst title=[[Ns:Somearticle, Context (context)]]
11022 !! wikitext
11023 [[|Article]]
11024 !! html
11025 [[Ns:Article (context)|Article]]
11026 !! end
11027
11028 !! test
11029 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11030 !! options
11031 pst title=[[Ns:Somearticle (IGNORED), Context]]
11032 !! wikitext
11033 [[|Article]]
11034 !! html
11035 [[Ns:Article, Context|Article]]
11036 !! end
11037
11038 !! test
11039 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11040 !! options
11041 pst
11042 !! wikitext
11043 [[Article(context)|]]
11044 [[Bar:Article(context)|]]
11045 [[:Bar:Article(context)|]]
11046 [[|Article(context)]]
11047 [[Bar:X(Y)Z|]]
11048 [[:Bar:X(Y)Z|]]
11049 !! html
11050 [[Article(context)|Article]]
11051 [[Bar:Article(context)|Article]]
11052 [[:Bar:Article(context)|Article]]
11053 [[Article(context)]]
11054 [[Bar:X(Y)Z|X(Y)Z]]
11055 [[:Bar:X(Y)Z|X(Y)Z]]
11056 !! end
11057
11058 !! test
11059 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11060 !! options
11061 pst
11062 !! wikitext
11063 [[Article (context)|]]
11064 [[Bar:Article (context)|]]
11065 [[:Bar:Article (context)|]]
11066 [[|Article (context)]]
11067 [[Bar:X (Y) Z|]]
11068 [[:Bar:X (Y) Z|]]
11069 !! html
11070 [[Article (context)|Article]]
11071 [[Bar:Article (context)|Article]]
11072 [[:Bar:Article (context)|Article]]
11073 [[Article (context)]]
11074 [[Bar:X (Y) Z|X (Y) Z]]
11075 [[:Bar:X (Y) Z|X (Y) Z]]
11076 !! end
11077
11078 !! test
11079 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11080 !! options
11081 pst
11082 !! wikitext
11083 [[Article(context)|]]
11084 [[Bar:Article(context)|]]
11085 [[:Bar:Article(context)|]]
11086 [[|Article(context)]]
11087 [[Bar:X(Y)Z|]]
11088 [[:Bar:X(Y)Z|]]
11089 !! html
11090 [[Article(context)|Article]]
11091 [[Bar:Article(context)|Article]]
11092 [[:Bar:Article(context)|Article]]
11093 [[Article(context)]]
11094 [[Bar:X(Y)Z|X(Y)Z]]
11095 [[:Bar:X(Y)Z|X(Y)Z]]
11096 !! end
11097
11098 !! test
11099 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11100 !! options
11101 pst
11102 !! wikitext
11103 [[Article (context), context|]]
11104 [[Article (context),context|]]
11105 [[Bar:Article (context), context|]]
11106 [[Bar:Article (context),context|]]
11107 [[:Bar:Article (context), context|]]
11108 [[:Bar:Article (context),context|]]
11109 !! html
11110 [[Article (context), context|Article]]
11111 [[Article (context),context|Article]]
11112 [[Bar:Article (context), context|Article]]
11113 [[Bar:Article (context),context|Article]]
11114 [[:Bar:Article (context), context|Article]]
11115 [[:Bar:Article (context),context|Article]]
11116 !! end
11117
11118 !! test
11119 pre-save transform: trim trailing empty lines
11120 !! options
11121 pst
11122 !! wikitext
11123 Empty lines are trimmed
11124
11125
11126
11127
11128 !! html
11129 Empty lines are trimmed
11130 !! end
11131
11132 !! test
11133 pre-save transform: Signature expansion
11134 !! options
11135 pst
11136 !! wikitext
11137 * ~~~
11138 * <noinclude>~~~</noinclude>
11139 * <includeonly>~~~</includeonly>
11140 * <onlyinclude>~~~</onlyinclude>
11141 !! html
11142 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11143 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11144 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11145 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11146 !! end
11147
11148
11149 !! test
11150 pre-save transform: Signature expansion in nowiki tags (bug 93)
11151 !! options
11152 pst disabled
11153 !! wikitext
11154 Shall not expand:
11155
11156 <nowiki>~~~~</nowiki>
11157
11158 <includeonly><nowiki>~~~~</nowiki></includeonly>
11159
11160 <noinclude><nowiki>~~~~</nowiki></noinclude>
11161
11162 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11163
11164 {{subst:Foo}} shall be converted to FOO
11165
11166 As well as inside noinclude/onlyinclude
11167 <noinclude>{{subst:Foo}}</noinclude>
11168 <onlyinclude>{{subst:Foo}}</onlyinclude>
11169
11170 But not inside includeonly
11171 <includeonly>{{subst:Foo}}</includeonly>
11172 !! html
11173 Shall not expand:
11174
11175 <nowiki>~~~~</nowiki>
11176
11177 <includeonly><nowiki>~~~~</nowiki></includeonly>
11178
11179 <noinclude><nowiki>~~~~</nowiki></noinclude>
11180
11181 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11182
11183 FOO shall be converted to FOO
11184
11185 As well as inside noinclude/onlyinclude
11186 <noinclude>FOO</noinclude>
11187 <onlyinclude>FOO</onlyinclude>
11188
11189 But not inside includeonly
11190 <includeonly>{{subst:Foo}}</includeonly>
11191 !! end
11192
11193 !! test
11194 Parsoid: Recognize nowiki with trailing space in tags
11195 !! options
11196 parsoid=wt2html
11197 !! wikitext
11198 <nowiki ><div>[[foo]]</nowiki >
11199
11200 a<nowiki / >b
11201
11202 c<nowiki />d
11203
11204 e<nowiki/ >f
11205 !! html
11206 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11207 <p>ab</p>
11208 <p>cd</p>
11209 <p>ef</p>
11210 !! end
11211
11212 !! test
11213 Parsoid: Recognize nowiki with odd capitalization
11214 !! options
11215 parsoid=wt2html
11216 !! wikitext
11217 <noWikI ><div>[[foo]]</Nowiki >
11218 !! html
11219 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11220 !! end
11221
11222
11223 !! test
11224 Parsoid: Escape nowiki with trailing space in tags
11225 !! options
11226 parsoid=html2wt
11227 !! html
11228 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11229 <p>a&lt;nowiki /&gt;b</p>
11230 <p>c&lt;nowiki/ &gt;d</p>
11231 !! wikitext
11232 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11233
11234 a&lt;nowiki /&gt;b
11235
11236 c&lt;nowiki/ &gt;d
11237 !! end
11238
11239 !! test
11240 Parsoid: Escape weird noWikI capitalizations
11241 !! options
11242 parsoid=html2wt
11243 !! html
11244 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11245 !! wikitext
11246 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11247 !! end
11248
11249 ###
11250 ### Message transform tests
11251 ###
11252 !! test
11253 message transform: magic variables
11254 !! options
11255 msg
11256 !! wikitext
11257 {{SITENAME}}
11258 !! html
11259 MediaWiki
11260 !! end
11261
11262 !! test
11263 message transform: should not transform wiki markup
11264 !! options
11265 msg
11266 !! wikitext
11267 ''test''
11268 !! html
11269 ''test''
11270 !! end
11271
11272 !! test
11273 message transform: <noinclude> in transcluded template (bug 4926)
11274 !! options
11275 msg
11276 !! wikitext
11277 {{Includes}}
11278 !! html
11279 Foobar
11280 !! end
11281
11282 !! test
11283 message transform: <onlyinclude> in transcluded template (bug 4926)
11284 !! options
11285 msg
11286 !! wikitext
11287 {{Includes2}}
11288 !! html
11289 Foo
11290 !! end
11291
11292 !! test
11293 {{#special:}} page name, known
11294 !! options
11295 msg
11296 !! wikitext
11297 {{#special:Recentchanges}}
11298 !! html
11299 Special:RecentChanges
11300 !! end
11301
11302 !! test
11303 {{#special:}} page name with subpage, known
11304 !! options
11305 msg
11306 !! wikitext
11307 {{#special:Recentchanges/param}}
11308 !! html
11309 Special:RecentChanges/param
11310 !! end
11311
11312 !! test
11313 {{#special:}} page name, unknown
11314 !! options
11315 msg
11316 !! wikitext
11317 {{#special:foobar nonexistent}}
11318 !! html
11319 Special:Foobar nonexistent
11320 !! end
11321
11322 !! test
11323 {{#speciale:}} page name, known
11324 !! options
11325 msg
11326 !! wikitext
11327 {{#speciale:Recentchanges}}
11328 !! html
11329 Special:RecentChanges
11330 !! end
11331
11332 !! test
11333 {{#speciale:}} page name with subpage, known
11334 !! options
11335 msg
11336 !! wikitext
11337 {{#speciale:Recentchanges/param}}
11338 !! html
11339 Special:RecentChanges/param
11340 !! end
11341
11342 !! test
11343 {{#speciale:}} page name, unknown
11344 !! options
11345 msg
11346 !! wikitext
11347 {{#speciale:foobar nonexistent}}
11348 !! html
11349 Special:Foobar_nonexistent
11350 !! end
11351
11352 ###
11353 ### Images
11354 ###
11355 ### For Parsoid-specific tests, see
11356 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11357
11358 !! test
11359 Simple image
11360 !! options
11361 parsoid=wt2html,wt2wt,html2html
11362 !! wikitext
11363 [[Image:foobar.jpg]]
11364 !! html/php
11365 <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>
11366 </p>
11367 !! html/parsoid
11368 <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" height="220" width="1941"></a></span></p>
11369 !! end
11370
11371 !! test
11372 Simple image (using File: namespace, now canonical)
11373 !! wikitext
11374 [[File:Foobar.jpg]]
11375 !! html/php
11376 <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>
11377 </p>
11378 !! html/parsoid
11379 <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" height="220" width="1941"></a></span></p>
11380 !! end
11381
11382 !! test
11383 Right-aligned image
11384 !! wikitext
11385 [[File:Foobar.jpg|right]]
11386 !! html/php
11387 <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>
11388
11389 !! html/parsoid
11390 <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" height="220" width="1941"></a></figure>
11391 !! end
11392
11393 !! test
11394 Image with caption
11395 !! wikitext
11396 [[File:Foobar.jpg|right|Caption text]]
11397 !! html/php
11398 <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>
11399
11400 !! html/parsoid
11401 <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" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11402 !! end
11403
11404 !! test
11405 Image with caption, bug 53312 #1
11406 !! wikitext
11407 [[File:Foobar.jpg|right|Caption page stuff]]
11408 !! html/php
11409 <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>
11410
11411 !! html/parsoid
11412 <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" height="220" width="1941"></a><figcaption>Caption page stuff</figcaption></figure>
11413 !! end
11414
11415 !! test
11416 Image with caption, bug 53312 #2
11417 !! wikitext
11418 [[File:Foobar.jpg|right|Caption page=]]
11419 !! html/php
11420 <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>
11421
11422 !! html/parsoid
11423 <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" height="220" width="1941"></a><figcaption>Caption page=</figcaption></figure>
11424 !! end
11425
11426 !! test
11427 Image with caption, bug 53312 #3
11428 !! wikitext
11429 [[File:Foobar.jpg|right|Caption page=stuff]]
11430 !! html/php
11431 <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>
11432
11433 !! html/parsoid
11434 <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" height="220" width="1941"></a><figcaption>Caption page=stuff</figcaption></figure>
11435 !! end
11436
11437 !! test
11438 Allow empty links in image captions (Bug 60753)
11439 !! options
11440 thumbsize=220
11441 !! wikitext
11442 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11443 [[]]
11444 [[Link2]]
11445 ]]
11446 !! html/php
11447 <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>
11448
11449 !! html/parsoid
11450 <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" 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>
11451 [[]]
11452 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11453 </figcaption></figure>
11454 !! end
11455
11456 !! test
11457 Titles in unlinked images (T23454)
11458 !! wikitext
11459 [[File:Foobar.jpg|link=|stuff]]
11460 !! html/php
11461 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11462 </p>
11463 !! end
11464
11465 !! test
11466 Link with empty target
11467 !! wikitext
11468 [[]]
11469 !! html
11470 <p>[[]]
11471 </p>
11472 !! end
11473
11474 !! test
11475 Image with link trail
11476 !! wikitext
11477 Linktrails should not work for images: [[File:Foobar.jpg]]s
11478 !! html/php
11479 <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
11480 </p>
11481 !! html/parsoid
11482 <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" height="220" width="1941"/></a></span>s</p>
11483 !! end
11484
11485 !! test
11486 Image with empty attribute
11487 !! options
11488 parsoid=wt2html,wt2wt,html2html
11489 !! wikitext
11490 [[File:Foobar.jpg|right||Caption text]]
11491 !! html/php
11492 <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>
11493
11494 !! html/parsoid
11495 <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" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11496 !! end
11497
11498 !! test
11499 1. Block image with individual attributes from templates
11500 !! wikitext
11501 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11502 !! html/php
11503 <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>
11504
11505 !! html/parsoid
11506 <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" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11507 !! end
11508
11509 !! test
11510 2. Block Image with individual attributes from templates
11511 !! wikitext
11512 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11513 !! html/php
11514 <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>
11515
11516 !! html/parsoid
11517 <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" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11518 !! end
11519
11520 !! test
11521 3. Inline image with individual attributes from templates
11522 !! wikitext
11523 [[File:Foobar.jpg|{{echo|50px}}]]
11524 !! html/php
11525 <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>
11526 </p>
11527 !! html/parsoid
11528 <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" height="6" width="50"/></a></span></p>
11529 !! end
11530
11531 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11532 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11533 !! test
11534 Image with multiple attributes from the same template
11535 !! wikitext
11536 [[File:Foobar.jpg|{{image_attribs}}]]
11537 !! html/php
11538 <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>
11539
11540 !! html/parsoid
11541 <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" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11542 !! end
11543
11544 !! test
11545 Image with link tails
11546 !! options
11547 thumbsize=220
11548 !! wikitext
11549 123[[File:Foobar.jpg]]456
11550 123[[File:Foobar.jpg|right]]456
11551 123[[File:Foobar.jpg|thumb]]456
11552 !! html/php
11553 <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
11554 </p>
11555 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
11556 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
11557
11558 !! html/php+tidy
11559 <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>
11560 <p>123</p>
11561 <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>
11562 <p>456 123</p>
11563 <div class="thumb tright">
11564 <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>
11565 <div class="thumbcaption">
11566 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11567 </div>
11568 </div>
11569 </div>
11570 <p>456</p>
11571 !! html/parsoid
11572 <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" height="220" width="1941"></a></span>456</p>
11573 <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" height="220" width="1941"></a></figure><p>456</p>
11574 <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/180px-Foobar.jpg" height="25" width="220"></a></figure><p>456</p>
11575 !! end
11576
11577 !! test
11578 Image with multiple captions -- only last one is accepted
11579 !! wikitext
11580 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11581 !! html/php
11582 <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>
11583
11584 !! html/parsoid
11585 <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" height="220" width="1941"></a><figcaption>Caption3 - accepted</figcaption></figure>
11586 !! end
11587
11588 !! test
11589 Image with multiple widths -- use last
11590 !! wikitext
11591 [[File:Foobar.jpg|200px|300px|caption]]
11592 !! html/php
11593 <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>
11594 </p>
11595 !! html/parsoid
11596 <p><span 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" height="34" width="300"/></a></span></p>
11597 !! end
11598
11599 !! test
11600 Image with multiple alignments -- use first (bug 48664)
11601 !! options
11602 thumbsize=220
11603 !! wikitext
11604 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11605
11606 [[File:Foobar.jpg|middle|text-top|caption]]
11607 !! html/php
11608 <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>
11609 <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>
11610 </p>
11611 !! html/parsoid
11612 <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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
11613 <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" height="220" width="1941"/></a></span></p>
11614 !! end
11615
11616 !! test
11617 Image with width attribute at different positions
11618 !! wikitext
11619 [[File:Foobar.jpg|200px|right|Caption]]
11620 [[File:Foobar.jpg|right|200px|Caption]]
11621 [[File:Foobar.jpg|right|Caption|200px]]
11622 !! html/php
11623 <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>
11624 <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>
11625 <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>
11626
11627 !! html/parsoid
11628 <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" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
11629 <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" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
11630 <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" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
11631 !! end
11632
11633 # a sad bit of backward-compatibility
11634 !! test
11635 Image with size specified with pxpx (bug 13500, 51628)
11636 !! options
11637 parsoid=wt2html,wt2wt,html2html
11638 !! wikitext
11639 [[File:Foobar.jpg|20pxpx]]
11640 [[File:Foobar.jpg|200x20pxpx]]
11641 !! html/php
11642 <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>
11643 <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>
11644 </p>
11645 !! html/parsoid
11646 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="2" width="20"/></a></span> <span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="20" width="177"/></a></span></p>
11647 !! end
11648
11649 !! test
11650 Image with link parameter, wiki target
11651 !! wikitext
11652 [[File:Foobar.jpg|link=Main Page]]
11653 !! html/php
11654 <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>
11655 </p>
11656 !! html/parsoid
11657 <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" height="220" width="1941"></a></span></p>
11658 !! end
11659
11660 # parsoid bug 49293 (part 1)
11661 !! test
11662 Image with link parameter, URL target
11663 !! wikitext
11664 [[File:Foobar.jpg|link=http://example.com/]]
11665 !! html/php
11666 <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>
11667 </p>
11668 !! html/parsoid
11669 <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" height="220" width="1941"></a></span></p>
11670 !! end
11671
11672 # parsoid bug 49293 (part 2)
11673 !! test
11674 Image with link parameter, protocol-less URL target
11675 !! wikitext
11676 [[File:Foobar.jpg|link=//example.com/]]
11677 !! html/php
11678 <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>
11679 </p>
11680 !! html/parsoid
11681 <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" height="220" width="1941"></a></span></p>
11682 !! end
11683
11684 !! test
11685 Image with link parameter, wgExternalLinkTarget
11686 !! wikitext
11687 [[Image:foobar.jpg|link=http://example.com/]]
11688 !! config
11689 wgExternalLinkTarget='foobar'
11690 !! html
11691 <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>
11692 </p>
11693 !! end
11694
11695 !! test
11696 Image with link parameter, wgNoFollowLinks set to false
11697 !! wikitext
11698 [[Image:foobar.jpg|link=http://example.com/]]
11699 !! config
11700 wgNoFollowLinks=false
11701 !! html
11702 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11703 </p>
11704 !! end
11705
11706 !! test
11707 Image with link parameter, wgNoFollowDomainExceptions
11708 !! wikitext
11709 [[Image:foobar.jpg|link=http://example.com/]]
11710 !! config
11711 wgNoFollowDomainExceptions='example.com'
11712 !! html
11713 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11714 </p>
11715 !! end
11716
11717 !! test
11718 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11719 !! wikitext
11720 [[Image:foobar.jpg|link=http://example.com/|Title]]
11721 !! config
11722 wgExternalLinkTarget='foobar'
11723 !! html
11724 <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>
11725 </p>
11726 !! end
11727
11728 !! test
11729 Image with empty link parameter
11730 !! wikitext
11731 [[File:Foobar.jpg|link=]]
11732 !! html/php
11733 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11734 </p>
11735 !! html/parsoid
11736 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></span></span></p>
11737 !! end
11738
11739 !! test
11740 Image with link parameter (wiki target) and unnamed parameter
11741 !! wikitext
11742 [[File:Foobar.jpg|link=Main_Page|Title]]
11743 !! html/php
11744 <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>
11745 </p>
11746 !! html/parsoid
11747 <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" height="220" width="1941"></a></span></p>
11748 !! end
11749
11750 !! test
11751 Image with link parameter (URL target) and unnamed parameter
11752 !! wikitext
11753 [[File:Foobar.jpg|link=http://example.com/|Title]]
11754 !! html/php
11755 <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>
11756 </p>
11757 !! html/parsoid
11758 <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" height="220" width="1941"></a></span></p>
11759 !! end
11760
11761 !! test
11762 Thumbnail image with link parameter
11763 !! options
11764 thumbsize=220
11765 parsoid=wt2html,wt2wt,html2html
11766 !! wikitext
11767 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11768 !! html/php
11769 <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>
11770
11771 !! html/parsoid
11772 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
11773 !! end
11774
11775 !! test
11776 Manually-specified thumbnail image
11777 !! options
11778 thumbsize=220
11779 !! wikitext
11780 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11781 !! html/php
11782 <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>
11783
11784 !! html/parsoid
11785 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
11786 !! end
11787
11788 !! test
11789 Manually-specified thumbnail image with explicit link to wiki page
11790 !! options
11791 thumbsize=220
11792 parsoid=wt2html,wt2wt,html2html
11793 !! wikitext
11794 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11795 !! html/php
11796 <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>
11797
11798 !! html/parsoid
11799 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
11800 !! end
11801
11802 !! test
11803 Manually-specified thumbnail image with explicit link to url
11804 !! options
11805 thumbsize=220
11806 parsoid=wt2html,wt2wt,html2html
11807 !! wikitext
11808 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11809 !! html/php
11810 <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>
11811
11812 !! html/parsoid
11813 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
11814 !! end
11815
11816 !! test
11817 Manually-specified thumbnail image with explicit no link
11818 !! options
11819 thumbsize=220
11820 parsoid=wt2html,wt2wt,html2html
11821 !! wikitext
11822 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11823 !! html/php
11824 <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>
11825
11826 !! html/parsoid
11827 <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" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
11828 !! end
11829
11830 !! test
11831 Manually-specified thumbnail image with explicit link and alt text
11832 !! options
11833 thumbsize=220
11834 parsoid=wt2html,wt2wt,html2html
11835 !! wikitext
11836 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11837 !! html/php
11838 <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>
11839
11840 !! html/parsoid
11841 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
11842 !! end
11843
11844 !! test
11845 Image with frame and link
11846 !! options
11847 parsoid=wt2html,wt2wt,html2html
11848 !! wikitext
11849 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11850 !! html/php
11851 <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>
11852
11853 !! html/parsoid
11854 <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" 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>
11855 !! end
11856
11857 !! test
11858 Image with frame and link and explicit alt
11859 !! options
11860 parsoid=wt2html,wt2wt,html2html
11861 !! wikitext
11862 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11863 !! html/php
11864 <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>
11865
11866 !! html/parsoid
11867 <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" 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>
11868 !! end
11869
11870 !! test
11871 Image with wiki markup in implicit alt
11872 !! options
11873 parsoid=wt2html,wt2wt,html2html
11874 !! wikitext
11875 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11876
11877 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11878 !! html/php
11879 <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>
11880 </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>
11881 </p>
11882 !! html/parsoid
11883 <p><span class="mw-default-size" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;testing '''bold''' in alt&quot;}"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
11884 <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" height="220" width="1941"/></a></span></p>
11885 !! end
11886
11887 ###################
11888 # Conflicting image format options.
11889 # First option specified should 'win'.
11890 # All three cases in each test should be identical.
11891
11892 !! test
11893 Image with 'frameless' first.
11894 !! options
11895 parsoid=wt2html,wt2wt,html2html
11896 !! wikitext
11897 [[File:Foobar.jpg|frameless|caption]]
11898
11899 [[File:Foobar.jpg|frameless|frame|caption]]
11900
11901 [[File:Foobar.jpg|frameless|thumb|caption]]
11902 !! html/php
11903 <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>
11904 </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>
11905 </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>
11906 </p>
11907 !! html/parsoid
11908 <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/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
11909 <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/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
11910 <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/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
11911 !! end
11912
11913 !! test
11914 Image with 'frame' first.
11915 !! options
11916 parsoid=wt2html,wt2wt,html2html
11917 !! wikitext
11918 [[File:Foobar.jpg|frame|caption]]
11919 [[File:Foobar.jpg|frame|frameless|caption]]
11920 [[File:Foobar.jpg|frame|thumb|caption]]
11921 !! html/php
11922 <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>
11923 <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>
11924 <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>
11925
11926 !! html/parsoid
11927 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
11928 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
11929 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
11930 !! end
11931
11932 !! test
11933 Image with 'thumb' first.
11934 !! options
11935 parsoid=wt2html,wt2wt,html2html
11936 !! wikitext
11937 [[File:Foobar.jpg|thumb|caption]]
11938 [[File:Foobar.jpg|thumb|frameless|caption]]
11939 [[File:Foobar.jpg|thumb|frame|caption]]
11940 !! html/php
11941 <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>
11942 <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>
11943 <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>
11944
11945 !! html/parsoid
11946 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
11947 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
11948 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
11949 !! end
11950
11951 ###################
11952 # Image sizing.
11953 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11954 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11955 # Foobar has actual size of 1941x220
11956 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11957 # a scalable format.
11958 # 2. Framed images always ignore size options; always render at default size.
11959 # 3. "Unspecified format" and border are the only types which can be
11960 # enlarged.
11961
11962 !! test
11963 Image: "unspecified format" and border enlarge
11964 !! options
11965 parsoid=wt2html,wt2wt,html2html
11966 !! wikitext
11967 [[File:Foobar.jpg|2000px]]
11968
11969 [[File:Foobar.jpg|border|2000px]]
11970 !! html/php
11971 <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>
11972 </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>
11973 </p>
11974 !! html/parsoid
11975 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="227" width="2000"/></a></span></p>
11976 <p><span class="mw-image-border" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="227" width="2000"/></a></span></p>
11977 !! end
11978
11979 !! test
11980 Image: "unspecified format" and border reduce
11981 !! options
11982 parsoid=wt2html,wt2wt,html2html
11983 !! wikitext
11984 [[File:Foobar.jpg|1000px]]
11985
11986 [[File:Foobar.jpg|border|1000px]]
11987 !! html/php
11988 <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>
11989 </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>
11990 </p>
11991 !! html/parsoid
11992 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="113" width="1000"/></a></span></p>
11993 <p><span class="mw-image-border" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="113" width="1000"/></a></span></p>
11994 !! end
11995
11996 !! test
11997 Image: thumbs reduce
11998 !! options
11999 parsoid=wt2html,wt2wt,html2html
12000 !! wikitext
12001 [[File:Foobar.jpg|thumb|50px]]
12002 !! html/php
12003 <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>
12004
12005 !! html/parsoid
12006 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="6" width="50"/></a></figure>
12007 !! end
12008
12009 !! test
12010 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12011 !! options
12012 parsoid=wt2html,wt2wt,html2html
12013 !! wikitext
12014 [[File:Foobar.jpg|thumb|2000px]]
12015
12016 [[File:Foobar.svg|thumb|2000px]]
12017 !! html/php
12018 <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>
12019 <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>
12020
12021 !! html/parsoid
12022 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
12023 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="1500" width="2000"/></a></figure>
12024 !! end
12025
12026 !! test
12027 Image: frameless can reduce in size
12028 !! options
12029 parsoid=wt2html,wt2wt,html2html
12030 !! wikitext
12031 [[File:Foobar.jpg|frameless|50px]]
12032 !! html/php
12033 <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>
12034 </p>
12035 !! html/parsoid
12036 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="6" width="50"/></a></span></p>
12037 !! end
12038
12039 !! test
12040 Image: bitmap frameless can't be enlarged past original size, but vector can
12041 !! options
12042 parsoid=wt2html,wt2wt,html2html
12043 !! wikitext
12044 [[File:Foobar.jpg|frameless|2000px]]
12045
12046 [[File:Foobar.svg|frameless|2000px]]
12047 !! html/php
12048 <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>
12049 </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>
12050 </p>
12051 !! html/parsoid
12052 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12053 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="1500" width="2000"/></a></span></p>
12054 !! end
12055
12056 !! test
12057 Image: framed images are always unscaled.
12058 !! options
12059 parsoid=wt2html,wt2wt,html2html
12060 !! wikitext
12061 [[File:Foobar.jpg|frame]]
12062
12063 [[File:Foobar.jpg|frame|50px]]
12064
12065 [[File:Foobar.jpg|frame|50x50px]]
12066
12067 [[File:Foobar.jpg|frame|2000px]]
12068 !! html/php
12069 <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>
12070 <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>
12071 <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>
12072 <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>
12073
12074 !! html/parsoid
12075 <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" height="220" width="1941"/></a></figure>
12076 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
12077 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
12078 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
12079 !! end
12080
12081 ###################
12082
12083 !! test
12084 Link to image page- image page normally doesn't exists, hence edit link
12085 Add test with existing image page
12086 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12087 !! wikitext
12088 [[:Image:test]]
12089 !! html
12090 <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>
12091 </p>
12092 !! end
12093
12094 !! test
12095 bug 18784 Link to non-existent image page with caption should use caption as link text
12096 !! wikitext
12097 [[:Image:test|caption]]
12098 !! html
12099 <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>
12100 </p>
12101 !! end
12102
12103 !! test
12104 Frameless image caption with a free URL
12105 !! wikitext
12106 [[File:Foobar.jpg|http://example.com]]
12107 !! html/php
12108 <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>
12109 </p>
12110 !! html/parsoid
12111 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"http://example.com"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12112 !! end
12113
12114 !! test
12115 Thumbnail image caption with a free URL
12116 !! options
12117 thumbsize=220
12118 !! wikitext
12119 [[File:Foobar.jpg|thumb|http://example.com]]
12120 !! html/php
12121 <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>
12122
12123 !! html/parsoid
12124 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12125 !! end
12126
12127 !! test
12128 Thumbnail image caption with a free URL and explicit alt
12129 !! options
12130 thumbsize=220
12131 parsoid=wt2html,wt2wt,html2html
12132 !! wikitext
12133 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12134 !! html/php
12135 <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>
12136
12137 !! html/parsoid
12138 <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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12139 !! end
12140
12141 !! test
12142 SVG thumbnails with no language set
12143 !! options
12144 !! wikitext
12145 [[File:Foobar.svg|thumb|caption]]
12146 !! html/php
12147 <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>
12148
12149 !! html/parsoid
12150 <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" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12151 !! end
12152
12153 !! test
12154 SVG thumbnails with language de
12155 !! options
12156 parsoid=wt2html,wt2wt,html2html
12157 !! wikitext
12158 [[File:Foobar.svg|thumb|caption|lang=de]]
12159 !! html/php
12160 <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>
12161
12162 !! html/parsoid
12163 <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" lang="de" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12164 !! end
12165
12166 !! test
12167 SVG thumbnails with invalid language code
12168 !! options
12169 parsoid=wt2html,wt2wt,html2html
12170 !! wikitext
12171 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12172 !! html/php
12173 <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>
12174
12175 !! html/parsoid
12176 <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" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
12177 !! end
12178
12179 !! test
12180 BUG 1887: A ISBN with a thumbnail
12181 !! wikitext
12182 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12183 !! html/php
12184 <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>
12185
12186 !! html/parsoid
12187 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a href="Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
12188 !! end
12189
12190 !! test
12191 BUG 1887: A RFC with a thumbnail
12192 !! wikitext
12193 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12194 !! html/php
12195 <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>
12196
12197 !! html/parsoid
12198 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
12199 !! end
12200
12201 !! test
12202 BUG 1887: A mailto link with a thumbnail
12203 !! wikitext
12204 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12205 !! html/php
12206 <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>
12207
12208 !! html/parsoid
12209 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
12210 !! end
12211
12212 # Pending resolution to bug 368
12213 !! test
12214 BUG 648: Frameless image caption with a link
12215 !! wikitext
12216 [[File:Foobar.jpg|text with a [[link]] in it]]
12217 !! html/php
12218 <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>
12219 </p>
12220 !! html/parsoid
12221 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12222 !! end
12223
12224 !! test
12225 BUG 648: Frameless image caption with a link (suffix)
12226 !! wikitext
12227 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12228 !! html/php
12229 <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>
12230 </p>
12231 !! html/parsoid
12232 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]]foo in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12233 !! end
12234
12235 !! test
12236 BUG 648: Frameless image caption with an interwiki link
12237 !! wikitext
12238 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12239 !! html/php
12240 <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>
12241 </p>
12242 !! html/parsoid
12243 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12244 !! end
12245
12246 !! test
12247 BUG 648: Frameless image caption with a piped interwiki link
12248 !! wikitext
12249 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12250 !! html/php
12251 <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>
12252 </p>
12253 !! html/parsoid
12254 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link|link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12255 !! end
12256
12257 !! test
12258 Escape HTML special chars in image alt text
12259 !! wikitext
12260 [[File:Foobar.jpg|& < > "]]
12261 !! html/php
12262 <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>
12263 </p>
12264 !! html/parsoid
12265 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp; &lt; > \""}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12266 !! end
12267
12268 !! test
12269 BUG 499: Alt text should have &#1234;, not &amp;1234;
12270 !! wikitext
12271 [[File:Foobar.jpg|&#9792;]]
12272 !! html/php
12273 <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>
12274 </p>
12275 !! html/parsoid
12276 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;#9792;"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12277 !! end
12278
12279 !! test
12280 Broken image caption with link
12281 !! options
12282 parsoid=wt2html,wt2wt,html2html
12283 !! wikitext
12284 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12285 !! html/php
12286 <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.
12287 </p>
12288 !! html/parsoid
12289 <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>
12290 !! end
12291
12292 !! test
12293 Image caption containing another image
12294 !! wikitext
12295 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12296 !! html/php
12297 <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>
12298
12299 !! html/parsoid
12300 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 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" height="135" width="135"/></a></span> inside it!</figcaption></figure>
12301 !! end
12302
12303 !! test
12304 Image: caption containing a newline
12305 !! wikitext
12306 [[File:Foobar.jpg|This
12307 *is some text]]
12308 !! html/php
12309 <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>
12310 </p>
12311 !! html/parsoid
12312 <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" height="220" width="1941"/></a></span></p>
12313 !!end
12314
12315 !!test
12316 Image: caption containing leading space
12317 (The leading space should not trigger nowiki escaping in wt2wt mode)
12318 !! wikitext
12319 [[File:Foobar.jpg|thumb| bar]]
12320 !! html/php
12321 <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>
12322
12323 !! html/parsoid
12324 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
12325 !!end
12326
12327 !! test
12328 Image: caption containing a table
12329 !! options
12330 parsoid=wt2html,wt2wt,html2html
12331 !! wikitext
12332 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12333 {|
12334 ! Foo !! Bar
12335 |-
12336 | Foo1 || Bar1
12337 |}
12338 and some more text.]]
12339 !! html/php
12340 <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>
12341
12342 !! html/parsoid
12343 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
12344 <table>
12345 <tbody>
12346 <tr><th>Foo </th><th>Bar</th></tr>
12347 <tr>
12348 <td>Foo1 </td>
12349 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12350 !! end
12351
12352 !! test
12353 Bug 3090: External links other than http: in image captions
12354 !! wikitext
12355 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12356 !! html/php
12357 <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>
12358
12359 !! html/parsoid
12360 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 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>
12361 !! end
12362
12363 !! test
12364 Custom class
12365 !! options
12366 parsoid=wt2html,wt2wt,html2html
12367 !! wikitext
12368 [[Image:foobar.jpg|a|class=b]]
12369 !! html/php
12370 <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>
12371 </p>
12372 !! html/parsoid
12373 <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" height="220" width="1941"/></a></span></p>
12374 !! end
12375
12376 !! test
12377 Localized image handling (1).
12378 !! options
12379 parsoid=wt2html,wt2wt,html2html
12380 language=es
12381 !! wikitext
12382 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12383 !! html/php
12384 <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>
12385
12386 !! html/parsoid
12387 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12388 !! end
12389
12390 !! test
12391 Localized image handling (2).
12392 !! options
12393 thumbsize=220
12394 parsoid=wt2html,wt2wt,html2html
12395 language=es
12396 !! wikitext
12397 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12398 !! html/php
12399 <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>
12400
12401 !! html/parsoid
12402 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12403 !! end
12404
12405 !! test
12406 "border", "frameless" and "class" attributes on an image.
12407 !! options
12408 thumbsize=220
12409 parsoid=wt2html,wt2wt,html2html
12410 !! wikitext
12411 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12412 !! html/php
12413 <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>
12414 </p>
12415 !! html/parsoid
12416 <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/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
12417 !! end
12418
12419 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12420 !! test
12421 Invalid image attributes (bug 62500)
12422 !! options
12423 thumbsize=220
12424 parsoid=wt2html,wt2wt,html2html
12425 !! wikitext
12426 [[File:Foobar.jpg|thumb|float|left|caption]]
12427
12428 [[File:Foobar.jpg|thumb|righ|caption]]
12429
12430 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12431 !! html/php
12432 <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>
12433 <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>
12434 <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>
12435
12436 !! html/parsoid
12437 <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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12438 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12439 <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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12440 !! end
12441
12442 !! article
12443 File:Barfoo.jpg
12444 !! text
12445 #REDIRECT [[File:Barfoo.jpg]]
12446 !! endarticle
12447
12448 # FIXME: Parsoid should run this test -- but we'd need to teach the
12449 # mockAPI about the redirected Barfoo.jpg image.
12450 !! test
12451 Redirected image
12452 !! wikitext
12453 [[Image:Barfoo.jpg]]
12454 !! html/php
12455 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12456 </p>
12457 !! end
12458
12459 !! test
12460 Missing image with uploads disabled
12461 !! options
12462 wgEnableUploads=0
12463 !! wikitext
12464 [[File:Foobaz.jpg]]
12465 !! html/php
12466 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12467 </p>
12468 !! html/parsoid
12469 <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>
12470 !! end
12471
12472 # Parsoid-specific testing for images
12473 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12474 # Currently imperfect due to a flaw in the Parsoid testrunner
12475 # Work in progress
12476 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12477 # image tests.
12478
12479 !! test
12480 Parsoid-specific image handling - simple image with size and middle alignment
12481 !! wikitext
12482 [[File:Foobar.jpg|middle|50px]]
12483 !! html/parsoid
12484 <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" height="6" width="50"></a></span></p>
12485 !! end
12486
12487 !! test
12488 Parsoid-specific image handling - simple image with size, middle alignment,
12489 non-standard namespace alias
12490 !! options
12491 parsoid=wt2wt,wt2html,html2html
12492 !! wikitext
12493 [[Image:Foobar.jpg|middle|50px]]
12494 !! html/parsoid
12495 <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" height="6" width="50"></a></span></p>
12496 !! end
12497
12498 !! test
12499 Parsoid-specific image handling - simple image with size and middle alignment
12500 (existing content)
12501 !! wikitext
12502 [[File:Foobar.jpg|50px|middle]]
12503 !! html/parsoid
12504 <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" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12505 !! end
12506
12507 !! test
12508 Parsoid-specific image handling - simple image with size and middle alignment
12509 and non-standard namespace name
12510 !! options
12511 parsoid=wt2html,wt2wt,html2html
12512 !! wikitext
12513 [[Image:Foobar.jpg|50px|middle]]
12514 !! html/parsoid
12515 <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" height="6" width="50"></a></span></p>
12516 !! end
12517
12518 !! test
12519 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12520 !! wikitext
12521 [[File:Foobar.jpg|500x10px|baseline|caption]]
12522 !! html/parsoid
12523 <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" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12524 !! end
12525
12526 !! test
12527 Parsoid-specific image handling - simple image with border and size spec
12528 !! wikitext
12529 [[File:Foobar.jpg|50px|border|caption]]
12530 !! html/parsoid
12531 <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" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12532 !! end
12533
12534 !! test
12535 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12536 !! wikitext
12537 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12538 !! html/parsoid
12539 <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/180px-Foobar.jpg" height="25" width="220" /></a><figcaption>caption content</figcaption></figure>
12540 !! end
12541
12542 !! test
12543 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12544 (existing content)
12545 !! wikitext
12546 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12547 !! html/parsoid
12548 <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/180px-Foobar.jpg" 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>
12549 !! end
12550
12551 !! test
12552 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12553 !! wikitext
12554 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12555 !! html/parsoid
12556 <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" height="6" width="50" /></a><figcaption>caption</figcaption></figure>
12557 !! end
12558
12559 !! test
12560 Parsoid-specific image handling - thumbnail with specific size, halign,
12561 valign, and caption (existing content)
12562 !! wikitext
12563 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12564 !! html/parsoid
12565 <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" 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>
12566 !! end
12567
12568 !! test
12569 Parsoid-specific image handling - framed image with specific size and caption
12570 (size is ignored)
12571 !! options
12572 parsoid=wt2html,wt2wt,html2html
12573 !! wikitext
12574 [[File:Foobar.jpg|frame|500x50px|caption]]
12575 !! html/parsoid
12576 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" /></a><figcaption>caption</figcaption></figure>
12577 !! end
12578
12579 !! test
12580 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12581 (size is ignored)
12582 !! options
12583 parsoid=wt2html,wt2wt,html2html
12584 !! wikitext
12585 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12586 !! html/parsoid
12587 <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" height="220" width="1941" /></a><figcaption>caption</figcaption></figure>
12588 !! end
12589
12590 !! test
12591 Parsoid-specific image handling - frameless image with specific size, border, and caption
12592 !! wikitext
12593 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12594 !! html/parsoid
12595 <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" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12596 !! end
12597
12598 !! test
12599 Parsoid-specific image handling - simple image with a formatted caption
12600 !! wikitext
12601 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12602 !! html/parsoid
12603 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
12604 !! end
12605
12606 !! test
12607 Parsoid-specific image handling - caption with a template in it
12608 !! wikitext
12609 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12610 !! html/parsoid
12611 <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" 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>
12612 !! end
12613
12614 !! test
12615 Parsoid-specific image handling - caption with unbalanced tags in it
12616 !! options
12617 parsoid=wt2html,wt2wt,html2html
12618 !! wikitext
12619 foo
12620 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12621 bar
12622 !! html/parsoid
12623 <p>foo</p>
12624 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
12625 <p>bar</p>
12626 !! end
12627
12628 !! test
12629 Parsoid-specific image handling - empty caption (1)
12630 !! options
12631 parsoid=wt2html,wt2wt
12632 !! wikitext
12633 [[File:Foobar.jpg|thumb|]]
12634 !! html/parsoid
12635 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption></figcaption></figure>
12636 !! end
12637
12638 # empty captions don't get serialized unless we're in the "round trip" case
12639 !! test
12640 Parsoid-specific image handling - empty caption (2)
12641 !! options
12642 parsoid=html2wt
12643 !! html/parsoid
12644 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12645 <a href="File:Foobar.jpg">
12646 <img resource="./File:Foobar.jpg"
12647 src="//example.com/images/3/3a/Foobar.jpg"
12648 height="25" width="220"/>
12649 </a>
12650 <figcaption></figcaption>
12651 </figure>
12652 !! wikitext
12653 [[File:Foobar.jpg|thumb]]
12654 !! end
12655
12656 !! test
12657 Parsoid-specific image handling - whitespace caption
12658 !! wikitext
12659 [[File:Foobar.jpg|thumb| ]]
12660 !! html/parsoid
12661 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption> </figcaption></figure>
12662 !! end
12663
12664 !! test
12665 Parsoid-specific image handling - lang option
12666 !! wikitext
12667 foo
12668 [[File:Foobar.svg|lang=de|caption]]
12669 bar
12670 !! html/parsoid
12671 <p>foo
12672 <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" height="180" width="240"/></a></span>
12673 bar</p>
12674 !! end
12675
12676
12677 ###
12678 ### Subpages
12679 ###
12680 !! article
12681 Subpage test/subpage
12682 !! text
12683 foo
12684 !! endarticle
12685
12686 !! test
12687 Subpage link
12688 !! options
12689 subpage title=[[Subpage test]]
12690 !! wikitext
12691 [[/subpage]]
12692 !! html
12693 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12694 </p>
12695 !! end
12696
12697 !! test
12698 Subpage noslash link
12699 !! options
12700 subpage title=[[Subpage test]]
12701 !! wikitext
12702 [[/subpage/]]
12703 !! html
12704 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12705 </p>
12706 !! end
12707
12708 !! article
12709 Subpage test/1/2/subpage
12710 !! text
12711 blah
12712 !! endarticle
12713
12714 !! test
12715 Relative subpage noslash link
12716 !! options
12717 parsoid=wt2wt,wt2html,html2html
12718 subpage title=[[Subpage test/1/2/3/4]]
12719 !! wikitext
12720 [[../../subpage/]]
12721
12722 [[../../subpage]]
12723 !! html/php
12724 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12725 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12726 </p>
12727 !! html/parsoid
12728 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12729 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12730 !! end
12731
12732 !! test
12733 Parsoid: dot-slash prefixed wikilinks
12734 !! wikitext
12735 [[./foo]]
12736
12737 [[././bar]]
12738
12739 [[././baz/]]
12740 !! html/php
12741 <p>[[./foo]]
12742 </p><p>[[././bar]]
12743 </p><p>[[././baz/]]
12744 </p>
12745 !! html/parsoid
12746 <p>[[./foo]]
12747 </p><p>[[././bar]]
12748 </p><p>[[././baz/]]
12749 </p>
12750 !! end
12751
12752 !! test
12753 Render invalid page names as plain text (bug 51090)
12754 !! wikitext
12755 [[./../foo|bar]]
12756 [[foo�|bar]]
12757 [[foo/.|bar]]
12758 [[foo/..|bar]]
12759 [[foo~~~bar]]
12760 [[foo>bar]]
12761 [[foo[bar]]
12762 [[.]]
12763 [[..]]
12764 [[foo././bar]]
12765
12766 [[{{echo|./../foo}}|bar]]
12767 [[{{echo|foo/.}}|bar]]
12768 [[{{echo|foo/..}}|bar]]
12769 [[{{echo|foo~~~~bar}}]]
12770 [[{{echo|foo>bar}}]]
12771 [[{{echo|foo././bar}}]]
12772 [[{{echo|foo{bar}}]]
12773 [[{{echo|foo}bar}}]]
12774 [[{{echo|foo[bar}}]]
12775 [[{{echo|foo]bar}}]]
12776 [[{{echo|foo<bar}}]]
12777 !!html/php
12778 <p>[[./../foo|bar]]
12779 [[foo�|bar]]
12780 [[foo/.|bar]]
12781 [[foo/..|bar]]
12782 [[foo~~~bar]]
12783 [[foo&gt;bar]]
12784 [[foo[bar]]
12785 [[.]]
12786 [[..]]
12787 [[foo././bar]]
12788 </p><p>[[./../foo|bar]]
12789 [[foo/.|bar]]
12790 [[foo/..|bar]]
12791 [[foo~~~~bar]]
12792 [[foo&gt;bar]]
12793 [[foo././bar]]
12794 [[foo{bar]]
12795 [[foo}bar]]
12796 [[foo[bar]]
12797 [[foo]bar]]
12798 [[foo&lt;bar]]
12799 </p>
12800 !!html/parsoid
12801 <p>[[./../foo|bar]]
12802 [[foo�|bar]]
12803 [[foo/.|bar]]
12804 [[foo/..|bar]]
12805 [[foo~~~bar]]
12806 [[foo>bar]]
12807 [[foo[bar]]
12808 [[.]]
12809 [[..]]
12810 [[foo././bar]]</p>
12811
12812 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12813 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12814 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12815 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12816 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12817 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12818 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12819 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12820 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12821 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12822 [[<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>
12823 !!end
12824
12825 !! test
12826 Disabled subpages
12827 !! wikitext
12828 [[/subpage]]
12829 !! html
12830 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12831 </p>
12832 !! end
12833
12834 !! test
12835 BUG 561: {{/Subpage}}
12836 !! options
12837 subpage title=[[Page]]
12838 !! wikitext
12839 {{/Subpage}}
12840 !! html
12841 <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>
12842 </p>
12843 !! end
12844
12845 ###
12846 ### Categories
12847 ###
12848 !! article
12849 Category:MediaWiki User's Guide
12850 !! text
12851 blah
12852 !! endarticle
12853
12854 !! test
12855 Link to category
12856 !! wikitext
12857 [[:Category:MediaWiki User's Guide]]
12858 !! html
12859 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12860 </p>
12861 !! end
12862
12863 !! test
12864 Simple category
12865 !! options
12866 cat
12867 !! wikitext
12868 [[Category:MediaWiki User's Guide]]
12869 !! html
12870 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12871 !! end
12872
12873 !! test
12874 PAGESINCATEGORY invalid title fatal (r33546 fix)
12875 !! wikitext
12876 {{PAGESINCATEGORY:<bogus>}}
12877 !! html
12878 <p>0
12879 </p>
12880 !! end
12881
12882 !! test
12883 Category with different sort key
12884 !! options
12885 cat
12886 !! wikitext
12887 [[Category:MediaWiki User's Guide|Foo]]
12888 !! html
12889 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12890 !! end
12891
12892 !! test
12893 Category with identical sort key
12894 !! options
12895 cat
12896 !! wikitext
12897 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12898 !! html
12899 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12900 !! end
12901
12902 !! test
12903 Category with empty sort key
12904 !! options
12905 cat
12906 pst
12907 !! wikitext
12908 [[Category:MediaWiki User's Guide|]]
12909 !! html
12910 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12911 !! end
12912
12913 !! test
12914 Category with empty sort key and parentheses
12915 !! options
12916 cat
12917 pst
12918 !! wikitext
12919 [[Category:Foo (bar)|]]
12920 !! html
12921 [[Category:Foo (bar)|Foo]]
12922 !! end
12923
12924 !! test
12925 Category with link tail
12926 !! options
12927 cat
12928 pst
12929 !! wikitext
12930 123[[Category:Foo]]456
12931 !! html
12932 123[[Category:Foo]]456
12933 !! end
12934
12935 !! test
12936 Category with template
12937 !! options
12938 cat
12939 pst
12940 !! wikitext
12941 [[Category:{{echo|Foo}}]]
12942 !! html
12943 [[Category:{{echo|Foo}}]]
12944 !! end
12945
12946 !! test
12947 Category with template in sort key
12948 !! options
12949 cat
12950 pst
12951 !! wikitext
12952 [[Category:Foo|{{echo|Bar}}]]
12953 !! html
12954 [[Category:Foo|{{echo|Bar}}]]
12955 !! end
12956
12957 !! test
12958 Category with template in sort key and title
12959 !! options
12960 cat
12961 pst
12962 !! wikitext
12963 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12964 !! html
12965 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12966 !! end
12967
12968 !! test
12969 Category / paragraph interactions
12970 !! wikitext
12971 Foo [[Category:Baz]] Bar
12972
12973 Foo [[Category:Baz]]
12974 Bar
12975
12976 Foo
12977 [[Category:Baz]]
12978 Bar
12979
12980 Foo
12981 [[Category:Baz]] Bar
12982
12983 Foo
12984 [[Category:Baz]]
12985 [[Category:Baz]]
12986 [[Category:Baz]]
12987 Bar
12988
12989 [[Category:Baz]]
12990 [[Category:Baz]]
12991 [[Category:Baz]]
12992
12993 [[Category:Baz]]
12994 {{echo|[[Category:Baz]]}}
12995 [[Category:Baz]]
12996 !! html
12997 <p>Foo Bar
12998 </p><p>Foo
12999 Bar
13000 </p><p>Foo
13001 Bar
13002 </p><p>Foo Bar
13003 </p><p>Foo
13004 Bar
13005 </p>
13006 !! end
13007
13008 !! test
13009 Parsoid: Serialize link to category page with colon escape
13010 !! options
13011 parsoid
13012 !! wikitext
13013
13014 [[:Category:Foo]]
13015 [[:Category:Foo|Bar]]
13016 !! html
13017 <p>
13018 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13019 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13020 </p>
13021 !! end
13022
13023 !! test
13024 Parsoid: Link prefix/suffixes aren't applied to category links
13025 !! options
13026 parsoid=wt2html,wt2wt,html2html
13027 language=is
13028 !! wikitext
13029 x[[Category:Foo]]y
13030 !! html
13031 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
13032 !! end
13033
13034 !! test
13035 Parsoid: Serialize link to file page with colon escape
13036 !! options
13037 parsoid
13038 !! wikitext
13039
13040 [[:File:Foo.png]]
13041 [[:File:Foo.png|Bar]]
13042 !! html
13043 <p>
13044 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
13045 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
13046 </p>
13047 !! end
13048
13049 !! test
13050 Parsoid: Serialize a genuine category link without colon escape
13051 !! options
13052 parsoid
13053 !! wikitext
13054 [[Category:Foo]]
13055 [[Category:Foo|Bar]]
13056 !! html
13057 <link rel="mw:PageProp/Category" href="Category:Foo">
13058 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
13059 !! end
13060
13061 !! test
13062 Normalize hrefs properly before testing for invalid link targets (bug 70894)
13063 !! options
13064 parsoid=html2wt
13065 !! html
13066 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
13067 !! wikitext
13068 [[Category:Toxine bactérienne]]
13069 !! end
13070
13071 !! test
13072 Parsoid: Defaultsort
13073 !! options
13074 parsoid
13075 !! wikitext
13076 {{DEFAULTSORT:Foo}}
13077 !! html
13078 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
13079 !! end
13080
13081 ###
13082 ### Inter-language links
13083 ###
13084 !! test
13085 Interlanguage links
13086 !! options
13087 ill
13088 !! wikitext
13089 [[es:Alimento]]
13090 [[fr:Nourriture]]
13091 [[zh:食品]]
13092 !! html/php
13093 es:Alimento fr:Nourriture zh:食品
13094 !! html/parsoid
13095 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
13096 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
13097 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
13098 !! end
13099
13100 !! test
13101 Duplicate interlanguage links (bug 24502)
13102 !! options
13103 ill
13104 !! wikitext
13105 [[es:1]]
13106 [[es:2]]
13107 [[fr:1]]
13108 [[fr:2]]
13109 !! html/php
13110 es:1 fr:1
13111 !! html/parsoid
13112 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
13113 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
13114 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
13115 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
13116 !! end
13117
13118 ###
13119 ### Sections
13120 ###
13121 !! test
13122 Basic section headings
13123 !! wikitext
13124 == Headline 1 ==
13125 Some text
13126
13127 ==Headline 2==
13128 More
13129 ===Smaller headline===
13130 Blah blah
13131 !! html
13132 <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>
13133 <p>Some text
13134 </p>
13135 <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>
13136 <p>More
13137 </p>
13138 <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>
13139 <p>Blah blah
13140 </p>
13141 !! end
13142
13143 !! test
13144 Section headings with TOC
13145 !! wikitext
13146 == Headline 1 ==
13147 === Subheadline 1 ===
13148 ===== Skipping a level =====
13149 ====== Skipping a level ======
13150
13151 == Headline 2 ==
13152 Some text
13153 ===Another headline===
13154 !! html
13155 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13156 <ul>
13157 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13158 <ul>
13159 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13160 <ul>
13161 <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>
13162 <ul>
13163 <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>
13164 </ul>
13165 </li>
13166 </ul>
13167 </li>
13168 </ul>
13169 </li>
13170 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13171 <ul>
13172 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13173 </ul>
13174 </li>
13175 </ul>
13176 </div>
13177
13178 <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>
13179 <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>
13180 <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>
13181 <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>
13182 <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>
13183 <p>Some text
13184 </p>
13185 <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>
13186
13187 !! end
13188
13189 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13190 !! test
13191 Handling of sections up to level 6 and beyond
13192 !! wikitext
13193 = Level 1 Heading=
13194 == Level 2 Heading==
13195 === Level 3 Heading===
13196 ==== Level 4 Heading====
13197 ===== Level 5 Heading=====
13198 ====== Level 6 Heading======
13199 ======= Level 7 Heading=======
13200 ======== Level 8 Heading========
13201 ========= Level 9 Heading=========
13202 ========== Level 10 Heading==========
13203 !! html
13204 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13205 <ul>
13206 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13207 <ul>
13208 <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>
13209 <ul>
13210 <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>
13211 <ul>
13212 <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>
13213 <ul>
13214 <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>
13215 <ul>
13216 <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>
13217 <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>
13218 <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>
13219 <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>
13220 <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>
13221 </ul>
13222 </li>
13223 </ul>
13224 </li>
13225 </ul>
13226 </li>
13227 </ul>
13228 </li>
13229 </ul>
13230 </li>
13231 </ul>
13232 </div>
13233
13234 <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>
13235 <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>
13236 <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>
13237 <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>
13238 <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>
13239 <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>
13240 <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>
13241 <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>
13242 <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>
13243 <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>
13244
13245 !! end
13246
13247 !! test
13248 TOC regression (bug 9764)
13249 !! wikitext
13250 == title 1 ==
13251 === title 1.1 ===
13252 ==== title 1.1.1 ====
13253 === title 1.2 ===
13254 == title 2 ==
13255 === title 2.1 ===
13256 !! html
13257 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13258 <ul>
13259 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13260 <ul>
13261 <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>
13262 <ul>
13263 <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>
13264 </ul>
13265 </li>
13266 <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>
13267 </ul>
13268 </li>
13269 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13270 <ul>
13271 <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>
13272 </ul>
13273 </li>
13274 </ul>
13275 </div>
13276
13277 <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>
13278 <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>
13279 <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>
13280 <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>
13281 <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>
13282 <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>
13283
13284 !! end
13285
13286 !! test
13287 TOC with wgMaxTocLevel=3 (bug 6204)
13288 !! options
13289 wgMaxTocLevel=3
13290 !! wikitext
13291 == title 1 ==
13292 === title 1.1 ===
13293 ==== title 1.1.1 ====
13294 === title 1.2 ===
13295 == title 2 ==
13296 === title 2.1 ===
13297 !! html
13298 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13299 <ul>
13300 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13301 <ul>
13302 <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>
13303 <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>
13304 </ul>
13305 </li>
13306 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13307 <ul>
13308 <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>
13309 </ul>
13310 </li>
13311 </ul>
13312 </div>
13313
13314 <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>
13315 <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>
13316 <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>
13317 <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>
13318 <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>
13319 <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>
13320
13321 !! end
13322
13323 !! test
13324 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13325 !! options
13326 wgMaxTocLevel=3
13327 !! wikitext
13328 ==Section 1==
13329 ===Section 1.1===
13330 ====Section 1.1.1====
13331 ====Section 1.1.1.1====
13332 ==Section 2==
13333 !! html
13334 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13335 <ul>
13336 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13337 <ul>
13338 <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>
13339 </ul>
13340 </li>
13341 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13342 </ul>
13343 </div>
13344
13345 <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>
13346 <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>
13347 <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>
13348 <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>
13349 <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>
13350
13351 !! end
13352
13353
13354 !! test
13355 Resolving duplicate section names
13356 !! wikitext
13357 == Foo bar ==
13358 == Foo bar ==
13359 !! html
13360 <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>
13361 <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>
13362
13363 !! end
13364
13365 !! test
13366 Resolving duplicate section names with differing case (bug 10721)
13367 !! wikitext
13368 == Foo bar ==
13369 == Foo Bar ==
13370 !! html
13371 <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>
13372 <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>
13373
13374 !! end
13375
13376 !! article
13377 Template:sections
13378 !! text
13379 ===Section 1===
13380 ==Section 2==
13381 !! endarticle
13382
13383 !! test
13384 Template with sections, __NOTOC__
13385 !! wikitext
13386 __NOTOC__
13387 ==Section 0==
13388 {{sections}}
13389 ==Section 4==
13390 !! html
13391 <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>
13392 <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>
13393 <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>
13394 <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>
13395
13396 !! end
13397
13398 !! test
13399 __NOEDITSECTION__ keyword
13400 !! wikitext
13401 __NOEDITSECTION__
13402 ==Section 1==
13403 ==Section 2==
13404 !! html
13405 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13406 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13407
13408 !! end
13409
13410 !! test
13411 Link inside a section heading
13412 !! wikitext
13413 ==Section with a [[Main Page|link]] in it==
13414 !! html
13415 <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>
13416
13417 !! end
13418
13419 !! test
13420 TOC regression (bug 12077)
13421 !! wikitext
13422 __TOC__
13423 == title 1 ==
13424 === title 1.1 ===
13425 == title 2 ==
13426 !! html
13427 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13428 <ul>
13429 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13430 <ul>
13431 <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>
13432 </ul>
13433 </li>
13434 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13435 </ul>
13436 </div>
13437
13438 <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>
13439 <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>
13440 <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>
13441
13442 !! end
13443
13444 !! test
13445 BUG 1219 URL next to image (good)
13446 !! wikitext
13447 http://example.com [[File:Foobar.jpg]]
13448 !! html/php
13449 <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>
13450 </p>
13451 !! html/parsoid
13452 <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" height="220" width="1941"/></a></span></p>
13453 !!end
13454
13455 !! test
13456 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13457 !! wikitext
13458 ===
13459 The line above must have a trailing space!
13460 === <!--
13461 --> <!-- -->
13462 But just in case it doesn't...
13463 !! html
13464 <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>
13465 <p>The line above must have a trailing space!
13466 </p>
13467 <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>
13468 <p>But just in case it doesn't...
13469 </p>
13470 !! end
13471
13472 !! test
13473 Header with special characters (bug 25462)
13474 !! wikitext
13475 The tooltips shall not show entities to the user (ie. be double escaped)
13476
13477 == text > text ==
13478 section 1
13479
13480 == text < text ==
13481 section 2
13482
13483 == text & text ==
13484 section 3
13485
13486 == text ' text ==
13487 section 4
13488
13489 == text " text ==
13490 section 5
13491 !! html
13492 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13493 </p>
13494 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13495 <ul>
13496 <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>
13497 <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>
13498 <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>
13499 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13500 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13501 </ul>
13502 </div>
13503
13504 <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 > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13505 <p>section 1
13506 </p>
13507 <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>
13508 <p>section 2
13509 </p>
13510 <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>
13511 <p>section 3
13512 </p>
13513 <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>
13514 <p>section 4
13515 </p>
13516 <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>
13517 <p>section 5
13518 </p>
13519 !! end
13520
13521 !! test
13522 Header with space, plus and underscore as entity
13523 !! wikitext
13524 Id should not contain + for spaces
13525
13526 == Space between Text ==
13527 section 1
13528
13529 == Space-Entity&#32;between&#32;Text ==
13530 section 2
13531
13532 == Plus+between+Text ==
13533 section 3
13534
13535 == Plus-Entity&#43;between&#43;Text ==
13536 section 4
13537
13538 == Underscore_between_Text ==
13539 section 5
13540
13541 == Underscore-Entity&#95;between&#95;Text ==
13542 section 6
13543
13544 [[#Space between Text]]
13545 [[#Space-Entity&#32;between&#32;Text]]
13546 [[#Plus+between+Text]]
13547 [[#Plus-Entity&#43;between&#43;Text]]
13548 [[#Underscore_between_Text]]
13549 [[#Underscore-Entity&#95;between&#95;Text]]
13550 !! html
13551 <p>Id should not contain + for spaces
13552 </p>
13553 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13554 <ul>
13555 <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>
13556 <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>
13557 <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>
13558 <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>
13559 <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>
13560 <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>
13561 </ul>
13562 </div>
13563
13564 <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>
13565 <p>section 1
13566 </p>
13567 <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>
13568 <p>section 2
13569 </p>
13570 <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>
13571 <p>section 3
13572 </p>
13573 <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>
13574 <p>section 4
13575 </p>
13576 <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>
13577 <p>section 5
13578 </p>
13579 <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>
13580 <p>section 6
13581 </p><p><a href="#Space_between_Text">#Space between Text</a>
13582 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13583 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13584 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13585 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13586 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13587 </p>
13588 !! end
13589
13590 !! test
13591 Headers with excess '=' characters
13592 (Are similar tests necessary beyond the 1st level?)
13593 !! wikitext
13594 =foo==
13595 ==foo=
13596 =''italic'' heading==
13597 ==''italic'' heading=
13598 !! html
13599 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13600 <ul>
13601 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13602 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13603 <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>
13604 <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>
13605 </ul>
13606 </div>
13607
13608 <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>
13609 <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>
13610 <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>
13611 <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>
13612
13613 !! end
13614
13615 !! test
13616 HTML headers vs TOC (bug 23393)
13617 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13618 !! wikitext
13619 <h1>Header 1</h1>
13620 == Header 1.1 ==
13621 == Header 1.2 ==
13622
13623 <h1>Header 2
13624 </h1>
13625 == Header 2.1 ==
13626 == Header 2.2 ==
13627 __NOEDITSECTION__
13628 !! html
13629 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13630 <ul>
13631 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13632 <ul>
13633 <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>
13634 <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>
13635 </ul>
13636 </li>
13637 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13638 <ul>
13639 <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>
13640 <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>
13641 </ul>
13642 </li>
13643 </ul>
13644 </div>
13645
13646 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13647 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13648 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13649 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13650 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13651 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13652
13653 !! end
13654
13655 !! test
13656 Single-line or multiline-comments can follow headings
13657 !! options
13658 parsoid=wt2html,wt2wt
13659 !! wikitext
13660 ==foo==<!---->
13661 ==bar==<!--c1-->
13662 ==baz==<!--
13663 c2
13664 c3-->
13665 !! html
13666 <h2><span class="mw-headline" id="foo">foo</span></h2>
13667 <h2><span class="mw-headline" id="bar">bar</span></h2>
13668 <h2><span class="mw-headline" id="baz">baz</span></h2>
13669
13670 !! end
13671
13672 !! test
13673 BUG 1219 URL next to image (broken)
13674 !! wikitext
13675 http://example.com[[File:Foobar.jpg]]
13676 !! html/php
13677 <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>
13678 </p>
13679 !! html/parsoid
13680 <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" height="220" width="1941"/></a></span></p>
13681 !!end
13682
13683 !! test
13684 Bug 1186 news: in the middle of text
13685 !! wikitext
13686 http://en.wikinews.org/wiki/Wikinews:Workplace
13687 !! html
13688 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13689 </p>
13690 !!end
13691
13692
13693 !! test
13694 Namespaced link must have a title
13695 !! wikitext
13696 [[Project:]]
13697 !! html
13698 <p>[[Project:]]
13699 </p>
13700 !!end
13701
13702 !! test
13703 Namespaced link must have a title (bad fragment version)
13704 !! wikitext
13705 [[Project:#fragment]]
13706 !! html
13707 <p>[[Project:#fragment]]
13708 </p>
13709 !!end
13710
13711
13712 ###
13713 ### HTML tags and HTML attributes
13714 ###
13715
13716 !! test
13717 div with no attributes
13718 !! wikitext
13719 <div>HTML rocks</div>
13720 !! html
13721 <div>HTML rocks</div>
13722
13723 !! end
13724
13725 !! test
13726 div with double-quoted attribute
13727 !! wikitext
13728 <div id="rock">HTML rocks</div>
13729 !! html
13730 <div id="rock">HTML rocks</div>
13731
13732 !! end
13733
13734 !! test
13735 div with single-quoted attribute
13736 !! wikitext
13737 <div id='rock'>HTML rocks</div>
13738 !! html
13739 <div id="rock">HTML rocks</div>
13740
13741 !! end
13742
13743 !! test
13744 div with unquoted attribute
13745 !! wikitext
13746 <div id=rock>HTML rocks</div>
13747 !! html
13748 <div id="rock">HTML rocks</div>
13749
13750 !! end
13751
13752 !! test
13753 div with illegal double attributes
13754 !! wikitext
13755 <div id="a" id="b">HTML rocks</div>
13756 !! html
13757 <div id="b">HTML rocks</div>
13758
13759 !!end
13760
13761 # FIXME: produce empty string instead of "class" in the PHP parser, following
13762 # the HTML5 spec.
13763 !! test
13764 div with empty attribute value, space before equals
13765 !! options
13766 parsoid
13767 !! wikitext
13768 <div class =>HTML rocks</div>
13769 !! html
13770 <div class="">HTML rocks</div>
13771
13772 !! end
13773
13774 !! test
13775 div with multiple empty attribute values
13776 !! options
13777 parsoid
13778 !! wikitext
13779 <div id= title=>HTML rocks</div>
13780 !! html
13781 <div id="" title="">HTML rocks</div>
13782
13783 !! end
13784
13785 !! test
13786 table with multiple empty attribute values
13787 !! options
13788 parsoid
13789 !! wikitext
13790 {| title= id=
13791 | hi
13792 |}
13793 !! html
13794 <table title="" id="">
13795 <tbody><tr><td> hi</td></tr>
13796 </tbody></table>
13797 !! end
13798
13799 !! test
13800 div with braces in attribute value
13801 !! wikitext
13802 <div title="{}">Foo</div>
13803 !! html/php
13804 <div title="&#123;}">Foo</div>
13805
13806 !! html/parsoid
13807 <div title="{}">Foo</div>
13808 !! end
13809
13810 # This it very inconsistent in the PHP parser: it returns
13811 # class="class" if there is a space between the name and the equal sign (see
13812 # 'div with empty attribute value, space before equals'), but strips the
13813 # attribute completely if the space is missing. We hope that not much content
13814 # depends on this, so are implementing the behavior below in Parsoid for
13815 # consistencies' sake.
13816 # FIXME: fix this behavior in the PHP parser?
13817 !! test
13818 div with empty attribute value, no space before equals
13819 !! options
13820 parsoid=wt2html,html2html
13821 !! wikitext
13822 <div class=>HTML rocks</div>
13823 !! html/php
13824 <div>HTML rocks</div>
13825
13826 !! html/parsoid
13827 <div class="">HTML rocks</div>
13828 !! end
13829
13830 !! test
13831 HTML multiple attributes correction
13832 !! wikitext
13833 <p class="error" class="awesome">Awesome!</p>
13834 !! html
13835 <p class="awesome">Awesome!</p>
13836
13837 !!end
13838
13839 !! test
13840 Table multiple attributes correction
13841 !! wikitext
13842 {|
13843 !+ class="error" class="awesome"| status
13844 |}
13845 !! html
13846 <table>
13847 <tr>
13848 <th class="awesome"> status
13849 </th></tr></table>
13850
13851 !!end
13852
13853 !! test
13854 DIV IN UPPERCASE
13855 !! wikitext
13856 <DIV ID="x">HTML ROCKS</DIV>
13857 !! html
13858 <div id="x">HTML ROCKS</div>
13859
13860 !!end
13861
13862 !! test
13863 Non-ASCII pseudo-tags are rendered as text
13864 !! wikitext
13865 <khyô>
13866 !! html
13867 <p>&lt;khyô&gt;
13868 </p>
13869 !! end
13870
13871 !! test
13872 Pseudo-tag with URL 'name' renders as url link
13873 !! wikitext
13874 <http://example.com/>
13875 !! html
13876 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13877 </p>
13878 !! end
13879
13880 !! test
13881 text with amp in the middle of nowhere
13882 !! wikitext
13883 Remember AT&T?
13884 !! html
13885 <p>Remember AT&amp;T?
13886 </p>
13887 !! end
13888
13889 !! test
13890 text with character entity: eacute
13891 !! wikitext
13892 I always thought &eacute; was a cute letter.
13893 !! html
13894 <p>I always thought &#233; was a cute letter.
13895 </p>
13896 !! html+tidy
13897 <p>I always thought é was a cute letter.</p>
13898 !! end
13899
13900 !! test
13901 text with entity-escaped character entity-like string: eacute
13902 !! wikitext
13903 I always thought &amp;eacute; was a cute letter.
13904 !! html
13905 <p>I always thought &amp;eacute; was a cute letter.
13906 </p>
13907 !! end
13908
13909 !! test
13910 text with undefined character entity: xacute
13911 !! wikitext
13912 I always thought &xacute; was a cute letter.
13913 !! html
13914 <p>I always thought &amp;xacute; was a cute letter.
13915 </p>
13916 !! end
13917
13918 # TODO: generalize to PHP parser?
13919 !! test
13920 HTML5 tags
13921 !! options
13922 parsoid
13923 !! wikitext
13924 <data value="5">five</data>
13925 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13926 <mark>This highlighted text</mark>
13927 !! html
13928 <p><data value="5">five</data>
13929 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13930 <mark>This highlighted text</mark></p>
13931 !! end
13932
13933 !! test
13934 HTML tag with leading space is parsed as text
13935 !! wikitext
13936 < div>foo< /div>
13937 !! html
13938 <p>&lt; div&gt;foo&lt; /div&gt;
13939 </p>
13940 !! end
13941
13942 ###
13943 ### Nesting tests (see bug 41545, 50604, 51081)
13944 ###
13945
13946 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13947 # Note that html2wt is considerably more difficult if we use <b> in
13948 # the test case, instead of <big>
13949 !! test
13950 Ensure that HTML adoption agency algorithm is properly implemented.
13951 !! wikitext
13952 <big>X<big>Y</big>Z</big>
13953 !! html
13954 <p><big>X<big>Y</big>Z</big>
13955 </p>
13956 !! end
13957
13958 # This was bug 41545 in the PHP parser.
13959 # Note that tidy doesn't handle this correctly.
13960 !! test
13961 Nesting of <kbd>
13962 !! wikitext
13963 <kbd>X<kbd>Y</kbd>Z</kbd>
13964 !! html
13965 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13966 </p>
13967 !! end
13968
13969 # The following cases were bug 51081 in the PHP parser.
13970 # Note that there are some other nestable tags (b, i, etc) which are
13971 # not covered; see bug 51081 for discussion.
13972
13973 # Note that tidy doesn't handle this correctly.
13974 !! test
13975 Nesting of <em>
13976 !! wikitext
13977 <em>X<em>Y</em>Z</em>
13978 !! html
13979 <p><em>X<em>Y</em>Z</em>
13980 </p>
13981 !! end
13982
13983 # Note that tidy doesn't handle this correctly.
13984 !! test
13985 Nesting of <strong>
13986 !! wikitext
13987 <strong>X<strong>Y</strong>Z</strong>
13988 !! html
13989 <p><strong>X<strong>Y</strong>Z</strong>
13990 </p>
13991 !! end
13992
13993 !! test
13994 Nesting of <q>
13995 !! wikitext
13996 <q>X<q>Y</q>Z</q>
13997 !! html+tidy
13998 <p><q>X<q>Y</q>Z</q></p>
13999 !! end
14000
14001 # Note that tidy doesn't handle this correctly.
14002 !! test
14003 Nesting of <ruby>
14004 !! wikitext
14005 <ruby>X<ruby>Y</ruby>Z</ruby>
14006 !! html
14007 <p><ruby>X<ruby>Y</ruby>Z</ruby>
14008 </p>
14009 !! end
14010
14011 # Note that tidy doesn't handle this correctly.
14012 !! test
14013 Nesting of <bdo>
14014 !! wikitext
14015 <bdo>X<bdo>Y</bdo>Z</bdo>
14016 !! html
14017 <p><bdo>X<bdo>Y</bdo>Z</bdo>
14018 </p>
14019 !! end
14020
14021
14022 ###
14023 ### Media links
14024 ###
14025
14026 !! test
14027 Media link
14028 !! wikitext
14029 [[Media:Foobar.jpg]]
14030 !! html
14031 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
14032 </p>
14033 !! end
14034
14035 !! test
14036 Media link with text
14037 !! wikitext
14038 [[Media:Foobar.jpg|A neat file to look at]]
14039 !! html
14040 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
14041 </p>
14042 !! end
14043
14044 # FIXME: this is still bad HTML tag nesting
14045 !! test
14046 Media link with nasty text
14047 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
14048 !! wikitext
14049 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
14050 !! html
14051 <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>
14052
14053 !! html+tidy
14054 <p><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></p>
14055 !! end
14056
14057 !! test
14058 Media link to nonexistent file (bug 1702)
14059 !! wikitext
14060 [[Media:No such.jpg]]
14061 !! html
14062 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
14063 </p>
14064 !! end
14065
14066 !! test
14067 Image link to nonexistent file (bug 1850 - good)
14068 !! wikitext
14069 [[File:No_such.jpg]]
14070 !! html/php
14071 <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>
14072 </p>
14073 !! html/parsoid
14074 <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>
14075 !! end
14076
14077 !! test
14078 :Image link to nonexistent file (bug 1850 - bad)
14079 !! wikitext
14080 [[:Image:No such.jpg]]
14081 !! html/php
14082 <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>
14083 </p>
14084 !! html/parsoid
14085 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
14086 !! end
14087
14088
14089
14090 !! test
14091 Character reference normalization in link text (bug 1938)
14092 !! wikitext
14093 [[Main Page|this&that]]
14094 !! html
14095 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
14096 </p>
14097 !!end
14098
14099 !! article
14100 אַ
14101 !! text
14102 Test for unicode normalization
14103
14104 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14105 !! endarticle
14106
14107 !! test
14108 (bug 19451) Links should refer to the normalized form.
14109 !! wikitext
14110 [[&#xFB2E;]]
14111 [[&#x5d0;&#x5b7;]]
14112 [[&#x5d0;ַ]]
14113 [[א&#x5b7;]]
14114 [[אַ]]
14115 !! html
14116 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14117 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14118 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14119 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14120 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14121 </p>
14122 !! end
14123
14124 !! test
14125 Empty attribute crash test (bug 2067)
14126 !! wikitext
14127 <font color="">foo</font>
14128 !! html
14129 <p><font color="">foo</font>
14130 </p>
14131 !! end
14132
14133 !! test
14134 Empty attribute crash test single-quotes (bug 2067)
14135 !! wikitext
14136 <font color=''>foo</font>
14137 !! html
14138 <p><font color="">foo</font>
14139 </p>
14140 !! end
14141
14142 !! test
14143 Attribute test: equals, then nothing
14144 !! wikitext
14145 <font color=>foo</font>
14146 !! html
14147 <p><font>foo</font>
14148 </p>
14149 !! end
14150
14151 !! test
14152 Attribute test: unquoted value
14153 !! wikitext
14154 <font color=x>foo</font>
14155 !! html
14156 <p><font color="x">foo</font>
14157 </p>
14158 !! end
14159
14160 !! test
14161 Attribute test: unquoted but illegal value (hash)
14162 !! wikitext
14163 <font color=#x>foo</font>
14164 !! html
14165 <p><font color="#x">foo</font>
14166 </p>
14167 !! end
14168
14169 !! test
14170 Attribute test: no value
14171 !! wikitext
14172 <font color>foo</font>
14173 !! html
14174 <p><font color="color">foo</font>
14175 </p>
14176 !! end
14177
14178 !! test
14179 Bug 2095: link with three closing brackets
14180 !! wikitext
14181 [[Main Page]]]
14182 !! html/php
14183 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14184 </p>
14185 !! html/parsoid
14186 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14187 !! end
14188
14189 !! test
14190 Bug 2095: link with pipe and three closing brackets
14191 !! wikitext
14192 [[Main Page|link]]]
14193 !! html/php
14194 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14195 </p>
14196 !! html/parsoid
14197 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14198 !! end
14199
14200 !! test
14201 Bug 2095: link with pipe and three closing brackets, version 2
14202 !! wikitext
14203 [[Main Page|[http://example.com/]]]
14204 !! html/php
14205 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14206 </p>
14207 !! html/parsoid
14208 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14209 !! end
14210
14211
14212 ###
14213 ### Safety
14214 ###
14215
14216 !! article
14217 Template:Dangerous attribute
14218 !! text
14219 " onmouseover="alert(document.cookie)
14220 !! endarticle
14221
14222 !! article
14223 Template:Dangerous style attribute
14224 !! text
14225 border-size: expression(alert(document.cookie))
14226 !! endarticle
14227
14228 !! article
14229 Template:Div style
14230 !! text
14231 <div style="float: right; {{{1}}}">Magic div</div>
14232 !! endarticle
14233
14234 !! test
14235 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14236 !! wikitext
14237 <div title="{{test}}"></div>
14238 !! html
14239 <div title="This is a test template"></div>
14240
14241 !! end
14242
14243 # Parsoid has enough context to handle this case
14244 !! test
14245 Bug 2304: HTML attribute safety (dangerous template; 2309)
14246 !! wikitext
14247 <div title="{{dangerous attribute}}"></div>
14248 !! html/php
14249 <div title=""></div>
14250
14251 !! html/parsoid
14252 <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>
14253 !! end
14254
14255 !! test
14256 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14257 !! wikitext
14258 <div style="{{dangerous style attribute}}"></div>
14259 !! html
14260 <div style="/* insecure input */"></div>
14261
14262 !! end
14263
14264 !! test
14265 Bug 2304: HTML attribute safety (safe parameter; 2309)
14266 !! wikitext
14267 {{div style|width: 200px}}
14268 !! html
14269 <div style="float: right; width: 200px">Magic div</div>
14270
14271 !! end
14272
14273 !! test
14274 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14275 !! wikitext
14276 {{div style|width: expression(alert(document.cookie))}}
14277 !! html
14278 <div style="/* insecure input */">Magic div</div>
14279
14280 !! end
14281
14282 !! test
14283 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14284 !! wikitext
14285 {{div style|"><script>alert(document.cookie)</script>}}
14286 !! html
14287 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14288
14289 !! end
14290
14291 !! test
14292 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14293 !! wikitext
14294 {{div style|" ><script>alert(document.cookie)</script>}}
14295 !! html
14296 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14297
14298 !! end
14299
14300 !! test
14301 Bug 2304: HTML attribute safety (link)
14302 !! wikitext
14303 <div title="[[Main Page]]"></div>
14304 !! html
14305 <div title="&#91;&#91;Main Page]]"></div>
14306
14307 !! end
14308
14309 !! test
14310 Bug 2304: HTML attribute safety (italics)
14311 !! wikitext
14312 <div title="''foobar''"></div>
14313 !! html
14314 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14315
14316 !! end
14317
14318 !! test
14319 Bug 2304: HTML attribute safety (bold)
14320 !! wikitext
14321 <div title="'''foobar'''"></div>
14322 !! html
14323 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14324
14325 !! end
14326
14327
14328 !! test
14329 Bug 2304: HTML attribute safety (ISBN)
14330 !! wikitext
14331 <div title="ISBN 1234567890"></div>
14332 !! html
14333 <div title="&#73;SBN 1234567890"></div>
14334
14335 !! end
14336
14337 !! test
14338 Bug 2304: HTML attribute safety (RFC)
14339 !! wikitext
14340 <div title="RFC 1234"></div>
14341 !! html
14342 <div title="&#82;FC 1234"></div>
14343
14344 !! end
14345
14346 !! test
14347 Bug 2304: HTML attribute safety (PMID)
14348 !! wikitext
14349 <div title="PMID 1234567890"></div>
14350 !! html
14351 <div title="&#80;MID 1234567890"></div>
14352
14353 !! end
14354
14355 !! test
14356 Bug 2304: HTML attribute safety (web link)
14357 !! wikitext
14358 <div title="http://example.com/"></div>
14359 !! html
14360 <div title="http&#58;//example.com/"></div>
14361
14362 !! end
14363
14364 !! test
14365 Bug 2304: HTML attribute safety (named web link)
14366 !! wikitext
14367 <div title="[http://example.com/ link]"></div>
14368 !! html
14369 <div title="&#91;http&#58;//example.com/ link]"></div>
14370
14371 !! end
14372
14373 !! test
14374 Bug 3244: HTML attribute safety (extension; safe)
14375 !! wikitext
14376 <div style="<nowiki>background:blue</nowiki>"></div>
14377 !! html
14378 <div style="background:blue"></div>
14379
14380 !! end
14381
14382 !! test
14383 Bug 3244: HTML attribute safety (extension; unsafe)
14384 !! wikitext
14385 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14386 !! html
14387 <div style="/* insecure input */"></div>
14388
14389 !! end
14390
14391 # More MSIE fun discovered by Tom Gilder
14392
14393 !! test
14394 MSIE CSS safety test: spurious slash
14395 !! wikitext
14396 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14397 !! html
14398 <div style="/* insecure input */">evil</div>
14399
14400 !! end
14401
14402 !! test
14403 MSIE CSS safety test: hex code
14404 !! wikitext
14405 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14406 !! html
14407 <div style="/* insecure input */">evil</div>
14408
14409 !! end
14410
14411 !! test
14412 MSIE CSS safety test: comment in url
14413 !! wikitext
14414 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14415 !! html
14416 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14417
14418 !! end
14419
14420 !! test
14421 MSIE CSS safety test: comment in expression
14422 !! wikitext
14423 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14424 !! html
14425 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14426
14427 !! end
14428
14429 !! test
14430 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14431 !! wikitext
14432 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14433 !! html
14434 <p style="/* invalid control char */">A</p>
14435
14436 !! end
14437
14438 !! test
14439 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14440 !! wikitext
14441 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14442 <div style="top:EXPRESSION(alert())">B</div>
14443 !! html
14444 <p style="/* insecure input */">A</p>
14445 <div style="/* insecure input */">B</div>
14446
14447 !! end
14448
14449 !! test
14450 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14451 !! wikitext
14452 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14453 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14454 !! html
14455 <div style="/* insecure input */">A</div>
14456 <p style="/* insecure input */">B</p>
14457
14458 !! end
14459
14460 !! test
14461 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14462 !! wikitext
14463 <div style="background-image:url⁽javascript:alert())">A</div>
14464 <div style="background-image:url₍javascript:alert())">B</div>
14465 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14466 !! html
14467 <div style="/* insecure input */">A</div>
14468 <div style="/* insecure input */">B</div>
14469 <p style="/* insecure input */">C</p>
14470
14471 !! end
14472
14473 !! test
14474 Opera -o-link CSS
14475 !! wikitext
14476 <div
14477 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;"
14478 style="-o-link:attr(title);-o-link-source:current">X</div>
14479 !! html
14480 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14481
14482 !! end
14483
14484 !! test
14485 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14486 !! wikitext
14487 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14488 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14489 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14490 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14491 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14492 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14493 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14494 !! html
14495 <p style="/* insecure input */">A</p>
14496 <p style="/* insecure input */">B</p>
14497 <p style="/* insecure input */">C</p>
14498 <p style="/* insecure input */">D</p>
14499 <p style="/* insecure input */">E</p>
14500 <p style="/* insecure input */">F</p>
14501 <p style="/* insecure input */">G</p>
14502
14503 !! end
14504
14505 !! test
14506 Table attribute legitimate extension
14507 !! wikitext
14508 {|
14509 !+ style="<nowiki>color:blue</nowiki>"| status
14510 |}
14511 !! html
14512 <table>
14513 <tr>
14514 <th style="color:blue"> status
14515 </th></tr></table>
14516
14517 !!end
14518
14519 !! test
14520 Table attribute safety
14521 !! wikitext
14522 {|
14523 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14524 |}
14525 !! html
14526 <table>
14527 <tr>
14528 <th style="/* insecure input */"> status
14529 </th></tr></table>
14530
14531 !! end
14532
14533 !! test
14534 CSS line continuation 1
14535 !! wikitext
14536 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14537 !! html
14538 <div style="/* insecure input */"></div>
14539
14540 !! end
14541
14542 !! test
14543 CSS line continuation 2
14544 !! wikitext
14545 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14546 !! html
14547 <div style="/* insecure input */"></div>
14548
14549 !! end
14550
14551 !! article
14552 Template:Identity
14553 !! text
14554 {{{1}}}
14555 !! endarticle
14556
14557 !! test
14558 Expansion of multi-line templates in attribute values (bug 6255)
14559 !! wikitext
14560 <div style="background: {{identity|#00FF00}}">-</div>
14561 !! html
14562 <div style="background: #00FF00">-</div>
14563
14564 !! end
14565
14566
14567 !! test
14568 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14569 !! wikitext
14570 <div style="background:
14571 #00FF00">-</div>
14572 !! html/php
14573 <div style="background: #00FF00">-</div>
14574
14575 !! html/parsoid
14576 <div style="background:
14577 #00FF00">-</div>
14578 !! end
14579
14580 !! test
14581 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14582 !! wikitext
14583 <div style="background: &#10;#00FF00">-</div>
14584 !! html
14585 <div style="background: &#10;#00FF00">-</div>
14586
14587 !! end
14588
14589 !! test
14590 evil <math>-wiki-tags without Extension:Math enabled
14591 !! wikitext
14592 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14593 !! html+tidy
14594 <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>
14595 !! end
14596
14597 ###
14598 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14599 ###
14600 !! test
14601 Parser hook: empty input
14602 !! wikitext
14603 <tag></tag>
14604 !! html
14605 <pre>
14606 ''
14607 array (
14608 )
14609 </pre>
14610
14611 !! end
14612
14613 !! test
14614 Parser hook: empty input using terminated empty elements
14615 !! wikitext
14616 <tag/>
14617 !! html
14618 <pre>
14619 NULL
14620 array (
14621 )
14622 </pre>
14623
14624 !! end
14625
14626 !! test
14627 Parser hook: empty input using terminated empty elements (space before)
14628 !! wikitext
14629 <tag />
14630 !! html
14631 <pre>
14632 NULL
14633 array (
14634 )
14635 </pre>
14636
14637 !! end
14638
14639 !! test
14640 Parser hook: basic input
14641 !! wikitext
14642 <tag>input</tag>
14643 !! html
14644 <pre>
14645 'input'
14646 array (
14647 )
14648 </pre>
14649
14650 !! end
14651
14652
14653 !! test
14654 Parser hook: case insensitive
14655 !! wikitext
14656 <TAG>input</TAG>
14657 !! html
14658 <pre>
14659 'input'
14660 array (
14661 )
14662 </pre>
14663
14664 !! end
14665
14666
14667 !! test
14668 Parser hook: case insensitive, redux
14669 !! wikitext
14670 <TaG>input</TAg>
14671 !! html
14672 <pre>
14673 'input'
14674 array (
14675 )
14676 </pre>
14677
14678 !! end
14679
14680 !! test
14681 Parser hook: nested tags
14682 !! options
14683 noxml
14684 !! wikitext
14685 <tag><tag></tag></tag>
14686 !! html
14687 <pre>
14688 '<tag>'
14689 array (
14690 )
14691 </pre>&lt;/tag&gt;
14692
14693 !! end
14694
14695 !! test
14696 Parser hook: basic arguments
14697 !! wikitext
14698 <tag width=200 height = "100" depth = '50' square></tag>
14699 !! html
14700 <pre>
14701 ''
14702 array (
14703 'width' => '200',
14704 'height' => '100',
14705 'depth' => '50',
14706 'square' => 'square',
14707 )
14708 </pre>
14709
14710 !! end
14711
14712 !! test
14713 Parser hook: argument containing a forward slash (bug 5344)
14714 !! wikitext
14715 <tag filename='/tmp/bla'></tag>
14716 !! html
14717 <pre>
14718 ''
14719 array (
14720 'filename' => '/tmp/bla',
14721 )
14722 </pre>
14723
14724 !! end
14725
14726 !! test
14727 Parser hook: empty input using terminated empty elements (bug 2374)
14728 !! wikitext
14729 <tag foo=bar/>text
14730 !! html
14731 <pre>
14732 NULL
14733 array (
14734 'foo' => 'bar',
14735 )
14736 </pre>text
14737
14738 !! end
14739
14740 # </tag> should be output literally since there is no matching tag that begins it
14741 !! test
14742 Parser hook: basic arguments using terminated empty elements (bug 2374)
14743 !! wikitext
14744 <tag width=200 height = "100" depth = '50' square/>
14745 other stuff
14746 </tag>
14747 !! html
14748 <pre>
14749 NULL
14750 array (
14751 'width' => '200',
14752 'height' => '100',
14753 'depth' => '50',
14754 'square' => 'square',
14755 )
14756 </pre>
14757 <p>other stuff
14758 &lt;/tag&gt;
14759 </p>
14760 !! end
14761
14762 ###
14763 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14764 ###
14765
14766 !! test
14767 Parser hook: static parser hook not inside a comment
14768 !! wikitext
14769 <statictag>hello, world</statictag>
14770 <statictag action=flush/>
14771 !! html
14772 <p>hello, world
14773 </p>
14774 !! end
14775
14776
14777 !! test
14778 Parser hook: static parser hook inside a comment
14779 !! wikitext
14780 <!-- <statictag>hello, world</statictag> -->
14781 <statictag action=flush/>
14782 !! html
14783 <p><br />
14784 </p>
14785 !! end
14786
14787 # Nested template calls; this case was broken by Parser.php rev 1.506,
14788 # since reverted.
14789
14790 !! article
14791 Template:One-parameter
14792 !! text
14793 (My parameter is: {{{1}}})
14794 !! endarticle
14795
14796 !! article
14797 Template:Map-one-parameter
14798 !! text
14799 {{{{{1}}}|{{{2}}}}}
14800 !! endarticle
14801
14802 !! test
14803 Nested template calls
14804 !! wikitext
14805 {{Map-one-parameter|One-parameter|param}}
14806 !! html
14807 <p>(My parameter is: param)
14808 </p>
14809 !! end
14810
14811
14812 ###
14813 ### Sanitizer
14814 ###
14815
14816 # HTML+Tidy effectively strips out the empty tags completely
14817 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14818 # which Tidy would have done for the PHP parser had there been content inside it.
14819 !! test
14820 Sanitizer: Closing of open tags
14821 !! wikitext
14822 <s></s><table></table>
14823 !! html
14824 <s></s><table></table>
14825
14826 !! html/parsoid
14827 <p><s></s></p><table></table>
14828 !! end
14829
14830 !! test
14831 Sanitizer: Closing of open but not closed tags
14832 !! wikitext
14833 <s>foo
14834 !! html
14835 <p><s>foo</s>
14836 </p>
14837 !! end
14838
14839 !! test
14840 Sanitizer: Closing of closed but not open tags
14841 !! wikitext
14842 </s>
14843 !! html
14844 <p>&lt;/s&gt;
14845 </p>
14846 !! end
14847
14848 !! test
14849 Sanitizer: Closing of closed but not open table tags
14850 !! wikitext
14851 Table not started</td></tr></table>
14852 !! html
14853 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14854 </p>
14855 !! end
14856
14857 !! test
14858 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14859 !! wikitext
14860 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14861 !! html
14862 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14863 </p>
14864 !! end
14865
14866 # In HTML5, the restrictions are that id must contain at least one character,
14867 # and must not contain any space characters.
14868 !! test
14869 Sanitizer: Validating the contents of the id attribute (bug 4515)
14870 !! options
14871 disabled
14872 !! wikitext
14873 <br id="" /><br id="a space" />
14874 !! html
14875 Something ...
14876 !! end
14877
14878 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14879 !! test
14880 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14881 !! options
14882 disabled
14883 !! wikitext
14884 <br id="foo" /><br id="foo" />
14885 !! html
14886 Something need to be done. foo-2 ?
14887 !! end
14888
14889 !! test
14890 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14891 !! wikitext
14892 <div itemscope>
14893 <meta itemprop="hello" content="world">
14894 <meta http-equiv="refresh" content="5">
14895 <meta itemprop="hello" http-equiv="refresh" content="5">
14896 <link itemprop="hello" href="{{SERVER}}">
14897 <link rel="stylesheet" href="{{SERVER}}">
14898 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14899 </div>
14900 !! html
14901 <div itemscope="itemscope">
14902 <p> <meta itemprop="hello" content="world" />
14903 &lt;meta http-equiv="refresh" content="5"&gt;
14904 <meta itemprop="hello" content="5" />
14905 </p>
14906 <link itemprop="hello" href="http&#58;//example.org" />
14907 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14908 <link itemprop="hello" href="http&#58;//example.org" />
14909 </div>
14910
14911 !! end
14912
14913 !! test
14914 Language converter: output gets cut off unexpectedly (bug 5757)
14915 !! options
14916 language=zh
14917 !! wikitext
14918 this bit is safe: }-
14919
14920 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14921
14922 then we get cut off here: }-
14923
14924 all additional text is vanished
14925 !! html
14926 <p>this bit is safe: }-
14927 </p><p>but if we add a conversion instance: xxx
14928 </p><p>then we get cut off here: }-
14929 </p><p>all additional text is vanished
14930 </p>
14931 !! end
14932
14933 !! test
14934 Self closed html pairs (bug 5487)
14935 !! options
14936 !! wikitext
14937 <center><font id="bug" />Centered text</center>
14938 <div><font id="bug2" />In div text</div>
14939 !! html
14940 <center>&lt;font id="bug" /&gt;Centered text</center>
14941 <div>&lt;font id="bug2" /&gt;In div text</div>
14942
14943 !! end
14944
14945 #
14946 #
14947 #
14948
14949 !! test
14950 Punctuation: nbsp before exclamation
14951 !! wikitext
14952 C'est grave !
14953 !! html
14954 <p>C'est grave&#160;!
14955 </p>
14956 !! end
14957
14958 !! test
14959 Punctuation: CSS !important (bug 11874)
14960 !! wikitext
14961 <div style="width:50% !important">important</div>
14962 !! html
14963 <div style="width:50% !important">important</div>
14964
14965 !!end
14966
14967 !! test
14968 Punctuation: CSS ! important (bug 11874; with space after)
14969 !! wikitext
14970 <div style="width:50% ! important">important</div>
14971 !! html
14972 <div style="width:50% ! important">important</div>
14973
14974 !!end
14975
14976
14977 !! test
14978 HTML bullet list, closed tags (bug 5497)
14979 !! wikitext
14980 <ul>
14981 <li>One</li>
14982 <li>Two</li>
14983 </ul>
14984 !! html/php
14985 <ul>
14986 <li>One</li>
14987 <li>Two</li>
14988 </ul>
14989
14990 !! html/parsoid
14991 <ul data-parsoid='{"stx":"html"}'>
14992 <li data-parsoid='{"stx":"html"}'>One</li>
14993 <li data-parsoid='{"stx":"html"}'>Two</li>
14994 </ul>
14995
14996 !! end
14997
14998 !! test
14999 HTML bullet list, unclosed tags (bug 5497)
15000 !! wikitext
15001 <ul>
15002 <li>One
15003 <li>Two
15004 </ul>
15005 !! html/php+tidy
15006 <ul>
15007 <li>One</li>
15008 <li>Two</li>
15009 </ul>
15010 !! html/parsoid
15011 <ul data-parsoid='{"stx":"html"}'>
15012 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15013 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15014 </ul>
15015
15016 !! end
15017
15018 !! test
15019 HTML ordered list, closed tags (bug 5497)
15020 !! wikitext
15021 <ol>
15022 <li>One</li>
15023 <li>Two</li>
15024 </ol>
15025 !! html/php
15026 <ol>
15027 <li>One</li>
15028 <li>Two</li>
15029 </ol>
15030
15031 !! html/parsoid
15032 <ol data-parsoid='{"stx":"html"}'>
15033 <li data-parsoid='{"stx":"html"}'>One</li>
15034 <li data-parsoid='{"stx":"html"}'>Two</li>
15035 </ol>
15036
15037 !! end
15038
15039 !! test
15040 HTML ordered list, unclosed tags (bug 5497)
15041 !! options
15042 !! wikitext
15043 <ol>
15044 <li>One
15045 <li>Two
15046 </ol>
15047 !! html/php+tidy
15048 <ol>
15049 <li>One</li>
15050 <li>Two</li>
15051 </ol>
15052 !! html/parsoid
15053 <ol data-parsoid='{"stx":"html"}'>
15054 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15055 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15056 </ol>
15057
15058 !! end
15059
15060 !! test
15061 HTML nested bullet list, closed tags (bug 5497)
15062 !! wikitext
15063 <ul>
15064 <li>One</li>
15065 <li>Two:
15066 <ul>
15067 <li>Sub-one</li>
15068 <li>Sub-two</li>
15069 </ul>
15070 </li>
15071 </ul>
15072 !! html
15073 <ul>
15074 <li>One</li>
15075 <li>Two:
15076 <ul>
15077 <li>Sub-one</li>
15078 <li>Sub-two</li>
15079 </ul>
15080 </li>
15081 </ul>
15082
15083 !! end
15084
15085 !! test
15086 HTML nested bullet list, open tags (bug 5497)
15087 !! wikitext
15088 <ul>
15089 <li>One
15090 <li>Two:
15091 <ul>
15092 <li>Sub-one
15093 <li>Sub-two
15094 </ul>
15095 </ul>
15096 !! html/php+tidy
15097 <ul>
15098 <li>One</li>
15099 <li>Two:
15100 <ul>
15101 <li>Sub-one</li>
15102 <li>Sub-two</li>
15103 </ul>
15104 </li>
15105 </ul>
15106 !! html/parsoid
15107 <ul>
15108 <li>One
15109 </li>
15110 <li>Two:
15111 <ul>
15112 <li>Sub-one
15113 </li>
15114 <li>Sub-two
15115 </li>
15116 </ul>
15117 </li>
15118 </ul>
15119
15120 !! end
15121
15122 !! test
15123 HTML nested ordered list, closed tags (bug 5497)
15124 !! wikitext
15125 <ol>
15126 <li>One</li>
15127 <li>Two:
15128 <ol>
15129 <li>Sub-one</li>
15130 <li>Sub-two</li>
15131 </ol>
15132 </li>
15133 </ol>
15134 !! html
15135 <ol>
15136 <li>One</li>
15137 <li>Two:
15138 <ol>
15139 <li>Sub-one</li>
15140 <li>Sub-two</li>
15141 </ol>
15142 </li>
15143 </ol>
15144
15145 !! end
15146
15147 !! test
15148 HTML nested ordered list, open tags (bug 5497)
15149 !! wikitext
15150 <ol>
15151 <li>One
15152 <li>Two:
15153 <ol>
15154 <li>Sub-one
15155 <li>Sub-two
15156 </ol>
15157 </ol>
15158 !! html/php
15159 <ol>
15160 <li>One
15161 <li>Two:
15162 <ol>
15163 <li>Sub-one
15164 <li>Sub-two
15165 </ol>
15166 </ol>
15167
15168 !! html/parsoid
15169 <ol>
15170 <li>One
15171 </li>
15172 <li>Two:
15173 <ol>
15174 <li>Sub-one
15175 </li>
15176 <li>Sub-two
15177 </li>
15178 </ol>
15179 </li>
15180 </ol>
15181
15182 !! end
15183
15184 !! test
15185 HTML ordered list item with parameters oddity
15186 !! wikitext
15187 <ol><li id="fragment">One</li>
15188 </ol>
15189 !! html
15190 <ol><li id="fragment">One</li>
15191 </ol>
15192
15193 !! end
15194
15195 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15196 !!test
15197 bug 5918: autonumbering
15198 !! wikitext
15199 [http://first/] [http://second] [ftp://ftp]
15200
15201 ftp://inlineftp
15202
15203 [mailto:enclosed@mail.tld With target]
15204
15205 [mailto:enclosed@mail.tld]
15206
15207 mailto:inline@mail.tld
15208 !! html/php
15209 <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>
15210 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15211 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15212 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15213 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15214 </p>
15215 !! html/parsoid
15216 <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>
15217 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15218 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15219 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15220 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15221 !! end
15222
15223
15224 #
15225 # Security and HTML correctness
15226 # From Nick Jenkins' fuzz testing
15227 #
15228
15229 !! test
15230 Fuzz testing: Parser13
15231 !! wikitext
15232 {|
15233 | http://a|
15234 !! html
15235 <table>
15236 <tr>
15237 <td>
15238 </td>
15239 </tr>
15240 </table>
15241
15242 !! end
15243
15244 !! test
15245 Fuzz testing: Parser14
15246 !! wikitext
15247 == onmouseover= ==
15248 http://__TOC__
15249 !! html
15250 <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>
15251 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15252 <ul>
15253 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15254 </ul>
15255 </div>
15256
15257
15258 !! html+tidy
15259 <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>
15260 <p>http://</p>
15261 <div id="toc" class="toc">
15262 <div id="toctitle">
15263 <h2>Contents</h2>
15264 </div>
15265 <ul>
15266 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15267 </ul>
15268 </div>
15269 !! end
15270
15271 !! test
15272 Fuzz testing: Parser14-table
15273 !! wikitext
15274 ==a==
15275 {| STYLE=__TOC__
15276 !! html
15277 <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>
15278 <table style="&#95;_TOC&#95;_">
15279 <tr><td></td></tr>
15280 </table>
15281
15282 !! html+tidy
15283 <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>
15284 <table style="__TOC__">
15285 <tr>
15286 <td></td>
15287 </tr>
15288 </table>
15289 !! end
15290
15291 # Known to produce bogus xml (extra </td>)
15292 !! test
15293 Fuzz testing: Parser16
15294 !! options
15295 noxml
15296 !! wikitext
15297 {|
15298 !https://||||||
15299 !! html
15300 <table>
15301 <tr>
15302 <th>https://</th>
15303 <th></th>
15304 <th></th>
15305 <th>
15306 </td>
15307 </tr>
15308 </table>
15309
15310 !! html+tidy
15311 <table>
15312 <tr>
15313 <th>https://</th>
15314 <th></th>
15315 <th></th>
15316 <th></th>
15317 </tr>
15318 </table>
15319 !! end
15320
15321 !! test
15322 Fuzz testing: Parser21
15323 !! wikitext
15324 {|
15325 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15326 |
15327 !! html
15328 <table>
15329 <tr>
15330 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15331 </th>
15332 <td>
15333 </td>
15334 </tr>
15335 </table>
15336
15337 !! end
15338
15339 !! test
15340 Fuzz testing: Parser22
15341 !! wikitext
15342 http://===r:::https://b
15343
15344 {|
15345 !! html
15346 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15347 </p>
15348 <table>
15349 <tr><td></td></tr>
15350 </table>
15351
15352 !! end
15353
15354 # Known to produce bad XML for now
15355 !! test
15356 Fuzz testing: Parser24
15357 !! options
15358 noxml
15359 !! wikitext
15360 {|
15361 {{{|
15362 <u CLASS=
15363 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15364 <br style="onmouseover='alert(document.cookie);' " />
15365
15366 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15367 |
15368 !! html
15369 <table>
15370 {{{|
15371 <u class="&#124;">}}}} &gt;
15372 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15373
15374 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15375 <tr>
15376 <td></u>
15377 </td>
15378 </tr>
15379 </table>
15380
15381 !! end
15382
15383 # Note: the current result listed for this is not what the original one was,
15384 # but the original bug was JavaScript injection, which is fixed in any case.
15385 # It's not clear that the original result listed was any more correct than the
15386 # current one. Original result:
15387 # <p>{{{|
15388 # </p>
15389 # <li class="&#124;&#124;">
15390 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15391 !!test
15392 Fuzz testing: Parser25 (bug 6055)
15393 !! wikitext
15394 {{{
15395 |
15396 <LI CLASS=||
15397 >
15398 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15399 !! html
15400 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15401 </p>
15402 !! end
15403
15404 !!test
15405 Fuzz testing: URL adjacent extension (with space, clean)
15406 !! wikitext
15407 http://example.com <nowiki>junk</nowiki>
15408 !! html/php
15409 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15410 </p>
15411 !! html/parsoid
15412 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15413 !! end
15414
15415 !!test
15416 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15417 !! wikitext
15418 http://example.com<nowiki>junk</nowiki>
15419 !! html/php
15420 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15421 </p>
15422 !! html/parsoid
15423 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15424 !! end
15425
15426 !!test
15427 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15428 !! wikitext
15429 http://example.com<pre>junk</pre>
15430 !! html/php
15431 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15432
15433 !! html/php+tidy
15434 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15435 <pre>
15436 junk
15437 </pre>
15438 !! html/parsoid
15439 <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>
15440 !!end
15441
15442 !!test
15443 Fuzz testing: image with bogus manual thumbnail
15444 !! wikitext
15445 [[Image:foobar.jpg|thumbnail= ]]
15446 !! html/php
15447 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15448
15449 !! html/parsoid
15450 <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>
15451 !!end
15452
15453 !! test
15454 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15455 !! wikitext
15456 <pre dir="&#10;"></pre>
15457 !! html
15458 <pre dir="&#10;"></pre>
15459
15460 !! end
15461
15462 !! test
15463 Parsing optional HTML elements (Bug 6171)
15464 !! options
15465 !! wikitext
15466 <table>
15467 <tr>
15468 <td> Some tabular data</td>
15469 <td> More tabular data ...
15470 <td> And yet som tabular data</td>
15471 </tr>
15472 </table>
15473 !! html
15474 <table>
15475 <tr>
15476 <td> Some tabular data</td>
15477 <td> More tabular data ...
15478 </td><td> And yet som tabular data</td>
15479 </tr>
15480 </table>
15481
15482 !! end
15483
15484 !! test
15485 Correct handling of <td>, <tr> (Bug 6171)
15486 !! options
15487 !! wikitext
15488 <table>
15489 <tr>
15490 <td> Some tabular data</td>
15491 <td> More tabular data ...</td>
15492 <td> And yet som tabular data</td>
15493 </tr>
15494 </table>
15495 !! html
15496 <table>
15497 <tr>
15498 <td> Some tabular data</td>
15499 <td> More tabular data ...</td>
15500 <td> And yet som tabular data</td>
15501 </tr>
15502 </table>
15503
15504 !! end
15505
15506
15507 !! test
15508 Parsing crashing regression (fr:JavaScript)
15509 !! wikitext
15510 </body></x>
15511 !! html
15512 <p>&lt;/body&gt;&lt;/x&gt;
15513 </p>
15514 !! end
15515
15516 !! test
15517 Inline wiki vs wiki block nesting
15518 !! wikitext
15519 '''Bold paragraph
15520
15521 New wiki paragraph
15522 !! html
15523 <p><b>Bold paragraph</b>
15524 </p><p>New wiki paragraph
15525 </p>
15526 !! end
15527
15528 # FIXME: The current php output is documented
15529 # and desired output is the parsoid target.
15530 !! test
15531 Inline HTML vs wiki block nesting
15532 !! wikitext
15533 <b>Bold paragraph
15534
15535 New wiki paragraph
15536 !! html/php
15537 <p><b>Bold paragraph
15538 </p><p>New wiki paragraph</b>
15539 </p>
15540 !! html/parsoid
15541 <p><b>Bold paragraph</b>
15542 </p><p>New wiki paragraph
15543 </p>
15544 !! end
15545
15546 # Original result was this:
15547 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15548 # </p>
15549 # While that might be marginally more intuitive, maybe, the six-apostrophe
15550 # construct is clearly pathological and the result stated here (which is what
15551 # the parser actually does) is about as reasonable as anything.
15552 !!test
15553 Mixing markup for italics and bold
15554 !! options
15555 !! wikitext
15556 '''bold''''''bold''bolditalics'''''
15557 !! html
15558 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15559 </p>
15560 !! end
15561
15562
15563 !! article
15564 Xyzzyx
15565 !! text
15566 Article for special page transclusion test
15567 !! endarticle
15568
15569 !! test
15570 Special page transclusion
15571 !! options
15572 !! wikitext
15573 {{Special:Prefixindex/Xyzzyx}}
15574 !! html
15575 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15576
15577 !! end
15578
15579 !! test
15580 Special page transclusion twice (bug 5021)
15581 !! options
15582 !! wikitext
15583 {{Special:Prefixindex/Xyzzyx}}
15584 {{Special:Prefixindex/Xyzzyx}}
15585 !! html
15586 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15587 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15588
15589 !! end
15590
15591 !! test
15592 Transclusion of default MediaWiki message
15593 !! wikitext
15594 {{MediaWiki:Mainpage}}
15595 !! html
15596 <p>Main Page
15597 </p>
15598 !! end
15599
15600 !! test
15601 Transclusion of nonexistent MediaWiki message
15602 !! wikitext
15603 {{MediaWiki:Mainpagexxx}}
15604 !! html
15605 <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>
15606 </p>
15607 !! end
15608
15609 !! test
15610 Transclusion of MediaWiki message with underscore
15611 !! wikitext
15612 {{MediaWiki:history_short}}
15613 !! html
15614 <p>History
15615 </p>
15616 !! end
15617
15618 !! test
15619 Transclusion of MediaWiki message with space
15620 !! wikitext
15621 {{MediaWiki:history short}}
15622 !! html
15623 <p>History
15624 </p>
15625 !! end
15626
15627 !! test
15628 Invalid header with following text
15629 !! wikitext
15630 = x = y
15631 !! html
15632 <p>= x = y
15633 </p>
15634 !! end
15635
15636
15637 !! test
15638 Section extraction test (section 0)
15639 !! options
15640 section=0
15641 !! wikitext
15642 start
15643 ==a==
15644 ===aa===
15645 ====aaa====
15646 ==b==
15647 ===ba===
15648 ===bb===
15649 ====bba====
15650 ===bc===
15651 ==c==
15652 ===ca===
15653 !! html
15654 start
15655 !! end
15656
15657 !! test
15658 Section extraction test (section 1)
15659 !! options
15660 section=1
15661 !! wikitext
15662 start
15663 ==a==
15664 ===aa===
15665 ====aaa====
15666 ==b==
15667 ===ba===
15668 ===bb===
15669 ====bba====
15670 ===bc===
15671 ==c==
15672 ===ca===
15673 !! html
15674 ==a==
15675 ===aa===
15676 ====aaa====
15677 !! end
15678
15679 !! test
15680 Section extraction test (section 2)
15681 !! options
15682 section=2
15683 !! wikitext
15684 start
15685 ==a==
15686 ===aa===
15687 ====aaa====
15688 ==b==
15689 ===ba===
15690 ===bb===
15691 ====bba====
15692 ===bc===
15693 ==c==
15694 ===ca===
15695 !! html
15696 ===aa===
15697 ====aaa====
15698 !! end
15699
15700 !! test
15701 Section extraction test (section 3)
15702 !! options
15703 section=3
15704 !! wikitext
15705 start
15706 ==a==
15707 ===aa===
15708 ====aaa====
15709 ==b==
15710 ===ba===
15711 ===bb===
15712 ====bba====
15713 ===bc===
15714 ==c==
15715 ===ca===
15716 !! html
15717 ====aaa====
15718 !! end
15719
15720 !! test
15721 Section extraction test (section 4)
15722 !! options
15723 section=4
15724 !! wikitext
15725 start
15726 ==a==
15727 ===aa===
15728 ====aaa====
15729 ==b==
15730 ===ba===
15731 ===bb===
15732 ====bba====
15733 ===bc===
15734 ==c==
15735 ===ca===
15736 !! html
15737 ==b==
15738 ===ba===
15739 ===bb===
15740 ====bba====
15741 ===bc===
15742 !! end
15743
15744 !! test
15745 Section extraction test (section 5)
15746 !! options
15747 section=5
15748 !! wikitext
15749 start
15750 ==a==
15751 ===aa===
15752 ====aaa====
15753 ==b==
15754 ===ba===
15755 ===bb===
15756 ====bba====
15757 ===bc===
15758 ==c==
15759 ===ca===
15760 !! html
15761 ===ba===
15762 !! end
15763
15764 !! test
15765 Section extraction test (section 6)
15766 !! options
15767 section=6
15768 !! wikitext
15769 start
15770 ==a==
15771 ===aa===
15772 ====aaa====
15773 ==b==
15774 ===ba===
15775 ===bb===
15776 ====bba====
15777 ===bc===
15778 ==c==
15779 ===ca===
15780 !! html
15781 ===bb===
15782 ====bba====
15783 !! end
15784
15785 !! test
15786 Section extraction test (section 7)
15787 !! options
15788 section=7
15789 !! wikitext
15790 start
15791 ==a==
15792 ===aa===
15793 ====aaa====
15794 ==b==
15795 ===ba===
15796 ===bb===
15797 ====bba====
15798 ===bc===
15799 ==c==
15800 ===ca===
15801 !! html
15802 ====bba====
15803 !! end
15804
15805 !! test
15806 Section extraction test (section 8)
15807 !! options
15808 section=8
15809 !! wikitext
15810 start
15811 ==a==
15812 ===aa===
15813 ====aaa====
15814 ==b==
15815 ===ba===
15816 ===bb===
15817 ====bba====
15818 ===bc===
15819 ==c==
15820 ===ca===
15821 !! html
15822 ===bc===
15823 !! end
15824
15825 !! test
15826 Section extraction test (section 9)
15827 !! options
15828 section=9
15829 !! wikitext
15830 start
15831 ==a==
15832 ===aa===
15833 ====aaa====
15834 ==b==
15835 ===ba===
15836 ===bb===
15837 ====bba====
15838 ===bc===
15839 ==c==
15840 ===ca===
15841 !! html
15842 ==c==
15843 ===ca===
15844 !! end
15845
15846 !! test
15847 Section extraction test (section 10)
15848 !! options
15849 section=10
15850 !! wikitext
15851 start
15852 ==a==
15853 ===aa===
15854 ====aaa====
15855 ==b==
15856 ===ba===
15857 ===bb===
15858 ====bba====
15859 ===bc===
15860 ==c==
15861 ===ca===
15862 !! html
15863 ===ca===
15864 !! end
15865
15866 !! test
15867 Section extraction test (nonexistent section 11)
15868 !! options
15869 section=11
15870 !! wikitext
15871 start
15872 ==a==
15873 ===aa===
15874 ====aaa====
15875 ==b==
15876 ===ba===
15877 ===bb===
15878 ====bba====
15879 ===bc===
15880 ==c==
15881 ===ca===
15882 !! html
15883 !! end
15884
15885 !! test
15886 Section extraction test with bogus heading (section 1)
15887 !! options
15888 section=1
15889 !! wikitext
15890 ==a==
15891 ==bogus== not a legal section
15892 ==b==
15893 !! html
15894 ==a==
15895 ==bogus== not a legal section
15896 !! end
15897
15898 !! test
15899 Section extraction test with bogus heading (section 2)
15900 !! options
15901 section=2
15902 !! wikitext
15903 ==a==
15904 ==bogus== not a legal section
15905 ==b==
15906 !! html
15907 ==b==
15908 !! end
15909
15910 !! test
15911 Section extraction test with comment after heading (section 1)
15912 !! options
15913 section=1
15914 !! wikitext
15915 ==a==
15916 ==b== <!-- -->
15917 ==c==
15918 !! html
15919 ==a==
15920 !! end
15921
15922 !! test
15923 Section extraction test with comment after heading (section 2)
15924 !! options
15925 section=2
15926 !! wikitext
15927 ==a==
15928 ==b== <!-- -->
15929 ==c==
15930 !! html
15931 ==b== <!-- -->
15932 !! end
15933
15934 !! test
15935 Section extraction test with bogus <nowiki> heading (section 1)
15936 !! options
15937 section=1
15938 !! wikitext
15939 ==a==
15940 ==bogus== <nowiki>not a legal section</nowiki>
15941 ==b==
15942 !! html
15943 ==a==
15944 ==bogus== <nowiki>not a legal section</nowiki>
15945 !! end
15946
15947 !! test
15948 Section extraction test with bogus <nowiki> heading (section 2)
15949 !! options
15950 section=2
15951 !! wikitext
15952 ==a==
15953 ==bogus== <nowiki>not a legal section</nowiki>
15954 ==b==
15955 !! html
15956 ==b==
15957 !! end
15958
15959
15960 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15961 # instead of respecting commented sections
15962 !! test
15963 Section extraction prefixed by comment (section 1)
15964 !! options
15965 section=1
15966 !! wikitext
15967 <!-- -->==sec1==
15968 ==sec2==
15969 !! html
15970 ==sec2==
15971 !!end
15972
15973 !! test
15974 Section extraction prefixed by comment (section 2)
15975 !! options
15976 section=2
15977 !! wikitext
15978 <!-- -->==sec1==
15979 ==sec2==
15980 !! html
15981
15982 !!end
15983
15984
15985 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15986 # instead of respecting HTML-style headings
15987 !! test
15988 Section extraction, mixed wiki and html (section 1)
15989 !! options
15990 section=1
15991 !! wikitext
15992 <h2>unmarked</h2>
15993 unmarked
15994 ==1==
15995 one
15996 ==2==
15997 two
15998 !! html
15999 ==1==
16000 one
16001 !! end
16002
16003 !! test
16004 Section extraction, mixed wiki and html (section 2)
16005 !! options
16006 section=2
16007 !! wikitext
16008 <h2>unmarked</h2>
16009 unmarked
16010 ==1==
16011 one
16012 ==2==
16013 two
16014 !! html
16015 ==2==
16016 two
16017 !! end
16018
16019
16020 # Formerly testing for bug 3342
16021 !! test
16022 Section extraction, heading surrounded by <noinclude>
16023 !! options
16024 section=1
16025 !! wikitext
16026 <noinclude>==unmarked==</noinclude>
16027 ==marked==
16028 !! html
16029 ==marked==
16030 !!end
16031
16032 # Test behavior of bug 19910
16033 !! test
16034 Sectiion with all-equals
16035 !! options
16036 section=2
16037 !! wikitext
16038 ===
16039 The line above must have a trailing space
16040 === <!--
16041 --> <!-- -->
16042 But just in case it doesn't...
16043 !! html
16044 === <!--
16045 --> <!-- -->
16046 But just in case it doesn't...
16047 !! end
16048
16049 !! test
16050 Section replacement test (section 0)
16051 !! options
16052 replace=0,"xxx"
16053 !! wikitext
16054 start
16055 ==a==
16056 ===aa===
16057 ====aaa====
16058 ==b==
16059 ===ba===
16060 ===bb===
16061 ====bba====
16062 ===bc===
16063 ==c==
16064 ===ca===
16065 !! html
16066 xxx
16067
16068 ==a==
16069 ===aa===
16070 ====aaa====
16071 ==b==
16072 ===ba===
16073 ===bb===
16074 ====bba====
16075 ===bc===
16076 ==c==
16077 ===ca===
16078 !! end
16079
16080 !! test
16081 Section replacement test (section 1)
16082 !! options
16083 replace=1,"xxx"
16084 !! wikitext
16085 start
16086 ==a==
16087 ===aa===
16088 ====aaa====
16089 ==b==
16090 ===ba===
16091 ===bb===
16092 ====bba====
16093 ===bc===
16094 ==c==
16095 ===ca===
16096 !! html
16097 start
16098 xxx
16099
16100 ==b==
16101 ===ba===
16102 ===bb===
16103 ====bba====
16104 ===bc===
16105 ==c==
16106 ===ca===
16107 !! end
16108
16109 !! test
16110 Section replacement test (section 2)
16111 !! options
16112 replace=2,"xxx"
16113 !! wikitext
16114 start
16115 ==a==
16116 ===aa===
16117 ====aaa====
16118 ==b==
16119 ===ba===
16120 ===bb===
16121 ====bba====
16122 ===bc===
16123 ==c==
16124 ===ca===
16125 !! html
16126 start
16127 ==a==
16128 xxx
16129
16130 ==b==
16131 ===ba===
16132 ===bb===
16133 ====bba====
16134 ===bc===
16135 ==c==
16136 ===ca===
16137 !! end
16138
16139 !! test
16140 Section replacement test (section 3)
16141 !! options
16142 replace=3,"xxx"
16143 !! wikitext
16144 start
16145 ==a==
16146 ===aa===
16147 ====aaa====
16148 ==b==
16149 ===ba===
16150 ===bb===
16151 ====bba====
16152 ===bc===
16153 ==c==
16154 ===ca===
16155 !! html
16156 start
16157 ==a==
16158 ===aa===
16159 xxx
16160
16161 ==b==
16162 ===ba===
16163 ===bb===
16164 ====bba====
16165 ===bc===
16166 ==c==
16167 ===ca===
16168 !! end
16169
16170 !! test
16171 Section replacement test (section 4)
16172 !! options
16173 replace=4,"xxx"
16174 !! wikitext
16175 start
16176 ==a==
16177 ===aa===
16178 ====aaa====
16179 ==b==
16180 ===ba===
16181 ===bb===
16182 ====bba====
16183 ===bc===
16184 ==c==
16185 ===ca===
16186 !! html
16187 start
16188 ==a==
16189 ===aa===
16190 ====aaa====
16191 xxx
16192
16193 ==c==
16194 ===ca===
16195 !! end
16196
16197 !! test
16198 Section replacement test (section 5)
16199 !! options
16200 replace=5,"xxx"
16201 !! wikitext
16202 start
16203 ==a==
16204 ===aa===
16205 ====aaa====
16206 ==b==
16207 ===ba===
16208 ===bb===
16209 ====bba====
16210 ===bc===
16211 ==c==
16212 ===ca===
16213 !! html
16214 start
16215 ==a==
16216 ===aa===
16217 ====aaa====
16218 ==b==
16219 xxx
16220
16221 ===bb===
16222 ====bba====
16223 ===bc===
16224 ==c==
16225 ===ca===
16226 !! end
16227
16228 !! test
16229 Section replacement test (section 6)
16230 !! options
16231 replace=6,"xxx"
16232 !! wikitext
16233 start
16234 ==a==
16235 ===aa===
16236 ====aaa====
16237 ==b==
16238 ===ba===
16239 ===bb===
16240 ====bba====
16241 ===bc===
16242 ==c==
16243 ===ca===
16244 !! html
16245 start
16246 ==a==
16247 ===aa===
16248 ====aaa====
16249 ==b==
16250 ===ba===
16251 xxx
16252
16253 ===bc===
16254 ==c==
16255 ===ca===
16256 !! end
16257
16258 !! test
16259 Section replacement test (section 7)
16260 !! options
16261 replace=7,"xxx"
16262 !! wikitext
16263 start
16264 ==a==
16265 ===aa===
16266 ====aaa====
16267 ==b==
16268 ===ba===
16269 ===bb===
16270 ====bba====
16271 ===bc===
16272 ==c==
16273 ===ca===
16274 !! html
16275 start
16276 ==a==
16277 ===aa===
16278 ====aaa====
16279 ==b==
16280 ===ba===
16281 ===bb===
16282 xxx
16283
16284 ===bc===
16285 ==c==
16286 ===ca===
16287 !! end
16288
16289 !! test
16290 Section replacement test (section 8)
16291 !! options
16292 replace=8,"xxx"
16293 !! wikitext
16294 start
16295 ==a==
16296 ===aa===
16297 ====aaa====
16298 ==b==
16299 ===ba===
16300 ===bb===
16301 ====bba====
16302 ===bc===
16303 ==c==
16304 ===ca===
16305 !! html
16306 start
16307 ==a==
16308 ===aa===
16309 ====aaa====
16310 ==b==
16311 ===ba===
16312 ===bb===
16313 ====bba====
16314 xxx
16315
16316 ==c==
16317 ===ca===
16318 !!end
16319
16320 !! test
16321 Section replacement test (section 9)
16322 !! options
16323 replace=9,"xxx"
16324 !! wikitext
16325 start
16326 ==a==
16327 ===aa===
16328 ====aaa====
16329 ==b==
16330 ===ba===
16331 ===bb===
16332 ====bba====
16333 ===bc===
16334 ==c==
16335 ===ca===
16336 !! html
16337 start
16338 ==a==
16339 ===aa===
16340 ====aaa====
16341 ==b==
16342 ===ba===
16343 ===bb===
16344 ====bba====
16345 ===bc===
16346 xxx
16347 !! end
16348
16349 !! test
16350 Section replacement test (section 10)
16351 !! options
16352 replace=10,"xxx"
16353 !! wikitext
16354 start
16355 ==a==
16356 ===aa===
16357 ====aaa====
16358 ==b==
16359 ===ba===
16360 ===bb===
16361 ====bba====
16362 ===bc===
16363 ==c==
16364 ===ca===
16365 !! html
16366 start
16367 ==a==
16368 ===aa===
16369 ====aaa====
16370 ==b==
16371 ===ba===
16372 ===bb===
16373 ====bba====
16374 ===bc===
16375 ==c==
16376 xxx
16377 !! end
16378
16379 !! test
16380 Section replacement test with initial whitespace (bug 13728)
16381 !! options
16382 replace=2,"xxx"
16383 !! wikitext
16384 Preformatted initial line
16385 ==a==
16386 ===a===
16387 !! html
16388 Preformatted initial line
16389 ==a==
16390 xxx
16391 !! end
16392
16393
16394 !! test
16395 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16396 !! options
16397 section=1
16398 !! wikitext
16399 ==a==
16400 a
16401 !! html
16402 ==a==
16403 a
16404 !! end
16405
16406 !! test
16407 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16408 !! options
16409 section=1
16410 !! wikitext
16411 ==a==
16412 a
16413 !! html
16414 ==a==
16415 a
16416 !! end
16417
16418
16419 !! test
16420 Section extraction, <pre> around bogus header (bug 10309)
16421 !! options
16422 noxml section=2
16423 !! wikitext
16424 == Section One ==
16425 <pre>
16426 =======
16427 </pre>
16428
16429 == Section Two ==
16430 stuff
16431 !! html
16432 == Section Two ==
16433 stuff
16434 !! end
16435
16436 !! test
16437 Section replacement, <pre> around bogus header (bug 10309)
16438 !! options
16439 noxml replace=2,"xxx"
16440 !! wikitext
16441 == Section One ==
16442 <pre>
16443 =======
16444 </pre>
16445
16446 == Section Two ==
16447 stuff
16448 !! html
16449 == Section One ==
16450 <pre>
16451 =======
16452 </pre>
16453
16454 xxx
16455 !! end
16456
16457
16458
16459 !! test
16460 Handling of &#x0A; in URLs
16461 !! wikitext
16462 ** irc://&#x0A;a
16463 !! html/php
16464 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16465
16466 !! html/parsoid
16467 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16468 a">irc://
16469 a</a></li></ul></li></ul>
16470 !! end
16471
16472 !! test
16473 Handling of %0A in URLs
16474 !! wikitext
16475 ** irc://%0Aa
16476 !! html/php
16477 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16478
16479 !! html/parsoid
16480 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16481 !! end
16482
16483
16484 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16485 !! test
16486 5 quotes, code coverage +1 line
16487 !! options
16488 parsoid=wt2html
16489 !! wikitext
16490 '''''
16491 !! html/php
16492 !! html/parsoid
16493 <p><b><i></i></b></p>
16494 !! end
16495
16496 # same html as previous, but wikitext adjusted to match parsoid html2wt
16497 # note that wt2html and html2html will put the <i> before the <b>
16498 !! test
16499 5 quotes, code coverage +1 line w/ nowiki (1)
16500 !! options
16501 parsoid=wt2wt,html2wt
16502 !! wikitext
16503 '''''<nowiki/>'''''
16504 !! html/php
16505 <p><i></i>
16506 </p>
16507 !! html/parsoid
16508 <p><b><i></i></b></p>
16509 !! end
16510
16511 # same as previous, just swapping the <i> and <b>
16512 !! test
16513 5 quotes, code coverage +1 line w/ nowiki (2)
16514 !! wikitext
16515 '''''<nowiki/>'''''
16516 !! html/php
16517 <p><i></i>
16518 </p>
16519 !! html/parsoid
16520 <p><i><b></b></i></p>
16521 !! end
16522
16523 !! test
16524 Special:Search page linking.
16525 !! wikitext
16526 {{Special:search}}
16527 !! html
16528 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16529 </p>
16530 !! end
16531
16532 !! test
16533 {{!}} is a magic word
16534 !! wikitext
16535 {{!}} is a magic word there and {{!}} is still a magic word here
16536 !! html/php
16537 <p>| is a magic word there and | is still a magic word here
16538 </p>
16539 !! html/parsoid
16540 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is still a magic word here</p>
16541 !! end
16542
16543 !! test
16544 Say the magic word
16545 !! options
16546 title=[[Parser test]]
16547 !! wikitext
16548 * {{PAGENAME}}
16549 * {{PAGENAMEE}}
16550 * {{FULLPAGENAME}}
16551 * {{FULLPAGENAMEE}}
16552 * {{BASEPAGENAME}}
16553 * {{BASEPAGENAMEE}}
16554 * {{SUBPAGENAME}}
16555 * {{SUBPAGENAMEE}}
16556 * {{ROOTPAGENAME}}
16557 * {{ROOTPAGENAMEE}}
16558 * {{TALKPAGENAME}}
16559 * {{TALKPAGENAMEE}}
16560 * {{SUBJECTPAGENAME}}
16561 * {{SUBJECTPAGENAMEE}}
16562 * {{NAMESPACEE}}
16563 * {{NAMESPACE}}
16564 * {{NAMESPACENUMBER}}
16565 * {{TALKSPACE}}
16566 * {{TALKSPACEE}}
16567 * {{SUBJECTSPACE}}
16568 * {{SUBJECTSPACEE}}
16569 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16570 !! html
16571 <ul><li> Parser test</li>
16572 <li> Parser_test</li>
16573 <li> Parser test</li>
16574 <li> Parser_test</li>
16575 <li> Parser test</li>
16576 <li> Parser_test</li>
16577 <li> Parser test</li>
16578 <li> Parser_test</li>
16579 <li> Parser test</li>
16580 <li> Parser_test</li>
16581 <li> Talk:Parser test</li>
16582 <li> Talk:Parser_test</li>
16583 <li> Parser test</li>
16584 <li> Parser_test</li>
16585 <li> </li>
16586 <li> </li>
16587 <li> 0</li>
16588 <li> Talk</li>
16589 <li> Talk</li>
16590 <li> </li>
16591 <li> </li>
16592 <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>
16593
16594 !! end
16595 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16596
16597 !! test
16598 Gallery
16599 !! wikitext
16600 <gallery>
16601 image1.png |
16602 image2.gif|||||
16603
16604 image3|
16605 image4 |300px| centre
16606 image5.svg| http://///////
16607 [[x|xx]]]]
16608 * image6
16609 </gallery>
16610 !! html
16611 <ul class="gallery mw-gallery-traditional">
16612 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16613 <div class="thumb" style="height: 150px;">Image1.png</div>
16614 <div class="gallerytext">
16615 </div>
16616 </div></li>
16617 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16618 <div class="thumb" style="height: 150px;">Image2.gif</div>
16619 <div class="gallerytext">
16620 <p>||||
16621 </p>
16622 </div>
16623 </div></li>
16624 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16625 <div class="thumb" style="height: 150px;">Image3</div>
16626 <div class="gallerytext">
16627 </div>
16628 </div></li>
16629 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16630 <div class="thumb" style="height: 150px;">Image4</div>
16631 <div class="gallerytext">
16632 <p>300px| centre
16633 </p>
16634 </div>
16635 </div></li>
16636 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16637 <div class="thumb" style="height: 150px;">Image5.svg</div>
16638 <div class="gallerytext">
16639 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16640 </p>
16641 </div>
16642 </div></li>
16643 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16644 <div class="thumb" style="height: 150px;">* image6</div>
16645 <div class="gallerytext">
16646 </div>
16647 </div></li>
16648 </ul>
16649
16650 !! end
16651
16652 !! test
16653 Gallery (with options)
16654 !! wikitext
16655 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16656 File:Nonexistent.jpg|caption
16657 File:Nonexistent.jpg
16658 image:foobar.jpg|some '''caption''' [[Main Page]]
16659 image:foobar.jpg
16660 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16661 </gallery>
16662 !! html
16663 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16664 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16665 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16666 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16667 <div class="gallerytext">
16668 <p>caption
16669 </p>
16670 </div>
16671 </div></li>
16672 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16673 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16674 <div class="gallerytext">
16675 </div>
16676 </div></li>
16677 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16678 <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" /></a></div></div>
16679 <div class="gallerytext">
16680 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16681 </p>
16682 </div>
16683 </div></li>
16684 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16685 <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" /></a></div></div>
16686 <div class="gallerytext">
16687 </div>
16688 </div></li>
16689 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16690 <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" /></a></div></div>
16691 <div class="gallerytext">
16692 <p>Blabla|blabla.
16693 </p>
16694 </div>
16695 </div></li>
16696 </ul>
16697
16698 !! end
16699
16700 !! test
16701 Gallery with link that has fragment
16702 !! wikitext
16703 <gallery>
16704 image:foobar.jpg|link=Main_Page
16705 image:foobar.jpg|link=Main_Page#section
16706 image:foobar.jpg|link=Main Page#section|caption
16707 </gallery>
16708 !! html
16709 <ul class="gallery mw-gallery-traditional">
16710 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16711 <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" /></a></div></div>
16712 <div class="gallerytext">
16713 </div>
16714 </div></li>
16715 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16716 <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" /></a></div></div>
16717 <div class="gallerytext">
16718 </div>
16719 </div></li>
16720 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16721 <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" /></a></div></div>
16722 <div class="gallerytext">
16723 <p>caption
16724 </p>
16725 </div>
16726 </div></li>
16727 </ul>
16728
16729 !! end
16730
16731 !! test
16732 Gallery with wikitext inside caption
16733 !! wikitext
16734 <gallery>
16735 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16736 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16737 </gallery>
16738 !! html
16739 <ul class="gallery mw-gallery-traditional">
16740 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16741 <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" /></a></div></div>
16742 <div class="gallerytext">
16743 <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>
16744 </p>
16745 </div>
16746 </div></li>
16747 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16748 <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" /></a></div></div>
16749 <div class="gallerytext">
16750 <p>This is a test template
16751 </p>
16752 </div>
16753 </div></li>
16754 </ul>
16755
16756 !! end
16757
16758 !! test
16759 gallery (with showfilename option)
16760 !! wikitext
16761 <gallery showfilename>
16762 File:Nonexistent.jpg|caption
16763 File:Nonexistent.jpg
16764 image:foobar.jpg|some '''caption''' [[Main Page]]
16765 File:Foobar.jpg
16766 </gallery>
16767 !! html
16768 <ul class="gallery mw-gallery-traditional">
16769 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16770 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16771 <div class="gallerytext">
16772 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16773 caption
16774 </p>
16775 </div>
16776 </div></li>
16777 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16778 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16779 <div class="gallerytext">
16780 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16781 </p>
16782 </div>
16783 </div></li>
16784 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16785 <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" /></a></div></div>
16786 <div class="gallerytext">
16787 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16788 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16789 </p>
16790 </div>
16791 </div></li>
16792 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16793 <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" /></a></div></div>
16794 <div class="gallerytext">
16795 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16796 </p>
16797 </div>
16798 </div></li>
16799 </ul>
16800
16801 !! end
16802
16803 !! test
16804 Gallery (with namespace-less filenames)
16805 !! wikitext
16806 <gallery>
16807 File:Nonexistent.jpg
16808 Nonexistent.jpg
16809 image:foobar.jpg
16810 foobar.jpg
16811 </gallery>
16812 !! html
16813 <ul class="gallery mw-gallery-traditional">
16814 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16815 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16816 <div class="gallerytext">
16817 </div>
16818 </div></li>
16819 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16820 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16821 <div class="gallerytext">
16822 </div>
16823 </div></li>
16824 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16825 <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" /></a></div></div>
16826 <div class="gallerytext">
16827 </div>
16828 </div></li>
16829 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16830 <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" /></a></div></div>
16831 <div class="gallerytext">
16832 </div>
16833 </div></li>
16834 </ul>
16835
16836 !! end
16837
16838 !! test
16839 HTML Hex character encoding (spells the word "JavaScript")
16840 !! options
16841 parsoid=wt2html,wt2wt,html2html
16842 !! wikitext
16843 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16844 !! html/php
16845 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16846 </p>
16847 !! html/php+tidy
16848 <p>JavaScript</p>
16849 !! html/parsoid
16850 <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>
16851 !! end
16852
16853 !! test
16854 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16855 !! wikitext
16856 &#xsee;&#XSEE;
16857 !! html/php
16858 <p>&amp;#xsee;&amp;#XSEE;
16859 </p>
16860 !! html/parsoid
16861 <p>&amp;#xsee;&amp;#XSEE;</p>
16862 !! end
16863
16864 !! test
16865 HTML Hex character encoding mixed case
16866 !! options
16867 parsoid=wt2html,wt2wt,html2html
16868 !! wikitext
16869 &#xEE;&#Xee;
16870 !! html/php
16871 <p>&#xee;&#xee;
16872 </p>
16873 !! html/php+tidy
16874 <p>îî</p>
16875 !! html/parsoid
16876 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16877 !! end
16878
16879 !! test
16880 __FORCETOC__ override
16881 !! wikitext
16882 __NEWSECTIONLINK__
16883 __FORCETOC__
16884 !! html
16885 <p><br />
16886 </p>
16887 !! end
16888
16889 !! test
16890 ISBN code coverage
16891 !! wikitext
16892 ISBN 978-0-1234-56&#x20;789
16893 !! html
16894 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16895 </p>
16896 !! html+tidy
16897 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16898 !! html/parsoid
16899 <p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
16900 !! end
16901
16902 !! test
16903 ISBN followed by 5 spaces
16904 !! wikitext
16905 ISBN
16906 !! html
16907 <p>ISBN
16908 </p>
16909 !! end
16910
16911 !! test
16912 Double ISBN
16913 !! wikitext
16914 ISBN ISBN 1234567890
16915 !! html/php
16916 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16917 </p>
16918 !! html/parsoid
16919 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
16920 !! end
16921
16922 !! test
16923 ISBN with an X
16924 !! wikitext
16925 ISBN 3-462-04561-X
16926 ISBN 080442957X
16927 ISBN 978080442957X
16928 !! html/php
16929 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16930 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
16931 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
16932 </p>
16933 !! html/parsoid
16934 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
16935 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
16936 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
16937 !! end
16938
16939 !! test
16940 ISBN with empty prefix (parsoid test)
16941 !! wikitext
16942 ISBN 1234567890
16943 !! html/php
16944 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16945 </p>
16946 !! html/parsoid
16947 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16948 !! end
16949
16950 !! test
16951 Bug 22905: <abbr> followed by ISBN followed by </a>
16952 !! wikitext
16953 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16954 !! html/php
16955 <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>
16956 </p>
16957 !! html/parsoid
16958 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
16959 !! end
16960
16961 !! test
16962 Double RFC
16963 !! wikitext
16964 RFC RFC 1234
16965 !! html
16966 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16967 </p>
16968 !! end
16969
16970 !! test
16971 Double RFC with a wiki link
16972 !! wikitext
16973 RFC [[RFC 1234]]
16974 !! html
16975 <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>
16976 </p>
16977 !! end
16978
16979 !! test
16980 RFC code coverage
16981 !! wikitext
16982 RFC 983&#x20;987
16983 !! html
16984 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16985 </p>
16986 !! html+tidy
16987 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16988 !! end
16989
16990 !! test
16991 Centre-aligned image
16992 !! wikitext
16993 [[Image:foobar.jpg|centre]]
16994 !! html
16995 <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>
16996
16997 !!end
16998
16999 !! test
17000 None-aligned image
17001 !! wikitext
17002 [[Image:foobar.jpg|none]]
17003 !! html
17004 <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>
17005
17006 !!end
17007
17008 !! test
17009 Width + Height sized image (using px) (height is ignored)
17010 !! wikitext
17011 [[Image:foobar.jpg|640x480px]]
17012 !! html
17013 <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>
17014 </p>
17015 !!end
17016
17017 !! test
17018 Width-sized image (using px, no following whitespace)
17019 !! wikitext
17020 [[Image:foobar.jpg|640px]]
17021 !! html
17022 <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>
17023 </p>
17024 !!end
17025
17026 !! test
17027 Width-sized image (using px, with following whitespace - test regression from r39467)
17028 !! wikitext
17029 [[Image:foobar.jpg|640px ]]
17030 !! html
17031 <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>
17032 </p>
17033 !!end
17034
17035 !! test
17036 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17037 !! wikitext
17038 [[Image:foobar.jpg| 640px]]
17039 !! html
17040 <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>
17041 </p>
17042 !!end
17043
17044 !! test
17045 Image with page parameter
17046 !! options
17047 djvu
17048 !! wikitext
17049 [[File:LoremIpsum.djvu|page=2]]
17050 !! html/php
17051 <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>
17052 </p>
17053 !! html/parsoid
17054 <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" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
17055 !! end
17056
17057 !! test
17058 Another italics / bold test
17059 !! wikitext
17060 ''' ''x'
17061 !! html
17062 <pre>'<i> </i>x'
17063 </pre>
17064 !!end
17065
17066 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17067 !! test
17068 dt/dd/dl test
17069 !! wikitext
17070 :;;;::
17071 !! html/php
17072 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17073
17074 !! html/parsoid
17075 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17076
17077 !!end
17078
17079
17080 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17081 !! test
17082 Images with the "|" character in the comment
17083 !! wikitext
17084 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17085 !! html/php
17086 <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>
17087
17088 !! html/parsoid
17089 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
17090 !! end
17091
17092 !! test
17093 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17094 !! wikitext
17095 <html><script>alert(1);</script></html>
17096 !! html
17097 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17098 </p>
17099 !! end
17100
17101 !! test
17102 HTML with raw HTML ($wgRawHtml==true)
17103 !! options
17104 wgRawHtml=1
17105 !! wikitext
17106 <html><script>alert(1);</script></html>
17107 !! html
17108 <p><script>alert(1);</script>
17109 </p>
17110 !! end
17111
17112 !! test
17113 Parents of subpages, one level up
17114 !! options
17115 subpage title=[[Subpage test/L1/L2/L3]]
17116 !! wikitext
17117 [[../|L2]]
17118 !! html
17119 <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>
17120 </p>
17121 !! end
17122
17123
17124 !! test
17125 Parents of subpages, one level up, not named
17126 !! options
17127 subpage title=[[Subpage test/L1/L2/L3]]
17128 !! wikitext
17129 [[../]]
17130 !! html
17131 <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>
17132 </p>
17133 !! end
17134
17135
17136
17137 !! test
17138 Parents of subpages, two levels up
17139 !! options
17140 subpage title=[[Subpage test/L1/L2/L3]]
17141 !! wikitext
17142 [[../../|L1]]2
17143
17144 [[../../|L1]]l
17145 !! html
17146 <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
17147 </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>
17148 </p>
17149 !! end
17150
17151 !! test
17152 Parents of subpages, two levels up, without trailing slash or name.
17153 !! options
17154 subpage title=[[Subpage test/L1/L2/L3]]
17155 !! wikitext
17156 [[../..]]
17157 !! html
17158 <p>[[../..]]
17159 </p>
17160 !! end
17161
17162 !! test
17163 Parents of subpages, two levels up, with lots of extra trailing slashes.
17164 !! options
17165 subpage title=[[Subpage test/L1/L2/L3]]
17166 !! wikitext
17167 [[../../////]]
17168 !! html
17169 <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>
17170 </p>
17171 !! end
17172
17173 !! article
17174 Subpage test/L1/L2/L3Sibling
17175 !! text
17176 Sibling article
17177 !! endarticle
17178
17179 !! test
17180 Transclusion of a sibling page (one level up)
17181 !! options
17182 subpage title=[[Subpage test/L1/L2/L3]]
17183 !! wikitext
17184 {{../L3Sibling}}
17185 !! html
17186 <p>Sibling article
17187 </p>
17188 !! end
17189
17190 !! test
17191 Transclusion of a child page
17192 !! options
17193 subpage title=[[Subpage test/L1/L2]]
17194 !! wikitext
17195 {{/L3Sibling}}
17196 !! html
17197 <p>Sibling article
17198 </p>
17199 !! end
17200
17201 !! test
17202 Non-transclusion because of too many up levels
17203 !! options
17204 subpage title=[[Subpage test/L1/L2/L3]]
17205 !! wikitext
17206 {{../../../../More than parent}}
17207 !! html
17208 <p>{{../../../../More than parent}}
17209 </p>
17210 !! end
17211
17212 !! test
17213 Definition list code coverage
17214 !! wikitext
17215 ; title : def
17216 ; title : def
17217 ;title: def
17218 !! html/php
17219 <dl><dt> title &#160;</dt>
17220 <dd> def</dd>
17221 <dt> title&#160;</dt>
17222 <dd> def</dd>
17223 <dt>title</dt>
17224 <dd> def</dd></dl>
17225
17226 !! html/parsoid
17227 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17228 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17229 <dt>title</dt><dd> def</dd></dl>
17230 !! end
17231
17232 !! test
17233 Don't fall for the self-closing div
17234 !! wikitext
17235 <div>hello world</div/>
17236 !! html
17237 <div>hello world</div>
17238
17239 !! end
17240
17241 !! test
17242 MSGNW magic word
17243 !! wikitext
17244 {{MSGNW:msg}}
17245 !! html
17246 <p>&#91;&#91;:Template:Msg&#93;&#93;
17247 </p>
17248 !! end
17249
17250 !! test
17251 RAW magic word
17252 !! wikitext
17253 {{RAW:QUERTY}}
17254 !! html
17255 <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>
17256 </p>
17257 !! end
17258
17259 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17260 !! test
17261 Always escape literal '>' in output, not just after '<'
17262 !! wikitext
17263 ><>
17264 !! html
17265 <p>&gt;&lt;&gt;
17266 </p>
17267 !! end
17268
17269 !! test
17270 Template caching
17271 !! wikitext
17272 {{Test}}
17273 {{Test}}
17274 !! html
17275 <p>This is a test template
17276 This is a test template
17277 </p>
17278 !! end
17279
17280
17281 !! article
17282 MediaWiki:Fake
17283 !! text
17284 ==header==
17285 !! endarticle
17286
17287 !! test
17288 Inclusion of !userCanEdit() content
17289 !! wikitext
17290 {{MediaWiki:Fake}}
17291 !! html
17292 <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>
17293
17294 !! end
17295
17296
17297 !! test
17298 Out-of-order TOC heading levels
17299 !! wikitext
17300 ==2==
17301 ======6======
17302 ===3===
17303 =1=
17304 =====5=====
17305 ==2==
17306 !! html
17307 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17308 <ul>
17309 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17310 <ul>
17311 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17312 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17313 </ul>
17314 </li>
17315 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17316 <ul>
17317 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17318 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17319 </ul>
17320 </li>
17321 </ul>
17322 </div>
17323
17324 <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>
17325 <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>
17326 <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>
17327 <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>
17328 <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>
17329 <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>
17330
17331 !! end
17332
17333
17334 !! test
17335 ISBN with a dummy number
17336 !! wikitext
17337 ISBN ---
17338 !! html
17339 <p>ISBN ---
17340 </p>
17341 !! end
17342
17343
17344 !! test
17345 ISBN with space-delimited number
17346 !! wikitext
17347 ISBN 92 9017 032 8
17348 !! html
17349 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17350 </p>
17351 !! end
17352
17353
17354 !! test
17355 ISBN with multiple spaces, no number
17356 !! wikitext
17357 ISBN foo
17358 !! html
17359 <p>ISBN foo
17360 </p>
17361 !! end
17362
17363
17364 !! test
17365 ISBN length
17366 !! wikitext
17367 ISBN 123456789
17368
17369 ISBN 1234567890
17370
17371 ISBN 12345678901
17372 !! html
17373 <p>ISBN 123456789
17374 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17375 </p><p>ISBN 12345678901
17376 </p>
17377 !! end
17378
17379
17380 !! test
17381 ISBN with trailing year (bug 8110)
17382 !! wikitext
17383 ISBN 1-234-56789-0 - 2006
17384
17385 ISBN 1 234 56789 0 - 2006
17386 !! html
17387 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17388 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17389 </p>
17390 !! end
17391
17392
17393 !! test
17394 anchorencode
17395 !! wikitext
17396 {{anchorencode:foo bar©#%n}}
17397 !! html
17398 <p>foo_bar.C2.A9.23.25n
17399 </p>
17400 !! end
17401
17402 !! test
17403 anchorencode trims spaces
17404 !! wikitext
17405 {{anchorencode: __pretty__please__}}
17406 !! html
17407 <p>pretty_please
17408 </p>
17409 !! end
17410
17411 !! test
17412 anchorencode deals with links
17413 !! wikitext
17414 {{anchorencode: [[hello|world]] [[hi]]}}
17415 !! html
17416 <p>world_hi
17417 </p>
17418 !! end
17419
17420 !! test
17421 anchorencode deals with templates
17422 !! wikitext
17423 {{anchorencode: {{Foo}} }}
17424 !! html
17425 <p>FOO
17426 </p>
17427 !! end
17428
17429 !! test
17430 anchorencode encodes like the TOC generator: (bug 18431)
17431 !! wikitext
17432 === _ +:.3A%3A&&amp;]] ===
17433 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17434 __NOEDITSECTION__
17435 !! html
17436 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17437 <p>.2B:.3A.253A.26.26.5D.5D
17438 </p>
17439 !! end
17440
17441 !! test
17442 Bug 6200: blockquotes and paragraph formatting
17443 !! wikitext
17444 <blockquote>
17445 foo
17446 </blockquote>
17447
17448 bar
17449
17450 baz
17451 !! html
17452 <blockquote>
17453 <p>foo
17454 </p>
17455 </blockquote>
17456 <p>bar
17457 </p>
17458 <pre>baz
17459 </pre>
17460 !! end
17461
17462 !! test
17463 Bug 8293: Use of center tag ruins paragraph formatting
17464 !! wikitext
17465 <center>
17466 foo
17467 </center>
17468
17469 bar
17470
17471 baz
17472 !! html
17473 <center>
17474 <p>foo
17475 </p>
17476 </center>
17477 <p>bar
17478 </p>
17479 <pre>baz
17480 </pre>
17481 !! end
17482
17483 !!test
17484 Parsing of overlapping (improperly nested) inline html tags
17485 !! wikitext
17486 <span><s>x</span></s>
17487 !! html/php
17488 <p><span><s>x&lt;/span&gt;</s></span>
17489 </p>
17490 !! html/parsoid
17491 <p><span><s>x</s></span>
17492 </p>
17493 !!end
17494
17495 ###
17496 ### Language variants related tests
17497 ###
17498 !! test
17499 Self-link in language variants
17500 !! options
17501 title=[[Dunav]] language=sr
17502 !! wikitext
17503 Both [[Dunav]] and [[Дунав]] are names for this river.
17504 !! html
17505 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17506 </p>
17507 !!end
17508
17509 !! article
17510 Дуна
17511 !! text
17512 content
17513 !! endarticle
17514
17515 !! test
17516 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17517 !! options
17518 title=[[Duna]] language=sr
17519 !! wikitext
17520 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17521 !! html
17522 <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.
17523 </p>
17524 !! end
17525
17526 !! test
17527 Link to a section of a variant of this title shouldn't be parsed as self-link
17528 !! options
17529 title=[[Duna]] language=sr
17530 !! wikitext
17531 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17532 !! html
17533 <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.
17534 </p>
17535 !! end
17536
17537 !! test
17538 Link to pages in language variants
17539 !! options
17540 language=sr
17541 !! wikitext
17542 Main Page can be written as [[Маин Паге]]
17543 !! html
17544 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17545 </p>
17546 !!end
17547
17548
17549 !! test
17550 Multiple links to pages in language variants
17551 !! options
17552 language=sr
17553 !! wikitext
17554 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17555 !! html
17556 <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>.
17557 </p>
17558 !!end
17559
17560
17561 !! test
17562 Simple template in language variants
17563 !! options
17564 language=sr
17565 !! wikitext
17566 {{тест}}
17567 !! html
17568 <p>This is a test template
17569 </p>
17570 !! end
17571
17572
17573 !! test
17574 Template with explicit namespace in language variants
17575 !! options
17576 language=sr
17577 !! wikitext
17578 {{Template:тест}}
17579 !! html
17580 <p>This is a test template
17581 </p>
17582 !! end
17583
17584
17585 !! test
17586 Basic test for template parameter in language variants
17587 !! options
17588 language=sr
17589 !! wikitext
17590 {{парамтест|param=foo}}
17591 !! html
17592 <p>This is a test template with parameter foo
17593 </p>
17594 !! end
17595
17596
17597 !! test
17598 Simple category in language variants
17599 !! options
17600 language=sr cat
17601 !! wikitext
17602 [[Category:МедиаWики Усер'с Гуиде]]
17603 !! html
17604 <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>
17605 !! end
17606
17607
17608 !! article
17609 Category:分类
17610 !! text
17611 blah
17612 !! endarticle
17613
17614 !! article
17615 Category:分類
17616 !! text
17617 blah
17618 !! endarticle
17619
17620 !! test
17621 Don't convert blue categorylinks to another variant (bug 33210)
17622 !! options
17623 language=zh cat
17624 !! wikitext
17625 [[A]][[Category:分类]]
17626 !! html
17627 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17628 !! end
17629
17630
17631 !! test
17632 Stripping -{}- tags (language variants)
17633 !! options
17634 language=sr
17635 !! wikitext
17636 Latin proverb: -{Ne nuntium necare}-
17637 !! html
17638 <p>Latin proverb: Ne nuntium necare
17639 </p>
17640 !! end
17641
17642
17643 !! test
17644 Prevent conversion with -{}- tags (language variants)
17645 !! options
17646 language=sr variant=sr-ec
17647 !! wikitext
17648 Latinski: -{Ne nuntium necare}-
17649 !! html
17650 <p>Латински: Ne nuntium necare
17651 </p>
17652 !! end
17653
17654
17655 !! test
17656 Prevent conversion of text with -{}- tags (language variants)
17657 !! options
17658 language=sr variant=sr-ec
17659 !! wikitext
17660 Latinski: -{Ne nuntium necare}-
17661 !! html
17662 <p>Латински: Ne nuntium necare
17663 </p>
17664 !! end
17665
17666
17667 !! test
17668 Prevent conversion of links with -{}- tags (language variants)
17669 !! options
17670 language=sr variant=sr-ec
17671 !! wikitext
17672 -{[[Main Page]]}-
17673 !! html
17674 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17675 </p>
17676 !! end
17677
17678
17679 !! test
17680 -{}- tags within headlines (within html for parserConvert())
17681 !! options
17682 language=sr variant=sr-ec
17683 !! wikitext
17684 == -{Naslov}- ==
17685 !! html
17686 <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>
17687
17688 !! end
17689
17690
17691 !! test
17692 Explicit definition of language variant alternatives
17693 !! options
17694 language=zh variant=zh-tw
17695 !! wikitext
17696 -{zh:China;zh-tw:Taiwan}-, not China
17697 !! html
17698 <p>Taiwan, not China
17699 </p>
17700 !! end
17701
17702
17703 !! test
17704 Conversion around HTML tags
17705 !! options
17706 language=sr variant=sr-ec
17707 !! wikitext
17708 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17709 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17710 !! html
17711 <p>
17712 <span title="ЛаCтин">ски</span>
17713 </p>
17714 !! end
17715
17716
17717 !! test
17718 Explicit session-wise language variant mapping (A flag and - flag)
17719 !! options
17720 language=zh variant=zh-tw
17721 !! wikitext
17722 Taiwan is not China.
17723 But -{A|zh:China;zh-tw:Taiwan}- is China,
17724 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17725 and -{China}- is China.
17726 !! html
17727 <p>Taiwan is not China.
17728 But Taiwan is Taiwan,
17729 (This should be stripped!)
17730 and China is China.
17731 </p>
17732 !! end
17733
17734 !! test
17735 Explicit session-wise language variant mapping (H flag for hide)
17736 !! options
17737 language=zh variant=zh-tw
17738 !! wikitext
17739 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17740 Taiwan is China.
17741 !! html
17742 <p>(This should be stripped!)
17743 Taiwan is Taiwan.
17744 </p>
17745 !! end
17746
17747 !! test
17748 Adding explicit conversion rule for title (T flag)
17749 !! options
17750 language=zh variant=zh-tw showtitle
17751 !! wikitext
17752 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17753 !! html
17754 Taiwan
17755 <p>Should be stripped!
17756 </p>
17757 !! end
17758
17759 !! test
17760 Testing that changing the language variant here in the tests actually works
17761 !! options
17762 language=zh variant=zh showtitle
17763 !! wikitext
17764 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17765 !! html
17766 China
17767 <p>Should be stripped!
17768 </p>
17769 !! end
17770
17771 !! test
17772 Recursive conversion of alt and title attrs shouldn't clear converter state
17773 !! options
17774 language=zh variant=zh-cn showtitle
17775 !! wikitext
17776 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17777 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17778 !! html
17779 China
17780 <p>
17781 Should be stripped<span title="Exclamation">!</span>
17782 </p>
17783 !! end
17784
17785 !! test
17786 Bug 24072: more test on conversion rule for title
17787 !! options
17788 language=zh variant=zh-tw showtitle
17789 !! wikitext
17790 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17791 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17792 !! html
17793 Taiwan
17794 <p>This should be stripped!
17795 This won't take interferes with the title rule.
17796 </p>
17797 !! end
17798
17799 !! test
17800 Partly disable title conversion if variant == main language code
17801 !! options
17802 language=zh variant=zh title=[[ZH]] showtitle
17803 !! wikitext
17804 -{T|zh-cn:CN;zh-tw:TW}-
17805 !! html
17806 ZH
17807 <p>
17808 </p>
17809 !! end
17810
17811 !! test
17812 Partly disable title conversion if variant == main language code, more
17813 !! options
17814 language=zh variant=zh title=[[ZH]] showtitle
17815 !! wikitext
17816 -{T|TW}-
17817 !! html
17818 ZH
17819 <p>
17820 </p>
17821 !! end
17822
17823 !! test
17824 Raw output of variant escape tags (R flag)
17825 !! options
17826 language=zh variant=zh-tw
17827 !! wikitext
17828 Raw: -{R|zh:China;zh-tw:Taiwan}-
17829 !! html
17830 <p>Raw: zh:China;zh-tw:Taiwan
17831 </p>
17832 !! end
17833
17834 !! test
17835 Nested using of manual convert syntax
17836 !! options
17837 language=zh variant=zh-hk
17838 !! wikitext
17839 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17840 !! html
17841 <p>Nested: Hello Hong Kong!
17842 </p>
17843 !! end
17844
17845 !! test
17846 Proper conversion of text in external links
17847 !! options
17848 language=sr variant=sr-ec
17849 !! wikitext
17850 http://www.google.com
17851 gopher://www.google.com
17852 [http://www.google.com http://www.google.com]
17853 [gopher://www.google.com gopher://www.google.com]
17854 [https://www.google.com irc://www.google.com]
17855 [ftp://www.google.com www.google.com/ftp://dir]
17856 [//www.google.com www.google.com]
17857 !! html
17858 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17859 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17860 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17861 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17862 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17863 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17864 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17865 </p>
17866 !! end
17867
17868 !! test
17869 Do not convert roman numbers to language variants
17870 !! options
17871 language=sr variant=sr-ec
17872 !! wikitext
17873 Fridrih IV je car.
17874 !! html
17875 <p>Фридрих IV је цар.
17876 </p>
17877 !! end
17878
17879 !! test
17880 Unclosed language converter markup "-{"
17881 !! options
17882 language=sr
17883 !! wikitext
17884 -{T|hello
17885 !! html
17886 <p>-{T|hello
17887 </p>
17888 !! end
17889
17890 !! test
17891 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17892 !! options
17893 language=sr
17894 !! wikitext
17895 -{R|=&gt;}-
17896 !! html
17897 <p>=&gt;
17898 </p>
17899 !!end
17900
17901 !! test
17902 Don't break link parsing if language converter markup is in the caption.
17903 !! options
17904 language=sr variant=sr-ec
17905 !! wikitext
17906 [[Main Page|-{R|main page}-]]
17907 !! html
17908 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17909 </p>
17910 !! end
17911
17912 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17913 !! test
17914 Don't break image parsing if language converter markup is in the caption.
17915 !! options
17916 language=sr
17917 !! wikitext
17918 [[File:Foobar.jpg|-{R|caption}-]]
17919 !! html/parsoid
17920 <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>
17921 </p>
17922 !! end
17923
17924 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17925 !! test
17926 Don't break list handling if language converter markup is in the item.
17927 !! options
17928 language=zh variant=zh-cn
17929 !! wikitext
17930 ;-{zh-cn:AAA;zh-tw:BBB}-
17931 !! html/php
17932 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
17933
17934 !! html/parsoid
17935 <dl><dt>AAA
17936 </dt></dl>
17937 !! end
17938
17939 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17940 !! test
17941 Don't break table handling if language converter markup is in the cell.
17942 !! options
17943 language=sr variant=sr-ec
17944 !! wikitext
17945 {|
17946 |-
17947 | -{R|B}-
17948 |}
17949 !! html/php
17950 <table>
17951
17952 <tr>
17953 <td>Б}-
17954 </td></tr></table>
17955
17956 !! html/parsoid
17957 <table>
17958
17959 <tr>
17960 <td> B
17961 </td></tr></table>
17962
17963 !! end
17964
17965 !! test
17966 Bug 529: Uncovered bullet
17967 !! wikitext
17968 * Foo {{bullet}}
17969 !! html
17970 <ul><li> Foo </li>
17971 <li> Bar</li></ul>
17972
17973 !! end
17974
17975 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17976 # Templates in Wikipedia rely on this behavior, as tidy has always been
17977 # enabled there. These tests are normally run *without* tidy, so specify the
17978 # full output here.
17979 # To test realistic parsing behavior, apply a tidy-like transformation to both
17980 # the expected output and your parser's output.
17981 !! test
17982 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17983 !! wikitext
17984 ******* Foo {{bullet}}
17985 !! html
17986 <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>
17987 <li> Bar</li></ul>
17988
17989 !! end
17990
17991 !! test
17992 Bug 529: Uncovered table already at line-start
17993 !! wikitext
17994 x
17995
17996 {{table}}
17997 y
17998 !! html
17999 <p>x
18000 </p>
18001 <table>
18002 <tr>
18003 <td> 1 </td>
18004 <td> 2
18005 </td></tr>
18006 <tr>
18007 <td> 3 </td>
18008 <td> 4
18009 </td></tr></table>
18010 <p>y
18011 </p>
18012 !! end
18013
18014 !! test
18015 Bug 529: Uncovered bullet in parser function result
18016 !! wikitext
18017 * Foo {{lc:{{bullet}} }}
18018 !! html
18019 <ul><li> Foo </li>
18020 <li> bar</li></ul>
18021
18022 !! end
18023
18024 !! test
18025 Bug 5678: Double-parsed template argument
18026 !! wikitext
18027 {{lc:{{{1}}}|hello}}
18028 !! html
18029 <p>{{{1}}}
18030 </p>
18031 !! end
18032
18033 !! test
18034 Bug 5678: Double-parsed template invocation
18035 !! wikitext
18036 {{lc:{{paramtest {{!}} param = hello }} }}
18037 !! html
18038 <p>{{paramtest | param = hello }}
18039 </p>
18040 !! end
18041
18042 !! test
18043 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18044 !! options
18045 language=cs
18046 title=[[Main Page]]
18047 !! wikitext
18048 {{PRVNÍVELKÉ:ěščř}}
18049 {{prvnívelké:ěščř}}
18050 {{PRVNÍMALÉ:ěščř}}
18051 {{prvnímalé:ěščř}}
18052 {{MALÁ:ěščř}}
18053 {{malá:ěščř}}
18054 {{VELKÁ:ěščř}}
18055 {{velká:ěščř}}
18056 !! html
18057 <p>Ěščř
18058 Ěščř
18059 ěščř
18060 ěščř
18061 ěščř
18062 ěščř
18063 ĚŠČŘ
18064 ĚŠČŘ
18065 </p>
18066 !! end
18067
18068 !! test
18069 Morwen/13: Unclosed link followed by heading
18070 !! wikitext
18071 [[link
18072 ==heading==
18073 !! html
18074 <p>[[link
18075 </p>
18076 <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>
18077
18078 !! end
18079
18080 !! test
18081 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18082 !! wikitext
18083 {{foo|
18084 =heading=
18085 !! html
18086 <p>{{foo|
18087 </p>
18088 <h1><span class="mw-headline" id="heading">heading</span></h1>
18089
18090 !! end
18091
18092 !! test
18093 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18094 !! wikitext
18095 {{foo|
18096 ==heading==
18097 !! html
18098 <p>{{foo|
18099 </p>
18100 <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>
18101
18102 !! end
18103
18104 !! test
18105 Tildes in comments
18106 !! options
18107 pst
18108 !! wikitext
18109 <!-- ~~~~ -->
18110 !! html
18111 <!-- ~~~~ -->
18112 !! end
18113
18114 !! test
18115 Paragraphs inside divs (no extra line breaks)
18116 !! wikitext
18117 <div>Line one
18118
18119 Line two</div>
18120 !! html
18121 <div>Line one
18122 Line two</div>
18123
18124 !! end
18125
18126 !! test
18127 Paragraphs inside divs (extra line break on open)
18128 !! wikitext
18129 <div>
18130 Line one
18131
18132 Line two</div>
18133 !! html
18134 <div>
18135 <p>Line one
18136 </p>
18137 Line two</div>
18138
18139 !! end
18140
18141 !! test
18142 Paragraphs inside divs (extra line break on close)
18143 !! wikitext
18144 <div>Line one
18145
18146 Line two
18147 </div>
18148 !! html
18149 <div>Line one
18150 <p>Line two
18151 </p>
18152 </div>
18153
18154 !! end
18155
18156 !! test
18157 Paragraphs inside divs (extra line break on open and close)
18158 !! wikitext
18159 <div>
18160 Line one
18161
18162 Line two
18163 </div>
18164 !! html
18165 <div>
18166 <p>Line one
18167 </p><p>Line two
18168 </p>
18169 </div>
18170
18171 !! end
18172
18173 !! test
18174 Nesting tags, paragraphs on lines which begin with <div>
18175 !! wikitext
18176 <div></div><strong>A
18177 B</strong>
18178 !! html/php+tidy
18179 <p><strong>A</strong></p>
18180 <p><strong>B</strong></p>
18181 !! html/parsoid
18182 <div></div>
18183 <p><strong>A
18184 B</strong>
18185 </p>
18186 !! end
18187
18188 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18189 !! test
18190 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18191 !! wikitext
18192 <blockquote>Line one
18193
18194 Line two</blockquote>
18195 !! html
18196 <blockquote>Line one
18197 Line two</blockquote>
18198
18199 !! html+tidy
18200 <blockquote>
18201 <p>Line one Line two</p>
18202 </blockquote>
18203 !! end
18204
18205 !! test
18206 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18207 !! wikitext
18208 <blockquote>
18209 Line one
18210
18211 Line two</blockquote>
18212 !! html
18213 <blockquote>
18214 <p>Line one
18215 </p>
18216 Line two</blockquote>
18217
18218 !! html+tidy
18219 <blockquote>
18220 <p>Line one</p>
18221 Line two</blockquote>
18222 !! end
18223
18224 !! test
18225 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18226 !! wikitext
18227 <blockquote>Line one
18228
18229 Line two
18230 </blockquote>
18231 !! html
18232 <blockquote>Line one
18233 <p>Line two
18234 </p>
18235 </blockquote>
18236
18237 !! html+tidy
18238 <blockquote>
18239 <p>Line one</p>
18240 <p>Line two</p>
18241 </blockquote>
18242 !! end
18243
18244 !! test
18245 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18246 !! wikitext
18247 <blockquote>
18248 Line one
18249
18250 Line two
18251 </blockquote>
18252 !! html
18253 <blockquote>
18254 <p>Line one
18255 </p><p>Line two
18256 </p>
18257 </blockquote>
18258
18259 !! html+tidy
18260 <blockquote>
18261 <p>Line one</p>
18262 <p>Line two</p>
18263 </blockquote>
18264 !! end
18265
18266 !! test
18267 Paragraphs inside blockquotes/divs (no extra line breaks)
18268 !! wikitext
18269 <blockquote><div>Line one
18270
18271 Line two</div></blockquote>
18272 !! html
18273 <blockquote><div>Line one
18274 Line two</div></blockquote>
18275
18276 !! end
18277
18278 !! test
18279 Paragraphs inside blockquotes/divs (extra line break on open)
18280 !! wikitext
18281 <blockquote><div>
18282 Line one
18283
18284 Line two</div></blockquote>
18285 !! html
18286 <blockquote><div>
18287 <p>Line one
18288 </p>
18289 Line two</div></blockquote>
18290
18291 !! end
18292
18293 !! test
18294 Paragraphs inside blockquotes/divs (extra line break on close)
18295 !! wikitext
18296 <blockquote><div>Line one
18297
18298 Line two
18299 </div></blockquote>
18300 !! html
18301 <blockquote><div>Line one
18302 <p>Line two
18303 </p>
18304 </div></blockquote>
18305
18306 !! end
18307
18308 !! test
18309 Paragraphs inside blockquotes/divs (extra line break on open and close)
18310 !! wikitext
18311 <blockquote><div>
18312 Line one
18313
18314 Line two
18315 </div></blockquote>
18316 !! html
18317 <blockquote><div>
18318 <p>Line one
18319 </p><p>Line two
18320 </p>
18321 </div></blockquote>
18322
18323 !! end
18324
18325 !! test
18326 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18327 !! options
18328 wgLinkHolderBatchSize=0
18329 !! wikitext
18330 [[meatball:1]]
18331 [[meatball:2]]
18332 [[meatball:3]]
18333 !! html
18334 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18335 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18336 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18337 </p>
18338 !! end
18339
18340 !! test
18341 Free external link invading image caption
18342 !! wikitext
18343 [[Image:Foobar.jpg|thumb|http://x|hello]]
18344 !! html
18345 <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>
18346
18347 !! end
18348
18349 !! test
18350 Bug 15196: localised external link numbers
18351 !! options
18352 language=fa
18353 !! wikitext
18354 [http://en.wikipedia.org/]
18355 !! html/php
18356 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18357 </p>
18358 !! html/parsoid
18359 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18360 !! end
18361
18362 !! test
18363 Multibyte character in padleft
18364 !! wikitext
18365 {{padleft:-Hello|7|Æ}}
18366 !! html
18367 <p>Æ-Hello
18368 </p>
18369 !! end
18370
18371 !! test
18372 Multibyte character in padright
18373 !! wikitext
18374 {{padright:Hello-|7|Æ}}
18375 !! html
18376 <p>Hello-Æ
18377 </p>
18378 !! end
18379
18380 !!test
18381 formatdate parser function
18382 !! wikitext
18383 {{#formatdate:2009-03-24}}
18384 !! html
18385 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18386 </p>
18387 !! end
18388
18389 !!test
18390 formatdate parser function, with default format
18391 !! wikitext
18392 {{#formatdate:2009-03-24|mdy}}
18393 !! html
18394 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18395 </p>
18396 !! end
18397
18398 !! test
18399 Spacing of numbers in formatted dates
18400 !! wikitext
18401 {{#formatdate:January 15}}
18402 !! html
18403 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18404 </p>
18405 !! end
18406
18407 !! test
18408 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
18409 !! options
18410 language=nl title=[[MediaWiki:Common.css]]
18411 !! wikitext
18412 {{#formatdate:2009-03-24|dmy}}
18413 !! html
18414 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18415 </p>
18416 !! end
18417
18418 #
18419 #
18420 #
18421
18422 #
18423 # Edit comments
18424 #
18425
18426 !! test
18427 Edit comment with link
18428 !! options
18429 comment
18430 !! wikitext
18431 I like the [[Main Page]] a lot
18432 !! html
18433 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18434 !!end
18435
18436 !! test
18437 Edit comment with link and link text
18438 !! options
18439 comment
18440 !! wikitext
18441 I like the [[Main Page|best pages]] a lot
18442 !! html
18443 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18444 !!end
18445
18446 !! test
18447 Edit comment with link and link text with suffix
18448 !! options
18449 comment
18450 !! wikitext
18451 I like the [[Main Page|best page]]s a lot
18452 !! html
18453 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18454 !!end
18455
18456 !! test
18457 Edit comment with section link (non-local, eg in history list)
18458 !! options
18459 comment title=[[Main Page]]
18460 !! wikitext
18461 /* External links */ removed bogus entries
18462 !! html
18463 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18464 !!end
18465
18466 !! test
18467 Edit comment with section link and text before it (non-local, eg in history list)
18468 !! options
18469 comment title=[[Main Page]]
18470 !! wikitext
18471 pre-comment text /* External links */ removed bogus entries
18472 !! html
18473 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>
18474 !!end
18475
18476 !! test
18477 Edit comment with section link (local, eg in diff view)
18478 !! options
18479 comment local title=[[Main Page]]
18480 !! wikitext
18481 /* External links */ removed bogus entries
18482 !! html
18483 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18484 !!end
18485
18486 !! test
18487 Edit comment with subpage link (bug 14080)
18488 !! options
18489 comment
18490 subpage
18491 title=[[Subpage test]]
18492 !! wikitext
18493 Poked at a [[/subpage]] here...
18494 !! html
18495 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18496 !!end
18497
18498 !! test
18499 Edit comment with subpage link and link text (bug 14080)
18500 !! options
18501 comment
18502 subpage
18503 title=[[Subpage test]]
18504 !! wikitext
18505 Poked at a [[/subpage|neat little page]] here...
18506 !! html
18507 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18508 !!end
18509
18510 !! test
18511 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18512 !! options
18513 comment
18514 title=[[Subpage test]]
18515 !! wikitext
18516 Poked at a [[/subpage]] here...
18517 !! html
18518 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...
18519 !!end
18520
18521 !! test
18522 Edit comment with bare anchor link (local, as on diff)
18523 !! options
18524 comment
18525 local
18526 title=[[Main Page]]
18527 !! wikitext
18528 [[#section]]
18529 !! html
18530 <a href="#section">#section</a>
18531 !! end
18532
18533 !! test
18534 Edit comment with bare anchor link (non-local, as on history)
18535 !! options
18536 comment
18537 title=[[Main Page]]
18538 !! wikitext
18539 [[#section]]
18540 !! html
18541 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18542 !! end
18543
18544 !! test
18545 Anchor starting with underscore
18546 !! wikitext
18547 [[#_ref|One]]
18548 !! html
18549 <p><a href="#_ref">One</a>
18550 </p>
18551 !! end
18552
18553 !! test
18554 Id starting with underscore
18555 !! wikitext
18556 <div id="_ref"></div>
18557 !! html
18558 <div id="_ref"></div>
18559
18560 !! end
18561
18562 !! test
18563 Space normalisation on autocomment (bug 22784)
18564 !! options
18565 comment
18566 title=[[Main Page]]
18567 !! wikitext
18568 /* __hello__world__ */
18569 !! html
18570 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18571 !! end
18572
18573 !! test
18574 percent-encoding and + signs in comments (Bug 26410)
18575 !! options
18576 comment
18577 !! wikitext
18578 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18579 !! html
18580 <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>
18581 !! end
18582
18583 # Parsoid doesn't support this yet: see bug 73581
18584 # but it *should* omit the 'src' attribute if the image is bad.
18585 # PHP side of tests was disabled in
18586 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18587 # because of issues in the PHP parserTests infrastructure
18588 # (but the output below is indeed what the PHP side emits)
18589 !! test
18590 Bad images - basic functionality
18591 !! wikitext
18592 [[File:Bad.jpg]]
18593 !! DISABLED/html/php
18594 !! html/parsoid
18595 <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>
18596 !! end
18597
18598 !! test
18599 Bad images - bug 16039: text after bad image disappears
18600 !! wikitext
18601 Foo bar
18602 [[File:Bad.jpg]]
18603 Bar foo
18604 !! DISABLED/html/php
18605 <p>Foo bar
18606 </p><p>Bar foo
18607 </p>
18608 !! html/parsoid
18609 <p>Foo bar
18610 <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>
18611 Bar foo</p>
18612 !! end
18613
18614 !! test
18615 Verify that displaytitle works (bug #22501) no displaytitle
18616 !! options
18617 showtitle
18618 !! config
18619 wgAllowDisplayTitle=true
18620 wgRestrictDisplayTitle=false
18621 !! wikitext
18622 this is not the the title
18623 !! html
18624 Parser test
18625 <p>this is not the the title
18626 </p>
18627 !! end
18628
18629 !! test
18630 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18631 !! options
18632 showtitle
18633 title=[[Screen]]
18634 !! config
18635 wgAllowDisplayTitle=true
18636 wgRestrictDisplayTitle=false
18637 !! wikitext
18638 this is not the the title
18639 {{DISPLAYTITLE:whatever}}
18640 !! html
18641 whatever
18642 <p>this is not the the title
18643 </p>
18644 !! end
18645
18646 !! test
18647 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18648 !! options
18649 showtitle
18650 title=[[Screen]]
18651 !! config
18652 wgAllowDisplayTitle=true
18653 wgRestrictDisplayTitle=true
18654 !! wikitext
18655 this is not the the title
18656 {{DISPLAYTITLE:whatever}}
18657 !! html
18658 Screen
18659 <p>this is not the the title
18660 </p>
18661 !! end
18662
18663 !! test
18664 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18665 !! options
18666 showtitle
18667 title=[[Screen]]
18668 !! config
18669 wgAllowDisplayTitle=true
18670 wgRestrictDisplayTitle=true
18671 !! wikitext
18672 this is not the the title
18673 {{DISPLAYTITLE:screen}}
18674 !! html
18675 screen
18676 <p>this is not the the title
18677 </p>
18678 !! end
18679
18680 !! test
18681 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18682 !! options
18683 showtitle
18684 title=[[Screen]]
18685 !! config
18686 wgAllowDisplayTitle=false
18687 !! wikitext
18688 this is not the the title
18689 {{DISPLAYTITLE:screen}}
18690 !! html
18691 Screen
18692 <p>this is not the the title
18693 <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>
18694 </p>
18695 !! end
18696
18697 !! test
18698 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18699 !! options
18700 showtitle
18701 title=[[Screen]]
18702 !! config
18703 wgAllowDisplayTitle=false
18704 !! wikitext
18705 this is not the the title
18706 !! html
18707 Screen
18708 <p>this is not the the title
18709 </p>
18710 !! end
18711
18712 !! test
18713 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18714 !! options
18715 showtitle
18716 title=[[Screen]]
18717 !! config
18718 wgAllowDisplayTitle=true
18719 wgRestrictDisplayTitle=true
18720 !! wikitext
18721 this is not the the title
18722 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18723 !! html
18724 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18725 <p>this is not the the title
18726 </p>
18727 !! end
18728
18729 !! test
18730 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18731 !! options
18732 showtitle
18733 title=[[Screen]]
18734 !! config
18735 wgAllowDisplayTitle=true
18736 wgRestrictDisplayTitle=true
18737 !! wikitext
18738 this is not the the title
18739 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18740 !! html
18741 <span style="color: red;">s</span>creen
18742 <p>this is not the the title
18743 </p>
18744 !! end
18745
18746 !! test
18747 preload: check <noinclude> and <includeonly>
18748 !! options
18749 preload
18750 !! wikitext
18751 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18752 !! html
18753 Hello kind world.
18754 !! end
18755
18756 !! test
18757 preload: check <onlyinclude>
18758 !! options
18759 preload
18760 !! wikitext
18761 Goodbye <onlyinclude>Hello world</onlyinclude>
18762 !! html
18763 Hello world
18764 !! end
18765
18766 !! test
18767 preload: can pass tags through if we want to
18768 !! options
18769 preload
18770 !! wikitext
18771 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18772 !! html
18773 <includeonly>Hello world</includeonly>
18774 !! end
18775
18776 !! test
18777 preload: check that it doesn't try to do tricks
18778 !! options
18779 preload
18780 !! wikitext
18781 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18782 !! html
18783 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18784 !! end
18785
18786 !! test
18787 Play a bit with r67090 and bug 3158
18788 !! wikitext
18789 <div style="width:50% !important">&nbsp;</div>
18790 <div style="width:50%&nbsp;!important">&nbsp;</div>
18791 <div style="width:50%&#160;!important">&nbsp;</div>
18792 <div style="border : solid;">&nbsp;</div>
18793 !! html/php
18794 <div style="width:50% !important">&#160;</div>
18795 <div style="width:50% !important">&#160;</div>
18796 <div style="width:50% !important">&#160;</div>
18797 <div style="border&#160;: solid;">&#160;</div>
18798
18799 !! html/parsoid
18800 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18801 <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='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18802 <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='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18803 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18804
18805 !! end
18806
18807 !! test
18808 HTML5 data attributes
18809 !! wikitext
18810 <span data-foo="bar">Baz</span>
18811 <p data-abc-def_hij="">Quuz</p>
18812 !! html
18813 <p><span data-foo="bar">Baz</span>
18814 </p>
18815 <p data-abc-def_hij="">Quuz</p>
18816
18817 !! end
18818
18819 !! test
18820 percent-encoding and + signs in internal links (Bug 26410)
18821 !! wikitext
18822 [[User:+%]] [[Page+title%]]
18823 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18824 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18825 [[%33%45]] [[%33%45+]]
18826 !! html/php
18827 <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>
18828 <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>
18829 <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>
18830 <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>
18831 </p>
18832 !! html/parsoid
18833 <p><a rel="mw:WikiLink" href="User:+%" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%" title="Page+title%">Page+title%</a> <a rel="mw:WikiLink" href="%+" title="%+">%+</a> <a rel="mw:WikiLink" href="%+" title="%+">%20</a> <a rel="mw:WikiLink" href="%+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%+r" title="%+r">%+r</a> <a rel="mw:WikiLink" href="%" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"[[bar]]"}'><a href="File:%+abc9"><img resource="./File:%25+abc9" src="./Special:FilePath/%+abc9" height="220" width="220"/></a></span> <a rel="mw:WikiLink" href="3E" title="3E">3E</a> <a rel="mw:WikiLink" href="3E+" title="3E+">3E+</a></p>
18834 !! end
18835
18836 !! test
18837 Special characters in embedded file links (bug 27679)
18838 !! wikitext
18839 [[File:Contains & ampersand.jpg]]
18840 [[File:Does not exist.jpg|Title with & ampersand]]
18841 !! html/php
18842 <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>
18843 <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>
18844 </p>
18845 !! html/parsoid
18846 <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>
18847 <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; 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>
18848 !! end
18849
18850 !! test
18851 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18852 !! wikitext
18853 Text&apos;s been normalized?
18854 !! html
18855 <p>Text&#39;s been normalized?
18856 </p>
18857 !! end
18858
18859 !! test
18860 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18861 !! wikitext
18862 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18863 !! html
18864 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18865 </p>
18866 !! end
18867
18868 !! test
18869 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18870 !! wikitext
18871 [http://www.example.org/ ideograms]
18872 !! html
18873 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18874 </p>
18875 !! end
18876
18877 !! test
18878 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18879 !! wikitext
18880 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18881 !! html
18882 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18883 </p>
18884 !! end
18885
18886 !! article
18887 Mediawiki:loop1
18888 !! text
18889 {{Identical|A}}
18890 !! endarticle
18891
18892 !! article
18893 Mediawiki:loop2
18894 !! text
18895 {{Identical|B}}
18896 !! endarticle
18897
18898 !! article
18899 Template:Identical
18900 !! text
18901 {{int:loop1}}
18902 {{int:loop2}}
18903 !! endarticle
18904
18905 !! test
18906 Bug 31098 Template which includes system messages which includes the template
18907 !! wikitext
18908 {{Identical}}
18909 !! html
18910 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18911 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18912 </p>
18913 !! end
18914
18915 !! test
18916 Bug31490 Turkish: ucfirst 'blah'
18917 !! options
18918 language=tr
18919 !! wikitext
18920 {{ucfirst:blah}}
18921 !! html
18922 <p>Blah
18923 </p>
18924 !! end
18925
18926 !! test
18927 Bug31490 Turkish: ucfirst 'ix'
18928 !! options
18929 language=tr
18930 !! wikitext
18931 {{ucfirst:ix}}
18932 !! html
18933 <p>İx
18934 </p>
18935 !! end
18936
18937 !! test
18938 Bug31490 Turkish: lcfirst 'BLAH'
18939 !! options
18940 language=tr
18941 !! wikitext
18942 {{lcfirst:BLAH}}
18943 !! html
18944 <p>bLAH
18945 </p>
18946 !! end
18947
18948 !! test
18949 Bug31490 Turkish: ucfırst (with a dotless i)
18950 !! options
18951 language=tr
18952 !! wikitext
18953 {{ucfırst:blah}}
18954 !! html
18955 <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>
18956 </p>
18957 !! end
18958
18959 !! test
18960 Bug31490 ucfırst (with a dotless i) with English language
18961 !! options
18962 language=en
18963 !! wikitext
18964 {{ucfırst:blah}}
18965 !! html
18966 <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>
18967 </p>
18968 !! end
18969
18970 !! test
18971 Bug 26375: TOC with italics
18972 !! options
18973 title=[[Main Page]]
18974 !! wikitext
18975 __TOC__
18976 == ''Lost'' episodes ==
18977 !! html
18978 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18979 <ul>
18980 <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>
18981 </ul>
18982 </div>
18983
18984 <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>
18985
18986 !! end
18987
18988 !! test
18989 Bug 26375: TOC with bold
18990 !! options
18991 title=[[Main Page]]
18992 !! wikitext
18993 __TOC__
18994 == '''should be bold''' then normal text ==
18995 !! html
18996 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18997 <ul>
18998 <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>
18999 </ul>
19000 </div>
19001
19002 <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>
19003
19004 !! end
19005
19006 !! test
19007 Bug 33845: Headings become cursive in TOC when they contain an image
19008 !! options
19009 title=[[Main Page]]
19010 !! wikitext
19011 __TOC__
19012 == Image [[Image:foobar.jpg]] ==
19013 !! html
19014 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19015 <ul>
19016 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19017 </ul>
19018 </div>
19019
19020 <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>
19021
19022 !! end
19023
19024 !! test
19025 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19026 !! options
19027 title=[[Main Page]]
19028 !! wikitext
19029 __TOC__
19030 == <blockquote>Quote</blockquote> ==
19031 !! html
19032 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19033 <ul>
19034 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19035 </ul>
19036 </div>
19037
19038 <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>
19039
19040 !! html+tidy
19041 <div id="toc" class="toc">
19042 <div id="toctitle">
19043 <h2>Contents</h2>
19044 </div>
19045 <ul>
19046 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19047 </ul>
19048 </div>
19049 <h2><span class="mw-headline" id="Quote"></span></h2>
19050 <blockquote>
19051 <p><span class="mw-headline" id="Quote">Quote</span></p>
19052 </blockquote>
19053 <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>
19054 !! end
19055
19056 !! test
19057 Unclosed tags in TOC
19058 !! options
19059 title=[[Main Page]]
19060 !! wikitext
19061 __TOC__
19062 == Proof: 2 < 3 ==
19063 <small>Hanc marginis exiguitas non caperet.</small>
19064 QED
19065 !! html
19066 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19067 <ul>
19068 <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>
19069 </ul>
19070 </div>
19071
19072 <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>
19073 <p><small>Hanc marginis exiguitas non caperet.</small>
19074 QED
19075 </p>
19076 !! end
19077
19078 !! test
19079 Multiple tags in TOC
19080 !! wikitext
19081 __TOC__
19082 == <i>Foo</i> <b>Bar</b> ==
19083
19084 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19085 !! html
19086 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19087 <ul>
19088 <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>
19089 <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>
19090 </ul>
19091 </div>
19092
19093 <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>
19094 <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>
19095
19096 !! html+tidy
19097 <div id="toc" class="toc">
19098 <div id="toctitle">
19099 <h2>Contents</h2>
19100 </div>
19101 <ul>
19102 <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>
19103 <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>
19104 </ul>
19105 </div>
19106 <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>
19107 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
19108 <blockquote>
19109 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19110 </blockquote>
19111 <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>
19112 !! end
19113
19114 !! test
19115 Tags with parameters in TOC
19116 !! wikitext
19117 __TOC__
19118 == <sup class="in-h2">Hello</sup> ==
19119
19120 == <sup class="a > b">Evilbye</sup> ==
19121 !! html
19122 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19123 <ul>
19124 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19125 <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>
19126 </ul>
19127 </div>
19128
19129 <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>
19130 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> 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;>Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19131
19132 !! end
19133
19134 !! test
19135 span tags with directionality in TOC
19136 !! wikitext
19137 __TOC__
19138 == <span dir="ltr">C++</span> ==
19139
19140 == <span dir="rtl">זבנג!</span> ==
19141
19142 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19143
19144 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19145
19146 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19147 !! html
19148 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19149 <ul>
19150 <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>
19151 <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>
19152 <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>
19153 <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>
19154 <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>
19155 </ul>
19156 </div>
19157
19158 <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>
19159 <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>
19160 <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>
19161 <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>
19162 <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>
19163
19164 !! end
19165
19166 !! test
19167 Bug 72884: bdi element in ToC
19168 !! wikitext
19169 __TOC__
19170 == <bdi>test</bdi> ==
19171 !! html
19172 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19173 <ul>
19174 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19175 </ul>
19176 </div>
19177
19178 <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>
19179
19180 !! end
19181
19182 !! article
19183 MediaWiki:Bug32057
19184 !! text
19185 == {{int:headline_sample}} ==
19186 !! endarticle
19187
19188 !! test
19189 Bug 32057: Title needed when expanding <h> nodes.
19190 !! options
19191 title=[[Main Page]]
19192 !! wikitext
19193 {{int:Bug32057}}
19194 !! html
19195 <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>
19196
19197 !! end
19198
19199 !! test
19200 Strip marker in urlencode
19201 !! wikitext
19202 {{urlencode:x<nowiki/>y}}
19203 {{urlencode:x<nowiki/>y|wiki}}
19204 {{urlencode:x<nowiki/>y|path}}
19205 !! html
19206 <p>xy
19207 xy
19208 xy
19209 </p>
19210 !! end
19211
19212 !! test
19213 Strip marker in lc
19214 !! wikitext
19215 {{lc:x<nowiki/>y}}
19216 !! html
19217 <p>xy
19218 </p>
19219 !! end
19220
19221 !! test
19222 Strip marker in uc
19223 !! wikitext
19224 {{uc:x<nowiki/>y}}
19225 !! html
19226 <p>XY
19227 </p>
19228 !! end
19229
19230 !! test
19231 Strip marker in formatNum
19232 !! wikitext
19233 {{formatnum:1<nowiki/>2}}
19234 {{formatnum:1<nowiki/>2|R}}
19235 !! html
19236 <p>12
19237 12
19238 </p>
19239 !! end
19240
19241 !! test
19242 Check noCommafy in formatNum
19243 !! options
19244 language=be-tarask
19245 !! wikitext
19246 {{formatnum:123456.78}}
19247 {{formatnum:123456.78|NOSEP}}
19248 !! html
19249 <p>123 456,78
19250 123456.78
19251 </p>
19252 !! end
19253
19254 !! test
19255 Wrong option for formatNum (bug 56199)
19256 !! wikitext
19257 {{formatnum:1,234.56|Random}}
19258 {{formatnum:1,234.56|EVERYTHING}}
19259 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19260 !! html
19261 <p>1,234.56
19262 1,234.56
19263 1,234.56
19264 </p>
19265 !! end
19266
19267 !! test
19268 Strip marker in grammar
19269 !! options
19270 language=fi
19271 !! wikitext
19272 {{grammar:elative|foo<nowiki/>bar}}
19273 !! html
19274 <p>foobarista
19275 </p>
19276 !! end
19277
19278 !! test
19279 Strip marker in padleft
19280 !! wikitext
19281 {{padleft:|2|x<nowiki/>y}}
19282 !! html
19283 <p>xy
19284 </p>
19285 !! end
19286
19287 !! test
19288 Strip marker in padright
19289 !! wikitext
19290 {{padright:|2|x<nowiki/>y}}
19291 !! html
19292 <p>xy
19293 </p>
19294 !! end
19295
19296 !! test
19297 Strip marker in anchorencode
19298 !! wikitext
19299 {{anchorencode:x<nowiki/>y}}
19300 !! html
19301 <p>xy
19302 </p>
19303 !! end
19304
19305 !! test
19306 nowiki inside link inside heading (bug 18295)
19307 !! wikitext
19308 ==[[foo|x<nowiki>y</nowiki>z]]==
19309 !! html
19310 <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>
19311
19312 !! end
19313
19314 !! test
19315 new support for bdi element (bug 31817)
19316 !! wikitext
19317 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19318 !! html
19319 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19320
19321 !!end
19322
19323 !! test
19324 Ignore pipe between table row attributes
19325 !! wikitext
19326 {|
19327 | quux
19328 |- id=foo | style='color: red'
19329 | bar
19330 |}
19331 !! html
19332 <table>
19333 <tr>
19334 <td> quux
19335 </td></tr>
19336 <tr id="foo" style="color: red">
19337 <td> bar
19338 </td></tr></table>
19339
19340 !! end
19341
19342 !!test
19343 Gallery override link with WikiLink (bug 34852)
19344 !! wikitext
19345 <gallery>
19346 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19347 </gallery>
19348 !! html
19349 <ul class="gallery mw-gallery-traditional">
19350 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19351 <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" /></a></div></div>
19352 <div class="gallerytext">
19353 <p>caption
19354 </p>
19355 </div>
19356 </div></li>
19357 </ul>
19358
19359 !! end
19360
19361 !!test
19362 Gallery override link with absolute external link (bug 34852)
19363 !! wikitext
19364 <gallery>
19365 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19366 </gallery>
19367 !! html
19368 <ul class="gallery mw-gallery-traditional">
19369 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19370 <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" /></a></div></div>
19371 <div class="gallerytext">
19372 <p>caption
19373 </p>
19374 </div>
19375 </div></li>
19376 </ul>
19377
19378 !! end
19379
19380 !!test
19381 Gallery override link with malicious javascript (bug 34852)
19382 !! wikitext
19383 <gallery>
19384 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19385 </gallery>
19386 !! html
19387 <ul class="gallery mw-gallery-traditional">
19388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19389 <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" /></a></div></div>
19390 <div class="gallerytext">
19391 <p>caption
19392 </p>
19393 </div>
19394 </div></li>
19395 </ul>
19396
19397 !! end
19398
19399 !!test
19400 Gallery with invalid title as link (bug 43964)
19401 !! wikitext
19402 <gallery>
19403 File:foobar.jpg|link=<
19404 </gallery>
19405 !! html
19406 <ul class="gallery mw-gallery-traditional">
19407 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19408 <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" /></a></div></div>
19409 <div class="gallerytext">
19410 </div>
19411 </div></li>
19412 </ul>
19413
19414 !! end
19415
19416 !!test
19417 Language parser function
19418 !! wikitext
19419 {{#language:ar}}
19420 !! html
19421 <p>العربية
19422 </p>
19423 !! end
19424
19425 !!test
19426 Padleft and padright as substr
19427 !! wikitext
19428 {{padleft:|3|abcde}}
19429 {{padright:|3|abcde}}
19430 !! html
19431 <p>abc
19432 abc
19433 </p>
19434 !! end
19435
19436 !!test
19437 Special parser function
19438 !! wikitext
19439 {{#special:RandomPage}}
19440 {{#special:BaDtItLe}}
19441 {{#special:Foobar}}
19442 !! html
19443 <p>Special:Random
19444 Special:Badtitle
19445 Special:Foobar
19446 </p>
19447 !! end
19448
19449 !!test
19450 Bug 34939 - Case insensitive link parsing ([HttP://])
19451 !! wikitext
19452 [HttP://MediaWiki.Org/]
19453 !! html/php
19454 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19455 </p>
19456 !! html/parsoid
19457 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19458 !! end
19459
19460 !!test
19461 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19462 !! wikitext
19463 [HttP://MediaWiki.Org/ MediaWiki]
19464 !! html
19465 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19466 </p>
19467 !! end
19468
19469 !!test
19470 Bug 34939 - Case insensitive link parsing (HttP://)
19471 !! wikitext
19472 HttP://MediaWiki.Org/
19473 !! html/php
19474 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19475 </p>
19476 !! html/parsoid
19477 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19478 !! end
19479
19480 !!test
19481 Disable TOC
19482 !! options
19483 notoc
19484 !! wikitext
19485 Lead
19486 == Section 1 ==
19487 == Section 2 ==
19488 == Section 3 ==
19489 == Section 4 ==
19490 == Section 5 ==
19491 !! html
19492 <p>Lead
19493 </p>
19494
19495 <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>
19496 <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>
19497 <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>
19498 <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>
19499 <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>
19500
19501 !! end
19502
19503
19504 ###
19505 ### Parsoid-specific tests
19506 ### Parsoid-PHP parser incompatibilities
19507 ###
19508 !!test
19509 1. SOL-sensitive wikitext tokens as template-args
19510 !!options
19511 parsoid=wt2html,wt2wt
19512 !! wikitext
19513 {{echo|*a}}
19514 {{echo|#a}}
19515 {{echo|:a}}
19516 !! html
19517 <span about="#mwt1" typeof="mw:Transclusion">
19518 </span><ul about="#mwt1"><li>a</li>
19519 </ul>
19520 <span about="#mwt2" typeof="mw:Transclusion">
19521 </span><ol about="#mwt2"><li>a</li>
19522 </ol>
19523 <span about="#mwt3" typeof="mw:Transclusion">
19524 </span><dl about="#mwt3"><dd>a</dd>
19525 </dl>
19526 !!end
19527
19528 #### -----------------------------------------------------------------
19529 #### Parsoid-specific functionality tests
19530 #### -----------------------------------------------------------------
19531
19532 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19533 # We know wt2wt will fail, but we expect selser to pass.
19534 # Due to the nature of our testing, wt2wt and selser tests will enter the
19535 # blacklist and we'll catch selser regressions based on changes to the
19536 # blacklist entries for selser tests.
19537 !! test
19538 1. Bad treebuilder fixup of formatting elt is cleaned up
19539 !! options
19540 parsoid=wt2html,wt2wt
19541 !! wikitext
19542 {|
19543 |
19544 <small>
19545 [[Image:Foobar.jpg|right|Test]]
19546 </small>
19547 |}
19548 !! html/parsoid
19549 <table>
19550 <tbody><tr><td>
19551 <small>
19552 <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" height="220" width="1941"></a><figcaption>Test</figcaption></figure>
19553 </small>
19554 </td></tr>
19555 </tbody></table>
19556 !! end
19557
19558 !! test
19559 2. Bad treebuilder fixup of formatting elt is cleaned up
19560 !! options
19561 parsoid=wt2html,wt2wt
19562 !! wikitext
19563 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19564
19565 <small>[[Image:Foobar.jpg|right|300px]]</small>
19566 !! html/parsoid
19567 <p><b>foo</b></p>
19568 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
19569 <p><b>bar</b></p>
19570 <small><figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="34" width="300"/></a></figure></small>
19571 !! end
19572
19573 #### ----------------------------------------------------------------
19574 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19575 #### tags. Parsoid's output for these tags differs from that of the
19576 #### PHP parser.
19577 #### ----------------------------------------------------------------
19578
19579 !!test
19580 Ref: 1. ref-location should be replaced with an index span
19581 !!options
19582 parsoid
19583 !! wikitext
19584 A <ref>foo</ref>
19585 B <ref name="x">foo</ref>
19586 C <ref name="y" />
19587 !! html
19588 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19589 B <span about="#mwt4" class="reference" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2">[2]</a></span>
19590 C <span about="#mwt6" class="reference" 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">[3]</a></span></p>
19591 !!end
19592
19593 !!test
19594 Ref: 2. ref-tags with identical names should all get the same index
19595 !!options
19596 parsoid
19597 !! wikitext
19598 A <ref name="x">foo</ref>
19599 B <ref name="x" />
19600 !! html
19601 <p>A <span about="#mwt2" class="reference" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19602 B <span about="#mwt4" class="reference" 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">[1]</a></span></p>
19603 !!end
19604
19605 !!test
19606 Ref: 3. spaces in ref-names should be ignored
19607 !!options
19608 parsoid
19609 !! wikitext
19610 A <ref name="x">foo</ref>
19611 B <ref name=" x " />
19612 C <ref name= x />
19613 !! html
19614 <p>A <span about="#mwt2" class="reference" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19615 B <span about="#mwt4" class="reference" 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">[1]</a></span>
19616 C <span about="#mwt6" class="reference" 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">[1]</a></span></p>
19617 !!end
19618
19619 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19620 !!test
19621 Ref: 4. 'constructor' should be accepted as a valid ref-name
19622 !!options
19623 parsoid
19624 !! wikitext
19625 A <ref name="constructor">foo</ref>
19626 !! html
19627 <p>A <span about="#mwt2" class="reference" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1">[1]</a></span></p>
19628 !!end
19629
19630 !!test
19631 Ref: 5. body should accept generic wikitext
19632 !!options
19633 parsoid
19634 !! wikitext
19635 A <ref>
19636 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19637 </ref>
19638
19639 <references />
19640 !! html
19641 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"This is a &lt;b data-parsoid=&#39;{\"dsr\":[19,40,3,3]}&#39;>&lt;a rel=\"mw:WikiLink\" href=\"./Bolded_link\" title=\"Bolded link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bolded_link\"},\"sa\":{\"href\":\"bolded link\"},\"dsr\":[22,37,2,2]}&#39;>bolded link&lt;/a>&lt;/b> and this is a &lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19642
19643 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19644 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> 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>
19645 </li>
19646 </ol>
19647 !!end
19648
19649 !!test
19650 Ref: 6. indent-pres should not be output in ref-body
19651 !!options
19652 parsoid
19653 !! wikitext
19654 A <ref>
19655 foo
19656 bar
19657 baz
19658 </ref>
19659
19660 <references />
19661 !! html
19662 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19663
19664 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19665 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo
19666 bar
19667 baz
19668 </li>
19669 </ol>
19670 !!end
19671
19672 !!test
19673 Ref: 7. No p-wrapping in ref-body
19674 !!options
19675 parsoid
19676 !! wikitext
19677 A <ref>
19678 foo
19679
19680 bar
19681
19682
19683 baz
19684
19685
19686
19687 booz
19688 </ref>
19689
19690 <references />
19691 !! html
19692 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19693
19694 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19695 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo
19696
19697 bar
19698
19699
19700 baz
19701
19702
19703
19704 booz
19705 </li>
19706 </ol>
19707 !!end
19708
19709 !!test
19710 Ref: 8. transclusion wikitext has lower precedence
19711 !!options
19712 parsoid
19713 !! wikitext
19714 A <ref> foo {{echo|</ref> B C}}
19715
19716 <references />
19717 !! html
19718 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"src\":\"{{\",\"dsr\":[12,14,0,0]}&#39;>{{&lt;/span>echo|"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
19719 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19720 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
19721 </ol>
19722 !!end
19723
19724 !!test
19725 Ref: 9. unclosed comments should not leak out of ref-body
19726 !!options
19727 parsoid
19728 !! wikitext
19729 A <ref> foo <!--</ref> B C
19730 <references />
19731 !! html
19732 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &lt;!---->"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19733 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19734 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo <!----></li>
19735 </ol>
19736 !!end
19737
19738 !!test
19739 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19740 !!options
19741 parsoid
19742 !! wikitext
19743 A <ref> <b> foo </ref> B C
19744
19745 <references />
19746 !! html
19747 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"&lt;b data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[8,16,3,0]}&#39;> foo &lt;/b>"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19748
19749
19750 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19751 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
19752 </ol>
19753 !!end
19754
19755 !!test
19756 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19757 !!options
19758 parsoid
19759 !! wikitext
19760 A <ref>foo</ref> B
19761 C <ref>bar</ref> D
19762 !! html
19763 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B
19764 C <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> D</p>
19765 !!end
19766
19767 !!test
19768 Ref: 12. ref-tags act as trailing newline migration barrier
19769 !!options
19770 parsoid
19771 !! wikitext
19772 <!--the newline at the end of this line moves out of the p-tag-->a
19773
19774 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19775 <ref />
19776
19777 c
19778 !! html
19779 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19780
19781
19782 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19783 <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2">[2]</a></span></p>
19784
19785 <p>c</p>
19786 !!end
19787
19788 !!test
19789 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19790 !!options
19791 parsoid
19792 !! wikitext
19793 <ref>foo</ref> A
19794 <ref>bar
19795 </ref> B
19796 !! html
19797 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> A
19798 <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> B</p>
19799 !!end
19800
19801 !!test
19802 Ref: 14. A nested ref-tag should be emitted as plain text
19803 !!options
19804 parsoid
19805 !! wikitext
19806 <ref>foo <ref>bar</ref> baz</ref>
19807
19808 <references />
19809 !! html
19810 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref>bar&amp;lt;/ref> baz"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19811
19812 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19813 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
19814 </ol>
19815 !!end
19816
19817 !!test
19818 Ref: 15. ref-tags with identical names should get identical indexes
19819 !!options
19820 parsoid
19821 !! wikitext
19822 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19823 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19824
19825 <references />
19826 !! html
19827 <p>A1 <span about="#mwt3" class="reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" 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">[1]</a></span>
19828 B1 <span about="#mwt7" class="reference" 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">[2]</a></span> B2 <span about="#mwt8" class="reference" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
19829
19830 <ol class="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">1.0</a> <a href="#cite_ref-a_1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b_2-0">2.0</a> <a href="#cite_ref-b_2-1">2.1</a></span> bar</li>
19831 </ol>
19832 !!end
19833
19834 ## We don't bother wt2wt-ing non-standard whitespace
19835 !!test
19836 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19837 !!options
19838 parsoid=wt2html
19839 !! wikitext
19840 A <ref >foo</ref >
19841
19842 <references />
19843 !! html
19844 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19845
19846 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19847 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li></ol>
19848 !!end
19849
19850 !!test
19851 Ref: 17. Generate valid HTML5 id/about attributes
19852 !!options
19853 parsoid
19854 !!wikitext
19855 <ref name="a b">foo</ref>
19856
19857 <references />
19858 !!html
19859 <p><span class="reference" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1">[1]</a></span>
19860 </p>
19861
19862 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19863 <li id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b_1-0">↑</a></span> foo</li>
19864 !!end
19865
19866 !!test
19867 Ref: 18. T58916: Extension attributes should be parsed as plain text
19868 !!options
19869 parsoid
19870 !!wikitext
19871 <ref name="{{echo|a}}">foo</ref>
19872
19873 <references />
19874 !!html
19875 <p><span class="reference" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1">[1]</a></span>
19876 </p>
19877
19878 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19879 <li id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><span rel="mw:referencedBy"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0">↑</a></span> foo</li>
19880 !!end
19881
19882 !!test
19883 Ref: 19. ref-tags with identical name encodings should get identical indexes
19884 !!options
19885 parsoid
19886 !! wikitext
19887 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
19888
19889 <references />
19890 !! html
19891 <p>1 <span about="#mwt3" class="reference" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a &amp; b"}}'><a href="#cite_note-a_.26_b-1">[1]</a></span> 2 <span about="#mwt4" class="reference" 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">[1]</a></span>
19892
19893 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><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">1.0</a> <a href="#cite_ref-a_.26_b_1-1">1.1</a></span> foo</li>
19894 </ol>
19895 !!end
19896
19897 !!test
19898 References: 1. references tag without any refs should be handled properly
19899 !!options
19900 parsoid
19901 !! wikitext
19902 <references />
19903 !! html
19904 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19905 !!end
19906
19907 !!test
19908 References: 2. references tag with group only outputs references from that group
19909 !!options
19910 parsoid
19911 !! wikitext
19912 A <ref group="a">foo</ref>
19913 B <ref group="b">bar</ref>
19914
19915 <references group="a" />
19916 !! html
19917 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
19918 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}'><a href="#cite_note-2">[b 1]</a></span></p>
19919
19920 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
19921 </ol>
19922 !!end
19923
19924 !!test
19925 References: 3. ref list should be cleared after processing references
19926 !!options
19927 parsoid
19928 !! wikitext
19929 A <ref>foo</ref>
19930
19931 <references />
19932
19933 B <ref>bar</ref>
19934
19935 <references />
19936 !! html
19937 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19938
19939 <ol class="references" typeof="mw:Extension/references" about="#mwt4" 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> foo</li>
19940 </ol>
19941
19942 <p>B <span about="#mwt6" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
19943
19944 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bar</li>
19945 </ol>
19946 !!end
19947
19948 !!test
19949 References: 4. only referenced group should be cleared after processing references
19950 !!options
19951 parsoid
19952 !! wikitext
19953 A <ref group="a">afoo</ref>
19954 B <ref>bfoo</ref>
19955
19956 <references group="a" />
19957
19958 C <ref>cfoo</ref>
19959
19960 <references />
19961 !! html
19962 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
19963 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
19964
19965 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> afoo</li>
19966 </ol>
19967
19968 <p>C <span about="#mwt8" class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}'><a href="#cite_note-3">[2]</a></span></p>
19969
19970 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bfoo</li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> cfoo</li>
19971 </ol>
19972 !!end
19973
19974 !!test
19975 References: 5. ref tags in references should be processed while ignoring all other content
19976 !!options
19977 parsoid
19978 !! wikitext
19979 A <ref name="a" />
19980 B <ref name="b">bar</ref>
19981
19982 <references>
19983 <ref name="a">foo</ref>
19984 This should just get lost.
19985 </references>
19986 !! html
19987 <p>A <span about="#mwt2" class="reference" 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">[1]</a></span>
19988 B <span about="#mwt4" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
19989
19990
19991 <ol class="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=\"reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"src\":\"&amp;lt;ref name=\\\"a\\\">foo&amp;lt;/ref>\",\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> bar</li>
19992 </ol>
19993 !!end
19994
19995 !!test
19996 References: 6. <references /> from a transclusion
19997 !!options
19998 parsoid
19999 !! wikitext
20000 <ref>Foo</ref> {{echo|<references />}}
20001 !! html
20002 <p><span about="#mwt3" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> <ol class="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"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> Foo</li></ol>
20003 !!end
20004
20005 !! test
20006 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20007 !! options
20008 parsoid
20009 !! wikitext
20010 A <ref>foo bar for a</ref>
20011 B <ref group="X" name="b" />
20012
20013 <references />
20014
20015 <references group="X">
20016 <ref name="b">foo</ref>
20017 </references>
20018 !! html
20019 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
20020 B <span about="#mwt4" class="reference" 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">[X 1]</a></span></p>
20021
20022 <ol class="references" typeof="mw:Extension/references" about="#mwt6" 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> foo bar for a</li></ol>
20023
20024 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"src\":\"&amp;lt;ref name=\\\"b\\\">foo&amp;lt;/ref>\",\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\">[X 1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> foo</li></ol>
20025 !! end
20026
20027 !! test
20028 Entities in ref name
20029 !! options
20030 parsoid
20031 !! wikitext
20032 <ref name="test &amp; me">hi</ref>
20033 !! html
20034 <p><span about="#mwt2" class="reference" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"test &amp;amp; me\">hi&lt;/ref>"}' data-mw='{"name":"ref","body":{"html":"hi"},"attrs":{"name":"test &amp;amp; me"}}'><a href="#cite_note-test_.26_me-1">[1]</a></span></p>
20035 !! end
20036
20037 # This test is wt2html only because we're permitting the serializer to produce
20038 # dirty diffs, normalizing the unclosed references to the self-closed version.
20039 !! test
20040 Generate references for unclosed references tag
20041 !! options
20042 parsoid=wt2html
20043 !! wikitext
20044 a<ref>foo</ref>
20045
20046 <references>
20047 !! html
20048 <p>a<span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20049
20050
20051 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20052 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li></ol>
20053 !! end
20054
20055 !! test
20056 New reference serializes on its own line
20057 !! options
20058 parsoid=wt2wt,html2wt
20059 !! wikitext
20060 foo
20061 <references />
20062 !! html
20063 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20064 !! end
20065
20066 #--------- Test stripping of empty nodes in template content ----------
20067 !!test
20068 Empty LI and TR nodes should be stripped from template content
20069 !!wikitext
20070 {{EmptyLITest}}
20071 {{EmptyTRTest}}
20072 !!html/parsoid
20073 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20074 <li>a</li>
20075 <li>b</li>
20076 </ul>
20077 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20078 <tbody>
20079 <tr>
20080 <td>foo</td>
20081 </tr>
20082 <tr>
20083 <td>bar</td>
20084 </tr>
20085 </tbody>
20086 </table>
20087 !!end
20088
20089 !!test
20090 Empty LI and TR nodes should not be stripped from top-level content
20091 !!wikitext
20092 * a
20093 *
20094 * b
20095 {|
20096 |-
20097 |-
20098 |foo
20099 |}
20100 !!html/parsoid
20101 <ul>
20102 <li> a</li>
20103 <li></li>
20104 <li> b</li>
20105 </ul>
20106 <table>
20107 <tbody>
20108 <tr></tr>
20109 <tr>
20110 <td>foo</td>
20111 </tr>
20112 </tbody>
20113 </table>
20114 !!end
20115
20116 !!test
20117 Empty TR nodes should not be stripped if they have any attributes set
20118 !!wikitext
20119 {{EmptyTRWithHTMLAttrTest}}
20120 !!html/parsoid
20121 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20122 <tr align="center"></tr>
20123 <tr><td>foo</td></tr>
20124 <tr align="center"></tr>
20125 <tr><td>bar</td></tr>
20126 </table>
20127 !!end
20128
20129 #### ----------------------------------------------------------------
20130 #### The following section of tests are primarily to test
20131 #### wikitext escaping capabilities of Parsoid. Given that
20132 #### escaping can be done any number of ways, the wikitext (input)
20133 #### is always adjusted to reflect how Parsoid adds nowiki
20134 #### escape tags.
20135 ####
20136 #### We are marking several tests as parsoid-only since the
20137 #### HTML in the result section is different from what the
20138 #### PHP parser generates for it.
20139 #### ----------------------------------------------------------------
20140
20141
20142 #### --------------- Headings ---------------
20143 #### 0. Unnested
20144 #### 1. Nested inside html <h1>=foo=</h1>
20145 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20146 #### 3. Nested inside html with wikitext split by html tags
20147 #### 4. No escape needed
20148 #### 5. Empty headings <h1></h1>
20149 #### 6. Heading chars in SOL context
20150 #### ----------------------------------------
20151 !! test
20152 Headings: 0. Unnested
20153 !! options
20154 parsoid
20155 !! wikitext
20156 <nowiki>=foo=</nowiki>
20157
20158 <nowiki> =foo= </nowiki>
20159 <!--cmt-->
20160 <nowiki>=foo=</nowiki>
20161
20162 =foo''a''<nowiki>=</nowiki>
20163 !! html
20164 <p><span typeof="mw:Nowiki">=foo=</span></p>
20165
20166 <p><span typeof="mw:Nowiki"> =foo= </span>
20167 <!--cmt-->
20168 <span typeof="mw:Nowiki">=foo=</span></p>
20169
20170 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20171 !!end
20172
20173 # New headings and existing headings are handled differently
20174 !! test
20175 Headings: 1. Nested inside html
20176 !! options
20177 parsoid=html2wt
20178 !! html
20179 <h1>=foo=</h1>
20180 <h2>=foo=</h2>
20181 <h3>=foo=</h3>
20182
20183 <h1 data-parsoid=''>=foo=</h1>
20184 <h2 data-parsoid=''>=foo=</h2>
20185 <h3 data-parsoid=''>=foo=</h3>
20186 <h4 data-parsoid=''>=foo=</h4>
20187 <h5 data-parsoid=''>=foo=</h5>
20188 <h6 data-parsoid=''>=foo=</h6>
20189 !! wikitext
20190 = =foo= =
20191
20192 == =foo= ==
20193
20194 === =foo= ===
20195
20196 =<nowiki>=foo=</nowiki>=
20197 ==<nowiki>=foo=</nowiki>==
20198 ===<nowiki>=foo=</nowiki>===
20199 ====<nowiki>=foo=</nowiki>====
20200 =====<nowiki>=foo=</nowiki>=====
20201 ======<nowiki>=foo=</nowiki>======
20202
20203 !!end
20204
20205 !! test
20206 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20207 !! options
20208 parsoid=html2wt
20209 !! html
20210 <h1>foo</h1>*bar
20211 <h1>foo</h1>=bar
20212 <h1>foo</h1>=bar=
20213 !! wikitext
20214 = foo =
20215 <nowiki>*</nowiki>bar
20216
20217 = foo =
20218 =bar
20219
20220 = foo =
20221 <nowiki>=bar=</nowiki>
20222 !!end
20223
20224 !! test
20225 Headings: 3. Nested inside html with wikitext split by html tags
20226 !! options
20227 parsoid=html2wt,wt2wt
20228 !! wikitext
20229 = ='''bold'''<nowiki>foo=</nowiki> =
20230 !! html/parsoid
20231 <h1>=<b>bold</b>foo=</h1>
20232 !!end
20233
20234 !! test
20235 Headings: 4a. No escaping needed (testing just h1 and h2)
20236 !! wikitext
20237 = =foo =
20238
20239 = foo= =
20240
20241 = =foo= =
20242
20243 = =foo= bar =
20244
20245 == =foo ==
20246
20247 == foo= ==
20248
20249 = = =
20250
20251 = ''=''foo= =
20252 !! html/parsoid
20253 <h1>=foo</h1>
20254 <h1>foo=</h1>
20255 <h1> =foo= </h1>
20256 <h1>=foo= bar</h1>
20257 <h2>=foo</h2>
20258 <h2>foo=</h2>
20259 <h1>=</h1>
20260 <h1><i>=</i>foo=</h1>
20261 !!end
20262
20263 !! test
20264 Headings: 4b. No escaping needed (inside p-tags)
20265 !! options
20266 parsoid=html2wt
20267 !! html
20268 <p>===
20269 =foo= x
20270 =foo= <s></s>
20271 </p>
20272 !! wikitext
20273 ===
20274 =foo= x
20275 =foo= <s></s>
20276 !!end
20277
20278 !! test
20279 Headings: 5. Empty headings
20280 !! options
20281 parsoid
20282 !! wikitext
20283 =<nowiki/>=
20284
20285 ==<nowiki/>==
20286
20287 ===<nowiki/>===
20288
20289 ====<nowiki/>====
20290
20291 =====<nowiki/>=====
20292
20293 ======<nowiki/>======
20294 !! html
20295 <h1></h1>
20296 <h2></h2>
20297 <h3></h3>
20298 <h4></h4>
20299 <h5></h5>
20300 <h6></h6>
20301 !!end
20302
20303 !! test
20304 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20305 !! options
20306 parsoid
20307 !! wikitext
20308 <nowiki>=a=</nowiki>
20309
20310 <nowiki>=a=</nowiki>
20311
20312 <nowiki>=a=</nowiki>
20313
20314 <nowiki>=a=</nowiki>
20315 !! html
20316 <p>=a=</p>
20317 <p>=a= </p>
20318 <p>=a= </p>
20319 <p>=a= </p>
20320 !!end
20321
20322 !! test
20323 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20324 !! options
20325 parsoid
20326 !! wikitext
20327 <nowiki>=a=
20328 b</nowiki>
20329
20330 <nowiki>=a=
20331 b</nowiki>
20332
20333 <nowiki>=a=
20334 b</nowiki>
20335
20336 <nowiki>=a=
20337 b</nowiki>
20338 !! html
20339 <p>=a=
20340 b</p>
20341 <p>=a=
20342 b</p>
20343 <p>=a=
20344 b</p>
20345 <p>=a=
20346 b</p>
20347 </p>
20348 !!end
20349
20350 !! test
20351 Headings: 6c. Heading chars in SOL context (leading newline break)
20352 !! options
20353 parsoid
20354 !! wikitext
20355 a
20356 <nowiki>=b=</nowiki>
20357 !! html
20358 <p>a
20359 =b=</p>
20360 !!end
20361
20362 !! test
20363 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20364 !! options
20365 parsoid
20366 !! wikitext
20367 <!--c0--><nowiki>=a=</nowiki>
20368
20369 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20370 !! html
20371 <p><!--c0-->=a=</p>
20372 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20373 !!end
20374
20375 !! test
20376 Headings: 6d. Heading chars in SOL context (No escaping needed)
20377 !! options
20378 parsoid=html2wt
20379 !! html
20380 =a=<div>b</div>
20381 !! wikitext
20382 =a=<div>b</div>
20383 !!end
20384
20385 !! test
20386 Headings: 7. Insert a newline between new content and headings
20387 !! options
20388 parsoid=html2wt
20389 !! html
20390 <h2>NEW</h2>
20391 <p>new</p>
20392 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
20393 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
20394 !! wikitext
20395 == NEW ==
20396 new
20397
20398 ==A==
20399 a
20400
20401 !! end
20402
20403 #### --------------- Lists ---------------
20404 #### 0. Outside nests (*foo, etc.)
20405 #### 1. Nested inside html <ul><li>*foo</li></ul>
20406 #### 2. Inside definition lists
20407 #### 3. Only bullets at start should be escaped
20408 #### 4. No escapes needed
20409 #### 5. No unnecessary escapes
20410 #### 6. Escape bullets in SOL position
20411 #### 7. Escape bullets in a multi-line context
20412 #### ----------------------------------------
20413
20414 !! test
20415 Lists: 0. Outside nests
20416 !! wikitext
20417 <nowiki>*</nowiki>foo
20418
20419 <nowiki>#</nowiki>foo
20420
20421 <nowiki>;Foo:</nowiki>bar
20422 !! html
20423 <p>*foo
20424 </p><p>#foo
20425 </p><p>;Foo:bar
20426 </p>
20427 !!end
20428
20429 !! test
20430 Lists: 1. Nested inside html
20431 !! wikitext
20432 *<nowiki>*foo</nowiki>
20433
20434 *<nowiki>#foo</nowiki>
20435
20436 *<nowiki>:foo</nowiki>
20437
20438 *<nowiki>;foo</nowiki>
20439
20440 #<nowiki>*foo</nowiki>
20441
20442 #<nowiki>#foo</nowiki>
20443
20444 #<nowiki>:foo</nowiki>
20445
20446 #<nowiki>;foo</nowiki>
20447 !! html
20448 <ul><li>*foo</li></ul>
20449 <ul><li>#foo</li></ul>
20450 <ul><li>:foo</li></ul>
20451 <ul><li>;foo</li></ul>
20452 <ol><li>*foo</li></ol>
20453 <ol><li>#foo</li></ol>
20454 <ol><li>:foo</li></ol>
20455 <ol><li>;foo</li></ol>
20456
20457 !!end
20458
20459 !! test
20460 Lists: 2. Inside definition lists
20461 !! wikitext
20462 ;<nowiki>;foo</nowiki>
20463
20464 ;<nowiki>:foo</nowiki>
20465
20466 ;<nowiki>:foo</nowiki>
20467 :bar
20468
20469 :<nowiki>:foo</nowiki>
20470 !! html
20471 <dl><dt>;foo</dt></dl>
20472 <dl><dt>:foo</dt></dl>
20473 <dl><dt>:foo</dt>
20474 <dd>bar</dd></dl>
20475 <dl><dd>:foo</dd></dl>
20476
20477 !!end
20478
20479 !! test
20480 Lists: 3. Only bullets at start of text should be escaped
20481 !! wikitext
20482 *<nowiki>*foo*bar</nowiki>
20483
20484 *<nowiki>*foo</nowiki>''it''*bar
20485 !! html
20486 <ul><li>*foo*bar</li></ul>
20487 <ul><li>*foo<i>it</i>*bar</li></ul>
20488
20489 !!end
20490
20491 !! test
20492 Lists: 4. No escapes needed
20493 !! options
20494 parsoid
20495 !! wikitext
20496 *foo*bar
20497
20498 *''foo''*bar
20499
20500 *[[Foo]]: bar
20501
20502 *[[Foo]]*bar
20503 !! html
20504 <ul>
20505 <li>foo*bar
20506 </li>
20507 </ul>
20508 <ul>
20509 <li><i>foo</i>*bar
20510 </li>
20511 </ul>
20512 <ul>
20513 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20514 </li>
20515 </ul>
20516 <ul>
20517 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20518 </li>
20519 </ul>
20520 !!end
20521
20522 !! test
20523 Lists: 5. No unnecessary escapes
20524 !! wikitext
20525 * bar <span><nowiki>[[foo]]</nowiki></span>
20526
20527 * =bar <span><nowiki>[[foo]]</nowiki></span>
20528
20529 * [[bar <span><nowiki>[[foo]]</nowiki></span>
20530
20531 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
20532
20533 * =bar <span>foo]]</span>=
20534
20535 * <s></s>: a
20536
20537 * ''* foo''
20538 !! html
20539 <ul><li> bar <span>[[foo]]</span></li></ul>
20540 <ul><li> =bar <span>[[foo]]</span></li></ul>
20541 <ul><li> [[bar <span>[[foo]]</span></li></ul>
20542 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
20543 <ul><li> =bar <span>foo]]</span>=</li></ul>
20544 <ul><li> <s></s>: a</li></ul>
20545 <ul><li> <i>* foo</i></li></ul>
20546
20547 !!end
20548
20549 !! test
20550 Lists: 6. Escape bullets in SOL position
20551 !! options
20552 parsoid=html2wt
20553 !! html
20554 <p><!--cmt-->*foo</p>
20555 !! wikitext
20556 <!--cmt--><nowiki>*</nowiki>foo
20557 !!end
20558
20559 !! test
20560 Lists: 7. Escape bullets in a multi-line context
20561 !! wikitext
20562 a
20563 <nowiki>*</nowiki>b
20564 !! html
20565 <p>a
20566 *b
20567 </p>
20568 !!end
20569
20570 !! test
20571 Lists: 8. Escape colons only if not present in tags
20572 !! options
20573 parsoid=html2wt
20574 !! html
20575 <dl><dt>a:b<i>c:d</i></dt></dl>
20576 !! wikitext
20577 ; <nowiki>a:b</nowiki>''c:d''
20578 !! end
20579
20580 #### --------------- HRs ---------------
20581 #### 1. Single line
20582 #### -----------------------------------
20583
20584 !! test
20585 HRs: 1. Single line
20586 !! wikitext
20587 ----<nowiki>----</nowiki>
20588 ----=foo=
20589 ----*foo
20590 !! html+tidy
20591 <hr />
20592 <p>----</p>
20593 <hr />
20594 <p>=foo=</p>
20595 <hr />
20596 <p>*foo</p>
20597 !! end
20598
20599 #### --------------- Tables ---------------
20600 #### 1a. Simple example
20601 #### 1b. No escaping needed (!foo)
20602 #### 1c. No escaping needed (|foo)
20603 #### 1d. No escaping needed (|}foo)
20604 ####
20605 #### 2a. Nested in td (<td>foo|bar</td>)
20606 #### 2b. Nested in td (<td>foo||bar</td>)
20607 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20608 ####
20609 #### 3a. Nested in th (<th>foo!bar</th>)
20610 #### 3b. Nested in th (<th>foo!!bar</th>)
20611 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20612 ####
20613 #### 4a. Escape -
20614 #### 4b. Escape +
20615 #### 4c. No escaping needed
20616 #### --------------------------------------
20617
20618 !! test
20619 Tables: 1a. Simple example
20620 !! wikitext
20621 <nowiki>{|
20622 |}</nowiki>
20623 !! html
20624 <p>{|
20625 |}
20626 </p>
20627 !! end
20628
20629 !! test
20630 Tables: 1b. No escaping needed
20631 !! wikitext
20632 !foo
20633 !! html
20634 <p>!foo
20635 </p>
20636 !! end
20637
20638 !! test
20639 Tables: 1c. No escaping needed
20640 !! wikitext
20641 |foo
20642 !! html
20643 <p>|foo
20644 </p>
20645 !! end
20646
20647 !! test
20648 Tables: 1d. No escaping needed
20649 !! wikitext
20650 |}foo
20651 !! html
20652 <p>|}foo
20653 </p>
20654 !! end
20655
20656 !! test
20657 Tables: 2a. Nested in td
20658 !! options
20659 parsoid=html2wt
20660 !! html/parsoid
20661 <table><tbody><tr>
20662 <td>foo|bar</td></tr>
20663 <tr><td>x<div>a|b</div></td>
20664 </tbody></table>
20665 !! wikitext
20666 {|
20667 |<nowiki>foo|bar</nowiki>
20668 |-
20669 |x<div><nowiki>a|b</nowiki></div>
20670 |}
20671 !! html/php+tidy
20672 <table>
20673 <tr>
20674 <td>foo|bar</td>
20675 </tr>
20676 <tr>
20677 <td>x
20678 <div>a|b</div>
20679 </td>
20680 </tr>
20681 </table>
20682 !! end
20683
20684 !! test
20685 Tables: 2b. Nested in td
20686 !! options
20687 parsoid=html2wt
20688 !! html/parsoid
20689 <table><tbody><tr>
20690 <td>foo||bar</td>
20691 <td>a<i>b||c</i></td>
20692 <td>a<i><div>b||c</div></i></td>
20693 </tr></tbody></table>
20694 !! wikitext
20695 {|
20696 |<nowiki>foo||bar</nowiki>
20697 |a''<nowiki>b||c</nowiki>''
20698 |a''<div><nowiki>b||c</nowiki></div>''
20699 |}
20700 !! html/php
20701 <table>
20702 <tr>
20703 <td>foo||bar
20704 </td>
20705 <td>a<i>b||c</i>
20706 </td>
20707 <td>a<i><div>b||c</div></i>
20708 </td></tr></table>
20709
20710 !! end
20711
20712 !! test
20713 Tables: 2c. Nested in td -- no escaping needed
20714 !! wikitext
20715 {|
20716
20717 |foo!!bar
20718 |}
20719 !! html/*
20720 <table>
20721
20722 <tr>
20723 <td>foo!!bar
20724 </td></tr></table>
20725
20726 !! end
20727
20728 !! test
20729 Tables: 3a. Nested in th
20730 !! wikitext
20731 {|
20732
20733 !foo!bar
20734 |}
20735 !! html/*
20736 <table>
20737
20738 <tr>
20739 <th>foo!bar
20740 </th></tr></table>
20741
20742 !! end
20743
20744 !! test
20745 Tables: 3b. Nested in th
20746 !! options
20747 parsoid=html2wt
20748 !! html/parsoid
20749 <table><tbody>
20750 <tr><th>foo!!bar</th>
20751 <th><i>foo|bar</i></th>
20752 <th><i>foo!!bar</i></th>
20753 <th><i><span>foo!!bar</span></i></th>
20754 </tr></tbody></table>
20755 !! wikitext
20756 {|
20757 !<nowiki>foo!!bar</nowiki>
20758 !''<nowiki>foo|bar</nowiki>''
20759 !''<nowiki>foo!!bar</nowiki>''
20760 !''<span><nowiki>foo!!bar</nowiki></span>''
20761 |}
20762 !! html/php
20763 <table>
20764 <tr>
20765 <th>foo!!bar
20766 </th>
20767 <th><i>foo|bar</i>
20768 </th>
20769 <th><i>foo!!bar</i>
20770 </th>
20771 <th><i><span>foo!!bar</span></i>
20772 </th></tr></table>
20773
20774 !! end
20775
20776 !! test
20777 Tables: 3c. Nested in th
20778 !! options
20779 parsoid=html2wt
20780 !! html/parsoid
20781 <table><tbody>
20782 <tr><th>foo||bar</th>
20783 <th><span typeof="mw:Nowiki">foo||bar</span></th>
20784 </tr></tbody></table>
20785 !! wikitext
20786 {|
20787 !<nowiki>foo||bar</nowiki>
20788 !<nowiki>foo||bar</nowiki>
20789 |}
20790 !! html/php
20791 <table>
20792 <tr>
20793 <th>foo||bar
20794 </th>
20795 <th>foo||bar
20796 </th></tr></table>
20797
20798 !! end
20799
20800 !! test
20801 Tables: 4a. Escape -
20802 !! options
20803 parsoid=html2wt
20804 !! html/*
20805 <table>
20806
20807 <tr>
20808 <th>-bar
20809 </th></tr>
20810 <tr>
20811 <td>-bar
20812 </td></tr></table>
20813
20814 !! wikitext
20815 {|
20816
20817 !-bar
20818
20819 |-
20820 |<nowiki>-bar</nowiki>
20821 |}
20822 !! end
20823
20824 !! test
20825 Tables: 4b. Escape +
20826 !! options
20827 parsoid=html2wt
20828 !! html/*
20829 <table>
20830
20831 <tr>
20832 <th>+bar
20833 </th></tr>
20834 <tr>
20835 <td>+bar
20836 </td></tr></table>
20837
20838 !! wikitext
20839 {|
20840
20841 !+bar
20842
20843 |-
20844 |<nowiki>+bar</nowiki>
20845 |}
20846 !! end
20847
20848 !! test
20849 Tables: 4c. No escaping needed
20850 !! wikitext
20851 {|
20852 |foo-bar
20853 |foo+bar
20854 |-
20855 |''foo''-bar
20856 |''foo''+bar
20857 |-
20858 |foo
20859 bar|baz
20860 +bar
20861 -bar
20862 |-
20863 |x
20864 <div>a|b</div>
20865 |}
20866 !! html/php
20867 <table>
20868 <tr>
20869 <td>foo-bar
20870 </td>
20871 <td>foo+bar
20872 </td></tr>
20873 <tr>
20874 <td><i>foo</i>-bar
20875 </td>
20876 <td><i>foo</i>+bar
20877 </td></tr>
20878 <tr>
20879 <td>foo
20880 <p>bar|baz
20881 +bar
20882 -bar
20883 </p>
20884 </td></tr>
20885 <tr>
20886 <td>x
20887 <div>a|b</div>
20888 </td></tr></table>
20889
20890 !! html/parsoid
20891 <table><tbody>
20892 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20893 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20894 <tr><td>foo
20895 <p>bar|baz
20896 +bar
20897 -bar</p></td></tr>
20898 <tr><td>x
20899 <div>a|b</div></td>
20900 </tbody></table>
20901 !! end
20902
20903 !! test
20904 Tables: 4d. No escaping needed
20905 !! wikitext
20906 {|
20907 |[[Foo]]-bar
20908 ||+1
20909 ||-2
20910 |}
20911 !! html/php
20912 <table>
20913 <tr>
20914 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
20915 </td>
20916 <td>+1
20917 </td>
20918 <td>-2
20919 </td></tr></table>
20920
20921 !! html/parsoid
20922 <table>
20923 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20924 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20925 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20926 </tbody></table>
20927 !! end
20928
20929 !! test
20930 Tables: Digest broken attributes on table and tr tag
20931 !! options
20932 parsoid=wt2html
20933 !! wikitext
20934 {| || |} ++
20935 |- || || ++ --
20936 |- > [
20937 |}
20938 !! html
20939 <table>
20940 <tbody>
20941 <tr></tr>
20942 <tr></tr>
20943 </tbody></table>
20944 !! end
20945
20946 #### --------------- Links ----------------
20947 #### 1. Quote marks in link text
20948 #### 2. Wikilinks: Escapes needed
20949 #### 3. Wikilinks: No escapes needed
20950 #### 4. Extlinks: Escapes needed
20951 #### 5. Extlinks: No escapes needed
20952 #### --------------------------------------
20953 !! test
20954 Links 1. WikiLinks: No escapes needed
20955 !! wikitext
20956 [[Foo|Foo''boo'']]
20957 [[Foo|[Foobar]]]
20958 [[Foo|x [Foobar] x]]
20959 !! html/php
20960 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
20961 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
20962 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
20963 </p>
20964 !! html/parsoid
20965 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
20966 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
20967 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
20968 !! end
20969
20970 !! test
20971 Links 2. WikiLinks: Escapes needed
20972 !! options
20973 parsoid=html2wt
20974 !! html/parsoid
20975 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20976 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20977 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20978 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20979 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20980 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20981 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20982 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20983 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20984 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20985 !! wikitext
20986 [[Foo|<nowiki>Foobar]</nowiki>]]
20987 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20988 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20989 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20990 [[Foo|<nowiki>|Bar</nowiki>]]
20991 [[Foo|<nowiki>]]bar</nowiki>]]
20992 [[Foo|<nowiki>[[bar</nowiki>]]
20993 [[Foo|<nowiki>x [[ y</nowiki>]]
20994 [[Foo|<nowiki>x ]] y</nowiki>]]
20995 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20996 !! html/php
20997 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
20998 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
20999 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21000 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21001 <a href="/wiki/Foo" title="Foo">|Bar</a>
21002 <a href="/wiki/Foo" title="Foo">]]bar</a>
21003 <a href="/wiki/Foo" title="Foo">[[bar</a>
21004 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21005 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21006 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21007 </p>
21008 !! end
21009
21010 !! test
21011 Links 3. WikiLinks: No escapes needed
21012 !! wikitext
21013 [[Foo|[Foobar]]
21014 [[Foo|foo|bar]]
21015 !! html/php
21016 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21017 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21018 </p>
21019 !! html/parsoid
21020 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21021 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21022 !! end
21023
21024 !! test
21025 Links 4. ExtLinks: Escapes needed
21026 !! options
21027 parsoid=html2wt
21028 !! html/parsoid
21029 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21030 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21031 <p>[http://google.com]</p>
21032 <p>[http://google.com google]</p>
21033 !! wikitext
21034 [http://google.com <nowiki>[google]</nowiki>]
21035 [http://google.com <nowiki>google]</nowiki>]
21036
21037 <nowiki>[http://google.com]</nowiki>
21038
21039 <nowiki>[http://google.com google]</nowiki>
21040
21041 !! html/php
21042 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21043 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21044 </p><p>[http://google.com]
21045 </p><p>[http://google.com google]
21046 </p>
21047 !! end
21048
21049 !! test
21050 Links 5. ExtLinks: No escapes needed
21051 !! wikitext
21052 [http://google.com [google]
21053 !! html/php
21054 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21055 </p>
21056 !! html/parsoid
21057 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21058 !! end
21059
21060 !! test
21061 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21062 !! html/parsoid
21063 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21064 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21065 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21066 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21067 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21068 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21069 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21070 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
21071 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21072 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
21073 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
21074 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
21075 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21076 </p>
21077 !! wikitext
21078 x<nowiki/>http://example.com<nowiki/>y
21079 http://example.com<nowiki/>?x
21080 http://example.com<nowiki/>&x
21081 http://example.com<nowiki/>'x
21082 http://example.com<nowiki/>,x
21083 http://example.com<nowiki/>.x
21084 http://example.com<nowiki/>;x
21085 http://example.com<nowiki/>:x
21086 http://example.com<nowiki/>;x
21087 http://example.com<nowiki/>!x
21088 http://example.com<nowiki/>=x
21089 http://example.com<nowiki/>(x)
21090 http://example.com(x<nowiki/>)
21091 !! end
21092
21093 !! test
21094 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21095 !! html/parsoid
21096 <p>x
21097 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21098 y
21099 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21100 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21101 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21102 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21103 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21104 </p>
21105 !! wikitext
21106 x
21107 http://example.com
21108 y
21109 "http://example.com"
21110 (http://example.com)
21111 (http://example.com) foo
21112 http://example.com,
21113 http://example.com, foo
21114 !! html/php
21115 <p>x
21116 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21117 y
21118 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21119 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21120 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21121 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21122 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21123 </p>
21124 !! end
21125
21126 !! test
21127 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21128 !! html/parsoid
21129 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21130 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21131 !! wikitext
21132 http://example.com.,;:!?\
21133 -http://example.com:
21134 !! html/php
21135 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21136 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21137 </p>
21138 !! end
21139
21140 !! test
21141 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21142 !! html/parsoid
21143 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21144 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21145 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21146 !! wikitext
21147 RFC 123<nowiki/>4
21148 RFC 123<nowiki/>y
21149 X<nowiki/>RFC 123<nowiki/>y
21150 !! end
21151
21152 !! test
21153 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21154 !! html/parsoid
21155 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21156 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21157 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21158 </p>
21159 !! wikitext
21160 RFC 123?foo
21161 RFC 123&foo
21162 -RFC 123-
21163 !! html/php
21164 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21165 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21166 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21167 </p>
21168 !! end
21169
21170 !! test
21171 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21172 !! html/parsoid
21173 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21174 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21175 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21176 !! wikitext
21177 PMID 123<nowiki/>4
21178 PMID 123<nowiki/>y
21179 X<nowiki/>PMID 123<nowiki/>y
21180 !! end
21181
21182 !! test
21183 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21184 !! html/parsoid
21185 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21186 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21187 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21188 </p>
21189 !! wikitext
21190 PMID 123?foo
21191 PMID 123&foo
21192 -PMID 123-
21193 !! html/php
21194 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21195 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21196 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21197 </p>
21198 !! end
21199
21200 !! test
21201 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21202 !! html/parsoid
21203 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21204 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21205 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21206 </p>
21207 !! wikitext
21208 ISBN 1234567890<nowiki/>1
21209 ISBN 1234567890<nowiki/>x
21210 a<nowiki/>ISBN 1234567890<nowiki/>b
21211 !! end
21212
21213 !! test
21214 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21215 !! html/parsoid
21216 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21217 !! wikitext
21218 -ISBN 1234567890's
21219 !! html/php
21220 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
21221 </p>
21222 !! end
21223
21224 !! test
21225 Links 14. Protect link-like plain text. (Parsoid bug T78425)
21226 !! options
21227 parsoid=html2wt
21228 !! html/*
21229 <p>this is not a link: http://example.com
21230 </p>
21231 !! wikitext
21232 this is not a link: <nowiki>http://example.com</nowiki>
21233 !! end
21234
21235 !! test
21236 Links 15. Link trails can't become link prefixes.
21237 !! options
21238 language=is
21239 !! wikitext
21240 [[Söfnuður]]-[[00]]
21241 !! html/php
21242 <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>
21243 </p>
21244 !! html/parsoid
21245 <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>
21246 !! end
21247
21248 #### --------------- Quotes ---------------
21249 #### 1. Quotes inside <b> and <i>
21250 #### 2. Link fragments separated by <i> and <b> tags
21251 #### 3. Link fragments inside <i> and <b>
21252 #### 4. No escaping needed
21253 #### --------------------------------------
21254 !! test
21255 1a. Quotes inside <b> and <i>
21256 !! options
21257 parsoid=html2wt,wt2wt
21258 !! wikitext
21259 ''<nowiki/>'foo'''
21260 ''<nowiki>''foo''</nowiki>''
21261 ''<nowiki>'''foo'''</nowiki>''
21262 ''foo''<nowiki/>'s
21263 '''<nowiki/>'foo''''
21264 '''<nowiki>''foo''</nowiki>'''
21265 '''<nowiki>'''foo'''</nowiki>'''
21266 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
21267 '''foo'''<nowiki/>'s
21268 '''foo''
21269 ''foo''<nowiki/>'
21270 ''foo'''<nowiki/>'
21271 '''foo''<nowiki/>'
21272 ''''foo'''
21273 '''foo'''<nowiki/>'
21274 ''''foo'''<nowiki/>'
21275 ''fools'<span> errand</span>''
21276 ''<span>fool</span>'s errand''
21277 '<nowiki/>''foo'' bar '''baz''
21278 a|!*#-:;+-~[]{}b'''x''
21279 !! html/*
21280 <p><i>'foo'</i>
21281 <i>''foo''</i>
21282 <i>'''foo'''</i>
21283 <i>foo</i>'s
21284 <b>'foo'</b>
21285 <b>''foo''</b>
21286 <b>'''foo'''</b>
21287 <b>foo'<i>bar'</i>baz</b>
21288 <b>foo</b>'s
21289 '<i>foo</i>
21290 <i>foo</i>'
21291 <i>foo'</i>'
21292 '<i>foo</i>'
21293 '<b>foo</b>
21294 <b>foo</b>'
21295 '<b>foo</b>'
21296 <i>fools'<span> errand</span></i>
21297 <i><span>fool</span>'s errand</i>
21298 '<i>foo</i> bar '<i>baz</i>
21299 a|!*#-:;+-~[]{}b'<i>x</i>
21300 </p>
21301 !! end
21302
21303 !! test
21304 1b. Quotes inside <b> and <i> with other tags on same line
21305 !! options
21306 parsoid=html2wt,wt2wt
21307 !! wikitext
21308 '''a'' foo ''[[bar]]''
21309 ''a''' foo ''[[bar]]''
21310 ''a''' foo '''{{echo|[[bar]]}}'''
21311 [[foo]] x'''[[bar]]''
21312 '''foo'' <ref>test</ref>
21313 '''foo'' <div title="name">test</div>
21314 '''foo'' and <br> bar
21315 !! html
21316 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21317 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21318 <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>
21319 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
21320 '<i>foo</i> <span class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"test"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
21321 '<i>foo</i> <div title="name">test</div>
21322 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
21323 !! end
21324
21325 !! test
21326 2. Link fragments separated by <i> and <b> tags
21327 !! wikitext
21328 [[''foo''<nowiki>hello]]</nowiki>
21329
21330 [['''foo'''<nowiki>hello]]</nowiki>
21331 !! html
21332 <p>[[<i>foo</i>hello]]
21333 </p><p>[[<b>foo</b>hello]]
21334 </p>
21335 !! end
21336
21337 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
21338 # this is one of the shortcomings of this format
21339 !! test
21340 3. Link fragments inside <i> and <b>
21341 !! wikitext
21342 ''[[foo''<nowiki>]]</nowiki>
21343
21344 '''[[foo'''<nowiki>]]</nowiki>
21345 !! html
21346 <p><i>[[foo</i>]]
21347 </p><p><b>[[foo</b>]]
21348 </p>
21349 !! end
21350
21351 !! test
21352 4. No escaping needed
21353 !! wikitext
21354 '<span>''bar''</span>'
21355 '<span>'''bar'''</span>'
21356 'a:b'foo
21357 !! html
21358 <p>'<span><i>bar</i></span>'
21359 '<span><b>bar</b></span>'
21360 'a:b'foo
21361 </p>
21362 !! end
21363
21364 #### ----------- Paragraphs ---------------
21365 #### 1. No unnecessary escapes
21366 #### --------------------------------------
21367
21368 !! test
21369 1. No unnecessary escapes
21370 !! wikitext
21371 bar <span><nowiki>[[foo]]</nowiki></span>
21372
21373 =bar <span><nowiki>[[foo]]</nowiki></span>
21374
21375 [[bar <span><nowiki>[[foo]]</nowiki></span>
21376
21377 ]]bar <span><nowiki>[[foo]]</nowiki></span>
21378
21379 =bar <span>foo]]</span><nowiki>=</nowiki>
21380 !! html
21381 <p>bar <span>[[foo]]</span>
21382 </p><p>=bar <span>[[foo]]</span>
21383 </p><p>[[bar <span>[[foo]]</span>
21384 </p><p>]]bar <span>[[foo]]</span>
21385 </p><p>=bar <span>foo]]</span>=
21386 </p>
21387 !!end
21388
21389 #### ----------------------- PRE --------------------------
21390 #### 1. Leading whitespace in SOL context should be escaped
21391 #### ------------------------------------------------------
21392 !! test
21393 1. Leading whitespace in SOL context should be escaped
21394 !! options
21395 parsoid
21396 !! wikitext
21397 <nowiki> </nowiki>a
21398
21399 <nowiki> </nowiki> a
21400
21401 <nowiki> </nowiki>a(tab)
21402
21403 <nowiki> </nowiki> a
21404 <!--cmt-->
21405 <nowiki> </nowiki> a
21406
21407 a
21408 <nowiki> </nowiki>b
21409
21410 a
21411 <nowiki> </nowiki>b
21412
21413 a
21414 <nowiki> </nowiki> b
21415 !! html
21416 <p> a</p>
21417 <p> a</p>
21418 <p> a(tab)</p>
21419 <p> a</p>
21420 <p><!--cmt--> a</p>
21421 <p>a
21422 b</p>
21423 <p>a
21424 b</p>
21425 <p>a
21426 b</p>
21427 !! end
21428
21429 !! test
21430 2. Leading whitespace in non-indent-pre contexts should not be escaped
21431 !! options
21432 parsoid
21433 !! wikitext
21434 foo <ref>''a''
21435 b</ref>
21436 !! html
21437 <p>foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
21438 !! end
21439
21440 !! test
21441 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
21442 !! options
21443 parsoid
21444 !! wikitext
21445 <blockquote>
21446 a
21447 <span>b</span>
21448 c
21449 </blockquote>
21450 !! html
21451 <blockquote>
21452 <p>
21453 a
21454 <span>b</span>
21455 c</p>
21456 </blockquote>
21457 !! end
21458
21459 !! test
21460 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
21461 !! options
21462 parsoid
21463 !! wikitext
21464 [[File:Foobar.jpg|thumb|caption]]
21465 !! html
21466 !! html/parsoid
21467 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
21468 !! end
21469
21470 !! test
21471 5. Nowiki escaping should account for indent-pres
21472 !! options
21473 parsoid=html2wt
21474 !! html
21475 <pre>==foo==</pre>
21476 !! wikitext
21477 ==foo==
21478 !! end
21479
21480 #### --------------- Behavior Switches --------------------
21481 !! test
21482 1. Valid behavior switches should be escaped
21483 !! options
21484 parsoid=html2wt
21485 !! html
21486 __TOC__
21487 <i>__TOC__</i>
21488 !! wikitext
21489 <nowiki>__TOC__</nowiki>
21490 ''<nowiki>__TOC__</nowiki>''
21491 !! end
21492
21493 !! test
21494 2. Invalid behavior switches should not be escaped
21495 !! options
21496 parsoid=html2wt
21497 !! html
21498 __TOO__
21499 __|__
21500 !! wikitext
21501 __TOO__
21502 __|__
21503 !! end
21504
21505 #### --------------- HTML tags ---------------
21506 #### 1. a tags
21507 #### 2. other tags
21508 #### 3. multi-line html tag
21509 #### 4. extension tags
21510 #### -----------------------------------------
21511 !! test
21512 1. a tags
21513 !! options
21514 parsoid
21515 !! wikitext
21516 <a href="http://google.com">google</a>
21517 !! html
21518 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
21519 !! end
21520
21521 !! test
21522 2. other tags
21523 !! wikitext
21524 <nowiki><div>foo</div>
21525 <div style="color:red">foo</div></nowiki>
21526 !! html
21527 <p>&lt;div&gt;foo&lt;/div&gt;
21528 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
21529 </p>
21530 !! end
21531
21532 !! test
21533 3. multi-line html tag
21534 !! wikitext
21535 <nowiki><div
21536 >foo</div
21537 ></nowiki>
21538 !! html
21539 <p>&lt;div
21540 &gt;foo&lt;/div
21541 &gt;
21542 </p>
21543 !! end
21544
21545 !! test
21546 4. extension tags
21547 !! wikitext
21548 <nowiki><ref>foo</ref></nowiki>
21549
21550 <nowiki><ref>bar</nowiki>
21551
21552 baz<nowiki></ref></nowiki>
21553 !! html
21554 <p>&lt;ref&gt;foo&lt;/ref&gt;
21555 </p><p>&lt;ref&gt;bar
21556 </p><p>baz&lt;/ref&gt;
21557 </p>
21558 !! end
21559
21560 #### --------------- Others ---------------
21561 !! test
21562 Escaping nowikis
21563 !! wikitext
21564 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21565 !! html
21566 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21567 </p>
21568 !! end
21569
21570 ## The quote-char in the input is necessary for triggering the bug
21571 !! test
21572 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21573 !! options
21574 parsoid=wt2wt,html2wt
21575 !! wikitext
21576 foo's bar :
21577 !! html
21578 <p>foo's bar :</p>
21579 !! end
21580
21581 !! test
21582
21583 Tag-like HTML structures are passed through as text
21584 !! wikitext
21585 <x y>
21586
21587 <x.y>
21588
21589 <x-y>
21590
21591 1>2
21592
21593 x<y
21594
21595 a>b
21596
21597 1<d e>f
21598 !! html
21599 <p>&lt;x y&gt;
21600 </p><p>&lt;x.y&gt;
21601 </p><p>&lt;x-y&gt;
21602 </p><p>1&gt;2
21603 </p><p>x&lt;y
21604 </p><p>a&gt;b
21605 </p><p>1&lt;d e&gt;f
21606 </p>
21607 !! end
21608
21609
21610 # This was a bug in the PHP parser (see bug 17663 and its dups,
21611 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21612 !! test
21613 Tag names followed by punctuation should not be recognized as tags
21614 !! wikitext
21615 <s.ome> text
21616 !! html
21617 <p>&lt;s.ome&gt; text
21618 </p>
21619 !! end
21620
21621 !! test
21622 HTML tag with necessary entities in attributes
21623 !! wikitext
21624 <span title="&amp;amp;">foo</span>
21625 !! html
21626 <p><span title="&amp;amp;">foo</span>
21627 </p>
21628 !! end
21629
21630 !! test
21631 HTML tag with 'unnecessary' entity encoding in attributes
21632 !! wikitext
21633 <span title="&amp;">foo</span>
21634 !! html
21635 <p><span title="&amp;">foo</span>
21636 </p>
21637 !! end
21638
21639 !! test
21640 HTML tag with broken attribute value quoting
21641 !! wikitext
21642 <span title="Hello world>Foo</span>
21643 !! html/php
21644 <p><span>Foo</span>
21645 </p>
21646 !! html/parsoid
21647 <p><span title="Hello world">Foo</span>
21648 </p>
21649 !! end
21650
21651 !! test
21652 Parsoid-only: HTML tag with broken attribute value quoting
21653 !! options
21654 parsoid
21655 !! wikitext
21656 <span title="Hello world>Foo</span>
21657 !! html
21658 <p><span title="Hello world">Foo</span>
21659 </p>
21660 !! end
21661
21662 !! test
21663 Table with broken attribute value quoting
21664 !! wikitext
21665 {|
21666 | title="Hello world|Foo
21667 |}
21668 !! html/php
21669 <table>
21670 <tr>
21671 <td>Foo
21672 </td></tr></table>
21673
21674 !! html/parsoid
21675 <table>
21676 <tr>
21677 <td title="Hello world">Foo
21678 </td></tr></table>
21679
21680 !! end
21681
21682 !! test
21683 Table with broken attribute value quoting on consecutive lines
21684 !! wikitext
21685 {|
21686 | title="Hello world|Foo
21687 | style="color:red|Bar
21688 |}
21689 !! html/php
21690 <table>
21691 <tr>
21692 <td>Foo
21693 </td>
21694 <td>Bar
21695 </td></tr></table>
21696
21697 !! html/parsoid
21698 <table><tbody>
21699 <tr>
21700 <td title="Hello world">Foo
21701 </td><td style="color: red">Bar
21702 </td></tr></tbody></table>
21703
21704 !! end
21705
21706 !! test
21707 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21708 !! options
21709 parsoid
21710 !! wikitext
21711 {{}}
21712 !! html
21713 {{}}
21714 !! end
21715
21716 !! test
21717 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21718 !! options
21719 parsoid
21720 !! wikitext
21721 }}{{
21722 !! html
21723 }}{{
21724 !! end
21725
21726 !!test
21727 Accept empty td cell attribute
21728 !! wikitext
21729 {|
21730 | align="center" | foo || |
21731 |}
21732 !! html
21733 <table>
21734 <tr>
21735 <td align="center"> foo </td>
21736 <td>
21737 </td></tr></table>
21738
21739 !!end
21740
21741 !!test
21742 Non-empty attributes in th-cells
21743 !! wikitext
21744 {|
21745 ! Foo !! style="color: red" | Bar
21746 |}
21747 !! html
21748 <table>
21749 <tr>
21750 <th> Foo </th>
21751 <th style="color: red"> Bar
21752 </th></tr></table>
21753
21754 !!end
21755
21756 !!test
21757 Accept empty attributes in th-cells
21758 !! wikitext
21759 {|
21760 !| foo !!| bar
21761 |}
21762 !! html
21763 <table>
21764 <tr>
21765 <th> foo </th>
21766 <th> bar
21767 </th></tr></table>
21768
21769 !!end
21770
21771 !!test
21772 Empty table rows go away
21773 !! wikitext
21774 {|
21775 | Hello
21776 | there
21777 |- class="foo"
21778 |-
21779 |}
21780 !! html
21781 <table>
21782 <tr>
21783 <td> Hello
21784 </td>
21785 <td> there
21786 </td></tr>
21787
21788 </table>
21789
21790 !! end
21791
21792 ###
21793 ### Parsoid-centric tests for testing RTing of inter-element separators
21794 ### Edge cases not tested by existing parser tests and specific to
21795 ### Parsoid-specific serialization strategies.
21796 ###
21797
21798 !!test
21799 RT-ed inter-element separators should be valid separators
21800 !! wikitext
21801 {|
21802 |- [[foo]]
21803 |}
21804 !! html
21805 <table>
21806
21807 </table>
21808
21809 !!end
21810
21811 # Parsoid-only since PHP parser relies on Tidy for correct output
21812 !!test
21813 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21814 !!options
21815 parsoid
21816 !! wikitext
21817 {|
21818 |<small>foo
21819 bar
21820 |}
21821
21822 {|
21823 |<small>foo<small>
21824 |}
21825 !! html
21826 <table>
21827 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21828 <p>bar</p></small></td></tr>
21829 </tbody></table>
21830
21831 <table>
21832 <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>
21833 </tbody></table>
21834 !!end
21835
21836 !!test
21837 Empty TD followed by TD with tpl-generated attribute
21838 !! wikitext
21839 {|
21840 |-
21841 |
21842 |{{echo|style='color:red'}}|foo
21843 |}
21844 !! html
21845 <table>
21846
21847 <tr>
21848 <td>
21849 </td>
21850 <td>foo
21851 </td></tr></table>
21852
21853 !!end
21854
21855 !!test
21856 Indented table with an empty td
21857 !! wikitext
21858 {|
21859 |-
21860 |
21861 |foo
21862 |}
21863 !! html
21864 <table>
21865
21866 <tr>
21867 <td>
21868 </td>
21869 <td>foo
21870 </td></tr></table>
21871
21872 !!end
21873
21874 ## We have some newline diffs RT-ing this edge case
21875 ## and it is not important enough -- we seem to be emitting
21876 ## at most 2 newlines after a </tr> and this is unrelated to
21877 ## the issue from T85627 that this is testing.
21878 !!test
21879 Indented table with blank lines in between (T85627)
21880 !! options
21881 parsoid=wt2html
21882 !! wikitext
21883 {|
21884 |foo
21885
21886
21887 |}
21888 !! html
21889 <table>
21890
21891 <tr>
21892 <td>foo
21893 </td></tr></table>
21894
21895 !!end
21896
21897 !!test
21898 Indented block & table
21899 !! wikitext
21900 <div>foo</div>
21901 {|
21902 |foo
21903 |}
21904 !! html/php
21905 <div>foo</div>
21906 <table>
21907 <tr>
21908 <td>foo
21909 </td></tr></table>
21910
21911 !! html/parsoid
21912 <div data-parsoid='{"stx":"html"}'>foo</div>
21913 <table><tbody>
21914 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21915 </tbody></table>
21916 !!end
21917
21918 !! test
21919 Indent and comment before table row
21920 !! wikitext
21921 {|
21922 <!--hi-->|-
21923 | there
21924 |}
21925 !! html/php
21926 <table>
21927
21928 <tr>
21929 <td> there
21930 </td></tr></table>
21931
21932 !! html/parsoid
21933 <table>
21934 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
21935 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
21936 </tbody></table>
21937 !! end
21938
21939 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
21940 !!test
21941 Empty TR followed by a template-generated TR
21942 !!options
21943 parsoid
21944 !! wikitext
21945 {|
21946 |-
21947 {{echo|<tr><td>foo</td></tr>}}
21948 |}
21949 !! html
21950 <table>
21951 <tbody>
21952 <tr></tr>
21953 <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}}]}'>
21954 <td>foo</td></tr>
21955 </tbody></table>
21956 !!end
21957
21958 ## PHP and parsoid output differ for this, and since this is primarily
21959 ## for testing Parsoid's serializer, marking this Parsoid only
21960 !!test
21961 Empty TR followed by mixed-ws-comment line should RT correctly
21962 !!options
21963 parsoid
21964 !! wikitext
21965 {|
21966 |-
21967 <!--c-->
21968 |-
21969 <!--c--> <!--d-->
21970 |}
21971 !! html
21972 <table>
21973 <tbody>
21974 <tr></tr>
21975 <!--c-->
21976 <tr>
21977 <!--c--> </tr><!--d-->
21978 </tbody></table>
21979
21980 !!end
21981
21982 !!test
21983 Multi-line image caption generated by templates with/without trailing newlines
21984 !! wikitext
21985 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
21986 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
21987 !! html/parsoid
21988 <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" 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>
21989 <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" 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>
21990 !!end
21991
21992 !! test
21993 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
21994 !! options
21995 parsoid=html2wt
21996 !! html
21997 <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>
21998
21999 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
22000 !! wikitext
22001 <includeonly>foo</includeonly>
22002 new para
22003
22004 [[./Category:Foo]]
22005
22006 = new heading =
22007 !! end
22008
22009 ## PHP emits broken html for this, and since this is primarily
22010 ## a Parsoid serializer test, marking this Parsoid only
22011 !!test
22012 Improperly nested inline or quotes tags with whitespace in between
22013 !!options
22014 parsoid
22015 !! wikitext
22016 <span> <s>x</span> </s>
22017 ''' ''x''' ''
22018 !! html
22019 <p><span> <s>x</s></span><s> </s>
22020 <b> <i>x</i></b><i> </i>
22021 </p>
22022 !!end
22023
22024 !!test
22025 Encapsulate protected attributes from wt
22026 !!options
22027 parsoid
22028 !! wikitext
22029 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22030 !! html
22031 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
22032 </body>
22033 !!end
22034
22035 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22036 ## Having nested or stray pre tags results in the attempt to add duplicates,
22037 ## causing an assertion fail. This test tries to prevent that situation.
22038 !!test
22039 Ensure ParagraphWrapper can deal with stray closing pre tags
22040 !!options
22041 parsoid=wt2html
22042 !! wikitext
22043 plain text</pre>
22044 !! html
22045 plain text
22046 !!end
22047
22048 !!test
22049 1. Ensure fostered text content is wrapped in element nodes
22050 !!options
22051 parsoid=wt2html
22052 !! wikitext
22053 <table>hi</table><table>ho</table>
22054 !! html
22055 <p>hi</p>
22056 <table></table>
22057 <p>ho</p>
22058 <table></table>
22059 !!end
22060
22061 !!test
22062 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22063 !!options
22064 parsoid=wt2html,wt2wt
22065 !! wikitext
22066 <table>
22067 <tr> || ||
22068 <td> a
22069 </table>
22070 !! html
22071 <p> || ||
22072 </p><table>
22073 <tbody><tr><td> a</td></tr>
22074 </tbody></table>
22075 !!end
22076
22077 !!test
22078 Encapsulation properly handles null DSR information from foster box
22079 !!options
22080 parsoid=wt2html,wt2wt
22081 !! wikitext
22082 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22083 !! html
22084 <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>
22085 !!end
22086
22087 !!test
22088 1. Encapsulate foster-parented transclusion content
22089 !!options
22090 parsoid=wt2wt,wt2html
22091 !! wikitext
22092 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22093 !! html
22094 <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>
22095 <tbody>
22096 <tr>
22097 <td>bar</td>
22098 </tr>
22099 </tbody>
22100 </table>
22101 !!end
22102
22103 !!test
22104 2. Encapsulate foster-parented transclusion content
22105 !!options
22106 parsoid=wt2wt,wt2html
22107 !! wikitext
22108 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22109 !! html
22110 <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>
22111 <table>
22112 <tbody>
22113 <tr>
22114 <td>bar</td>
22115 </tr>
22116 </tbody>
22117 </table>
22118 !!end
22119
22120 !!test
22121 3. Encapsulate foster-parented transclusion content
22122 !!options
22123 parsoid=wt2wt,wt2html
22124 !! wikitext
22125 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22126 !! html
22127 <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;]}">
22128 <p>foo</p>
22129 </div>
22130 <table>
22131 <tbody>
22132 <tr>
22133 <td>bar</td>
22134 </tr>
22135 </tbody>
22136 </table>
22137 !!end
22138
22139 !!test
22140 4. Encapsulate foster-parented transclusion content
22141 !!options
22142 parsoid=wt2wt,wt2html
22143 !! wikitext
22144 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22145 !! html
22146 <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;]}">
22147 <p>foo</p>
22148 </div>
22149 <table>
22150 <tbody>
22151 <tr>
22152 <td>bar</td>
22153 </tr>
22154 </tbody>
22155 </table>
22156 !!end
22157
22158 !!test
22159 5. Encapsulate foster-parented transclusion content
22160 !!options
22161 parsoid=wt2wt,wt2html
22162 !! wikitext
22163 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22164 !! html
22165 <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>
22166 <table>
22167 <tbody>
22168 <tr>
22169 <td>
22170 <div>
22171 <p>foo</p>
22172 </div>
22173 </td>
22174 </tr>
22175 </tbody>
22176 </table>
22177 !!end
22178
22179 !!test
22180 6. Encapsulate foster-parented transclusion content
22181 !!options
22182 parsoid=wt2wt,wt2html
22183 !! wikitext
22184 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22185 !! html
22186 <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>
22187 <table>
22188 <tbody>
22189 <tr>
22190 <td>
22191 <div>
22192 <p>foo</p>
22193 </div>
22194 </td>
22195 </tr>
22196 </tbody>
22197 </table>
22198 <p>ok</p>
22199 !!end
22200
22201 !!test
22202 7. Encapsulate foster-parented transclusion content
22203 !!options
22204 parsoid=wt2wt,wt2html
22205 !! wikitext
22206 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22207 !! html
22208 <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>
22209 <table>
22210 <tbody>
22211 <tr>
22212 <td>bar</td>
22213 </tr>
22214 </tbody>
22215 </table>
22216 !!end
22217
22218 !!test
22219 8. Encapsulate foster-parented transclusion content
22220 !!options
22221 parsoid=wt2wt,wt2html
22222 !! wikitext
22223 {{echo|a
22224 }}{|{{echo|style='color:red'}}
22225 |-
22226 |b
22227 |}
22228 !! html
22229 <p 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\n&quot;}},&quot;i&quot;:0}}]}">a</p><p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;{|&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;style&quot;:{&quot;wt&quot;:&quot;'color:red'&quot;}},&quot;i&quot;:0}},&quot;\n|-\n|b\n|}&quot;]}">{{{1}}}</p><table>
22230 <tbody>
22231 <tr>
22232 <td>b</td>
22233 </tr>
22234 </tbody>
22235 </table>
22236 !!end
22237
22238 !!test
22239 9. Encapsulate foster-parented transclusion content
22240 !!options
22241 parsoid=wt2wt,wt2html
22242 !! wikitext
22243 <table>{{echo|hi</table>hello}}
22244 !! html
22245 <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>
22246 !!end
22247
22248 !!test
22249 Table in fosterable position
22250 !!options
22251 parsoid=wt2html,wt2wt
22252 !! wikitext
22253 {{OpenTable}}
22254 <div>
22255 {|
22256 |}
22257 </div>
22258 |}
22259 !! html
22260 <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">
22261 </span>
22262 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
22263
22264 <table>
22265 </table>
22266 !!end
22267
22268 # Parsoid only for bug 64747
22269 !! test
22270 Properly encapsulate empty-content transclusions in fosterable positions
22271 !! wikitext
22272 <table>
22273 {{#if:|
22274 <td>foo</td>
22275 }}
22276 </table>
22277 !! html/parsoid
22278 <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":["","","",""]}]],"src":"&lt;table>\n{{#if:|\n&lt;td>foo&lt;/td>\n}}\n&lt;/table>"}'>
22279
22280 </table>
22281 !! end
22282
22283 !!test
22284 Support <object> element with .data attribute
22285 !!options
22286 parsoid=html2wt
22287 !! html
22288 <object data="test.swf"></object>
22289 !! wikitext
22290 <object data="test.swf"></object>
22291 !!end
22292
22293 !! test
22294 Don't block XML namespace declaration
22295 !! wikitext
22296 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
22297 !! html/php
22298 <p><span>MediaWiki</span>
22299 </p>
22300 !! html/parsoid
22301 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
22302 !! end
22303
22304 # -----------------------------------------------------------------
22305 # The following section of tests are primarily to spec requirements
22306 # around serialization of new/edited content.
22307 #
22308 # All these tests are marked Parsoid html2wt and html2html only
22309 # ----------------------------------------------------------------
22310
22311 # 'mi' is a localinterwiki prefix as well as a language
22312 !! test
22313 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
22314 !! options
22315 parsoid=html2wt
22316 !! html
22317 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
22318 !! wikitext
22319 [[Foo]]
22320 !! end
22321
22322 !! test
22323 New wiki links (href variations)
22324 !! options
22325 parsoid=html2wt
22326 !! html
22327 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22328 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
22329 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
22330 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
22331 !! wikitext
22332 [[Foo_bar]]
22333 [[Foo_bar]]
22334 [[Foo_bar]]
22335 [[Toxine bactérienne]]
22336 !! end
22337
22338 !! test
22339 New wiki links (content string variations)
22340 !! options
22341 parsoid=html2wt
22342 !! html
22343 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22344 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
22345 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
22346 !! wikitext
22347 [[Foo_bar]]
22348 [[Foo bar]]
22349 [[Foo_bar|./Foo_bar]]
22350 !! end
22351
22352 !! test
22353 New category links (href variations)
22354 !! options
22355 parsoid=html2wt
22356 !! html
22357 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
22358 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
22359 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
22360 !! wikitext
22361 [[Category:Toxine bactérienne]]
22362 [[Category:Toxine bactérienne]]
22363 [[Category:Toxine bactérienne]]
22364 !! end
22365
22366 !! test
22367 New interlanguage links (href variations)
22368 !! options
22369 parsoid=html2wt
22370 !! html
22371 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
22372 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
22373 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
22374 !! wikitext
22375 [[es:Toxine bactérienne]]
22376 [[es:Toxine_bactérienne]]
22377 [[es:Toxine_bactérienne]]
22378 !! end
22379
22380 !! test
22381 Image: Modifying size of an image (1)
22382 !! options
22383 parsoid={
22384 "modes": ["wt2wt"],
22385 "changes": [
22386 ["img[height]", "attr", "height", "22"],
22387 ["img[width]", "attr", "width", "200"]
22388 ]
22389 }
22390 !! wikitext
22391 [[Image:Foobar.jpg|230x230px]]
22392 !! wikitext/edited
22393 [[Image:Foobar.jpg|200x200px]]
22394 !!end
22395
22396 !! test
22397 Image: Modifying size of an image (2)
22398 !! options
22399 parsoid={
22400 "modes": ["wt2wt"],
22401 "changes": [
22402 ["img[height]", "attr", "height", "100"],
22403 ["img[width]", "attr", "width", "500"]
22404 ]
22405 }
22406 !! wikitext
22407 [[Image:Foobar.jpg|230x230px]]
22408 !! wikitext/edited
22409 [[Image:Foobar.jpg|500x500px]]
22410 !!end
22411
22412 # Change in size is ignored so long as class='mw-default-size'
22413 !! test
22414 Image: Modifying size of an image (3)
22415 !! options
22416 parsoid={
22417 "modes": ["wt2wt"],
22418 "changes": [
22419 ["figure[class]", "removeClass", "mw-default-size"],
22420 ["figure img", "attr", "height", "19"],
22421 ["figure img", "attr", "width", "170"]
22422 ]
22423 }
22424 !! wikitext
22425 [[Image:Foobar.jpg|thumb]]
22426 !! wikitext/edited
22427 [[Image:Foobar.jpg|thumb|170x170px]]
22428 !!end
22429
22430 !! test
22431 Image: Modifying alignment of an image (bug 48665)
22432 !! options
22433 parsoid={
22434 "modes": ["wt2wt"],
22435 "changes": [
22436 ["figure[class]", "removeClass", "mw-halign-right"],
22437 ["figure[class]", "addClass", "mw-halign-left"]
22438 ]
22439 }
22440 !! wikitext
22441 [[Image:Foobar.jpg|thumb|caption|right]]
22442 !! wikitext/edited
22443 [[Image:Foobar.jpg|thumb|caption|left]]
22444 !! end
22445
22446 !! test
22447 Image: Modifying mw-default-size of an frameless image (bug 62805)
22448 !! options
22449 parsoid={
22450 "modes": ["wt2wt"],
22451 "changes": [
22452 ["figure.mw-default-size", "removeClass", "mw-default-size"]
22453 ]
22454 }
22455 !! wikitext
22456 [[Image:Foobar.jpg|frameless|right]]
22457 !! wikitext/edited
22458 [[Image:Foobar.jpg|frameless|right|220x220px]]
22459 !! end
22460
22461 !! test
22462 Image: Modifying valign of an image (bug 49221)
22463 !! options
22464 parsoid={
22465 "modes": ["wt2wt"],
22466 "changes": [
22467 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
22468 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
22469 ]
22470 }
22471 !! wikitext
22472 [[File:Foobar.jpg|20px|middle]]
22473 !! wikitext/edited
22474 [[File:Foobar.jpg|20px|text-top]]
22475 !! end
22476
22477 !! test
22478 Image: Modifying alt attribute of an image (bug 56400)
22479 !! options
22480 parsoid={
22481 "modes": ["wt2wt"],
22482 "changes": [
22483 ["img[alt]", "attr", "alt", "some alternate edited text"]
22484 ]
22485 }
22486 !! wikitext
22487 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
22488 !! wikitext/edited
22489 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
22490 !!end
22491
22492 !! test
22493 Image: Modifying caption of an image
22494 !! options
22495 parsoid={
22496 "modes": ["wt2wt"],
22497 "changes": [
22498 ["figcaption", "text", "new caption"]
22499 ]
22500 }
22501 !! wikitext
22502 [[Image:Foobar.jpg|thumb|original caption]]
22503 !! wikitext/edited
22504 [[Image:Foobar.jpg|thumb|new caption]]
22505 !!end
22506
22507 !! test
22508 Image: empty alt attribute (bug 48924)
22509 !! options
22510 parsoid
22511 !! wikitext
22512 [[File:Foobar.jpg|thumb|alt=|bar]]
22513 !! html
22514 <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" 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>
22515 !! end
22516
22517 #!! test
22518 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
22519 #!! options
22520 #parsoid=html2wt
22521 #language=ar
22522 #!! html
22523 #<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" height="20" width="180"/></a></figure>
22524 #!! wikitext
22525 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
22526 #!! end
22527
22528 !! test
22529 Image: Block level image should have \n before and after
22530 !! wikitext
22531 123
22532 [[File:Foobar.jpg|right|thumb|150x150px]]
22533 456
22534 !! html/parsoid
22535 <p>123</p>
22536 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="17" width="150"/></a></figure>
22537 <p>456</p>
22538 !!end
22539
22540 !! test
22541 Image: New block level image should have \n before and after (existing content)
22542 !! wikitext
22543 123
22544 [[File:Foobar.jpg|right|thumb|150x150px]]
22545 456
22546 !! html/parsoid
22547 <p>123</p>
22548 <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" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
22549 <p>456</p>
22550 !!end
22551
22552 !! test
22553 Image: upright option (parsoid)
22554 !! options
22555 parsoid
22556 !! wikitext
22557 [[File:Foobar.jpg|thumb|upright|caption]]
22558 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22559 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22560 !! html
22561 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="19" width="170"/></a><figcaption>caption</figcaption></figure>
22562 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
22563 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
22564 !!end
22565
22566 !! test
22567 Image: upright option is ignored on inline and frame images (parsoid)
22568 !! options
22569 parsoid
22570 !! wikitext
22571 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22572 !! html
22573 <p><span 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" height="57" width="500"/></a></span></p>
22574 !!end
22575
22576 !! test
22577 Image: from basic HTML (1)
22578 !! options
22579 parsoid=html2wt
22580 !! html/parsoid
22581 <span typeof="mw:Image">
22582 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22583 </span>
22584 !! wikitext
22585 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22586 !! end
22587
22588 !! test
22589 Image: from basic HTML (2)
22590 !! options
22591 parsoid=html2wt
22592 !! html/parsoid
22593 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22594 !! wikitext
22595 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22596 !! end
22597
22598 !! test
22599 Image: from basic HTML (3)
22600 !! options
22601 parsoid=html2wt
22602 !! html/parsoid
22603 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22604 !! wikitext
22605 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22606 !! end
22607
22608 !! test
22609 Image: from basic HTML (4)
22610 !! options
22611 parsoid=html2wt
22612 !! html/parsoid
22613 <img src="File:Foobar.jpg">
22614 !! wikitext
22615 [[File:Foobar.jpg|link=]]
22616 !! end
22617
22618 !! test
22619 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22620 !! options
22621 parsoid=html2wt
22622 !! html
22623 <ul>
22624 <li><p>foo</p></li>
22625 </ul>
22626 !! wikitext
22627 * foo
22628 !! end
22629
22630 !! test
22631 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22632 !! options
22633 parsoid=html2wt
22634 !! html
22635 <ul> <li>foo</li></ul>
22636 !! wikitext
22637 * foo
22638 !! end
22639
22640 !! test
22641 Don't strip leading whitespace when handling indent-pre suppressing tags
22642 !! options
22643 parsoid=html2wt
22644 !! html
22645 <table>
22646 <tr><td> indented row</td></tr>
22647 </table>
22648 <blockquote><p>
22649 <b>This is very bold of you!</b>
22650 </p>
22651 <table><tr><td>
22652 indented cell (no pre-wrapping!)
22653 </td></tr></table>
22654 </blockquote>
22655 <p>foo</p>
22656 <div>bar</div>
22657 !! wikitext
22658 {|
22659 | indented row
22660 |}
22661 <blockquote>
22662 '''This is very bold of you!'''
22663
22664 {|
22665 |
22666 indented cell (no pre-wrapping!)
22667 |}
22668 </blockquote>
22669 foo
22670 <div>bar</div>
22671 !! end
22672
22673 !! test
22674 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22675 !! options
22676 parsoid=html2wt
22677 !! wikitext
22678 foo
22679 <nowiki> </nowiki><span>bar</span>
22680
22681 <span>foo2
22682 <nowiki> </nowiki></span>bar2
22683
22684 <div>foo</div>
22685 <nowiki> </nowiki><span>bar</span>
22686
22687 <div>
22688 <nowiki> </nowiki><span>foo</span>
22689 </div>
22690 !! html
22691 <p>foo</p>
22692 <span>bar</span>
22693
22694 <span>foo2
22695 </span>bar2
22696
22697 <div>foo</div>
22698 <span>bar</span>
22699
22700 <div>
22701 <span>foo</span>
22702 </div>
22703 !! end
22704
22705 !! test
22706 Lists: Add space after bullets
22707 !! options
22708 parsoid=html2wt
22709 !! html
22710 <ul>
22711 <li>foo</li>
22712 <li> bar</li>
22713 <li><span> baz</span></li>
22714 </ul>
22715 !! wikitext
22716 * foo
22717 * bar
22718 * <span> baz</span>
22719 !! end
22720
22721 !! test
22722 Lists: Dont insert newlines in a serialized list item.
22723 !! options
22724 parsoid=html2wt
22725 !! html
22726 <ul><li>a<br>b</li><li>c</li></ul>
22727 !! wikitext
22728 * a<br>b
22729 * c
22730 !! end
22731
22732 !! test
22733 Headings: Add space before/after == (Bug 51744)
22734 !! options
22735 parsoid=html2wt
22736 !! html
22737 <h2>foo</h2>
22738 <h2> bar</h2>
22739 <h2>baz </h2>
22740 <h2><span> baz</span></h2>
22741 !! wikitext
22742 == foo ==
22743
22744 == bar ==
22745
22746 == baz ==
22747
22748 == <span> baz</span> ==
22749 !! end
22750
22751 !! test
22752 Parsoid: Serialize positional parameters with = in them as named parameter
22753 !! options
22754 parsoid=html2wt
22755 !! html
22756 <p about="#mwt1" typeof="mw:Transclusion"
22757 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
22758
22759 <p about="#mwt1" typeof="mw:Transclusion"
22760 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
22761
22762 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22763 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22764 <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>
22765 !! wikitext
22766 {{echo|1 = f=oo}}
22767
22768 {{echo|1 = f=oo|2 = bar}}
22769
22770 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22771 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22772 {{echo|<nowiki>f=oo</nowiki>|bar}}
22773 !! end
22774
22775 !! test
22776 Parsoid: Serialize positional parameters with = in extlink as named parameter
22777 !! options
22778 parsoid=html2wt
22779 !! html
22780 <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>
22781 !! wikitext
22782 {{echo|1 = http://stuff?is=ok}}
22783 !! end
22784
22785 !! test
22786 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
22787 !! options
22788 parsoid=html2wt
22789 !! html
22790 <div>a<p>b</p></div>
22791 <div>a
22792 <p>b</p></div>
22793 <div>
22794 a
22795 <p>b</p></div>
22796 !! wikitext
22797 <div>a
22798 b
22799 </div>
22800 <div>a
22801 b
22802 </div>
22803 <div>
22804 a
22805
22806 b
22807 </div>
22808 !! end
22809
22810 !! test
22811 Substrings resembling wikitext in hrefs should not get nowiki escapes
22812 !! options
22813 parsoid=html2wt
22814 !! html
22815 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
22816 !! wikitext
22817 [[Foo''bar''baz]]
22818 !! end
22819
22820 #-----------------------------
22821 # I/B quote minimization tests
22822 #-----------------------------
22823
22824 !! test
22825 1. I/B quote minimization: wikitext-only tags should be combined
22826 !! options
22827 parsoid=html2wt
22828 !! html
22829 <p><i>A</i><i>B</i></p>
22830 <p><b>A</b><b>B</b></p>
22831 <p><i>A</i><b><i>B</i></b></p>
22832 <p><b>A</b><i><b>B</b></i></p>
22833 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22834 <p><i><b>A</b></i><i><b>B</b></i></p>
22835 <p><i><b>A</b></i><b><i>B</i></b></p>
22836 <p><b><i>A</i></b><i><b>B</b></i></p>
22837 !! wikitext
22838 ''AB''
22839
22840 '''AB'''
22841
22842 ''A'''B'''''
22843
22844 '''A''B'''''
22845
22846 '''A''BC''D'''
22847
22848 '''''AB'''''
22849
22850 '''''AB'''''
22851
22852 '''''AB'''''
22853 !! end
22854
22855 !! test
22856 2. I/B quote minimization: wikitext and html tags should not be combined
22857 !! options
22858 parsoid=html2wt
22859 !! html
22860 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22861 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22862 !! wikitext
22863 ''A''<i>B</i>
22864
22865 ''A''<nowiki/>'''<i>B</i>'''
22866 !! end
22867
22868 !! test
22869 3. I/B quote minimization: templated content stops minimization
22870 !! options
22871 parsoid=html2wt
22872 !! html
22873 <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>
22874 <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>
22875 !! wikitext
22876 ''A''{{echo|''B''}}
22877
22878 ''A''{{echo|'''''B'''''}}
22879 !! end
22880
22881 !! test
22882 4. I/B quote minimization: new content should be mimimized with adjacent old content
22883 !! options
22884 parsoid=html2wt
22885 !! html
22886 <p><i>A</i><i>B</i></p>
22887 <p><b>A</b><b>B</b></p>
22888 <p><i>A</i><b><i>B</i></b></p>
22889 !! wikitext
22890 ''AB''
22891
22892 '''AB'''
22893
22894 ''A'''B'''''
22895 !! end
22896
22897 !! test
22898 5a. Merge adjacent quote nodes if they've been edited
22899 !! options
22900 parsoid={
22901 "modes": ["wt2wt"],
22902 "changes": [
22903 ["p", "contents", "remove", ":contains('b')"]
22904 ]
22905 }
22906 !! wikitext
22907 ''a''b''c''
22908 !! wikitext/edited
22909 ''ac''
22910 !! end
22911
22912 !! test
22913 5b. Merge adjacent quote nodes if they've been edited
22914 !! options
22915 parsoid={
22916 "modes": ["wt2wt"],
22917 "changes": [
22918 ["#x", "remove"]
22919 ]
22920 }
22921 !! wikitext
22922 ''a''<span id="x">b</span>''c''
22923 !! wikitext/edited
22924 ''ac''
22925 !! end
22926
22927 #------------------------------------
22928 # End of I/B quote minimization tests
22929 #------------------------------------
22930
22931 !!test
22932 Bug 54262: New entities
22933 !! options
22934 parsoid=html2wt
22935 !! wikitext
22936 &nbsp;
22937 !! html
22938 <span typeof="mw:Entity">&nbsp;</span>
22939 !! end
22940
22941 ## Note that there is no wikitext output for 'unknownproperty' ##
22942 ## Unknown magic words are silently dropped ##
22943
22944 !! test
22945 Magic words
22946 !! options
22947 parsoid=html2wt
22948 !! html
22949 <meta property='mw:PageProp/toc' />
22950 <meta property='mw:PageProp/notoc' />
22951 <meta property='mw:PageProp/forcetoc' />
22952 <meta property='mw:PageProp/index' />
22953 <meta property='mw:PageProp/noindex' />
22954 <meta property='mw:PageProp/nogallery' />
22955 <meta property='mw:PageProp/noeditsection' />
22956 <meta property='mw:PageProp/notitleconvert' />
22957 <meta property='mw:PageProp/nocontentconvert' />
22958 <meta property='mw:PageProp/unknownproperty' />
22959 !! wikitext
22960 __TOC__
22961 __NOTOC__
22962 __FORCETOC__
22963 __INDEX__
22964 __NOINDEX__
22965 __NOGALLERY__
22966 __NOEDITSECTION__
22967 __NOTITLECONVERT__
22968 __NOCONTENTCONVERT__
22969 !! end
22970
22971 !! test
22972 Consecutive <pre>s should not get merged
22973 !! options
22974 parsoid=html2wt,html2html
22975 !! html
22976 <pre>a</pre><pre>b</pre>
22977
22978 <pre>c
22979 </pre><pre>
22980 d</pre>
22981
22982 <pre>e
22983
22984 </pre><pre>
22985
22986 f</pre>
22987 !! wikitext
22988 a
22989
22990 b
22991
22992 c
22993
22994 d
22995
22996 e
22997
22998
22999
23000 f
23001 !! end
23002
23003 !! test
23004 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23005 !! options
23006 parsoid=html2wt
23007 !! html
23008 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23009 !! wikitext
23010 [[Special:BookSources/1234567890|ISBN 1234567895]]
23011 !! end
23012
23013 !! test
23014 Edited RFC links not serializable as RFC links should serialize as extlinks
23015 !! options
23016 parsoid=html2wt
23017 !! html
23018 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23019 !! wikitext
23020 [//tools.ietf.org/html/rfc123 New RFC]
23021 !! end
23022
23023 !! test
23024 Edited PMID links not serializable as PMID links should serialize as extlinks
23025 !! options
23026 parsoid=html2wt
23027 !! html
23028 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23029 !! wikitext
23030 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23031 !! end
23032
23033 !! test
23034 WTS of autolinks with trailing/surrounding context
23035 !! options
23036 parsoid=html2wt
23037 !! html/parsoid
23038 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23039 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23040 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23041 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23042 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23043 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23044 !! wikitext
23045 http://cscott.net<nowiki/>'''foo'''
23046
23047 http://cscott.net<b>foo</b>
23048
23049 '''http://cscott.net<nowiki/>'''
23050
23051 '''http://cscott.net '''
23052
23053 '''http://cscott.net<nowiki/>x'''
23054
23055 http://cscott.net<nowiki/>x
23056 !! end
23057
23058 !! test
23059 WTS of autolinks with nowikis (round-trip)
23060 !! wikitext
23061 x<nowiki/>http://cscott.net<nowiki/>x
23062 !! html/parsoid
23063 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23064 !! end
23065
23066 # this is the "easy" test because it leaves in place all the
23067 # data-parsoid information indicating this is an autolink
23068 !! test
23069 WTS of autolinks with escapes (editing)
23070 !! options
23071 parsoid={
23072 "modes": ["wt2wt"],
23073 "changes": [
23074 [ "meta", "remove" ]
23075 ]
23076 }
23077 !! wikitext
23078 x<nowiki/>http://cscott.net<nowiki/>x
23079 !! wikitext/edited
23080 x<nowiki/>http://cscott.net<nowiki/>x
23081 !! end
23082
23083 !! test
23084 Edited Redirect link should emit a non-piped wikitext link
23085 !! options
23086 parsoid=html2wt
23087 !! html
23088 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23089 !! wikitext
23090 #REDIRECT [[Bar]]
23091 !! end
23092
23093 !! test
23094 T75121: Infer extension name from typeOf if data-mw is not present
23095 !! options
23096 parsoid=html2wt
23097 !! html
23098 <div typeOf="mw:Extension/foo"></div>
23099 !! wikitext
23100 <foo />
23101 !! end
23102
23103 # -----------------------------------------------------------------
23104 # End of section for Parsoid-only html2wt tests for serialization
23105 # of new content
23106 # -----------------------------------------------------------------
23107
23108 TODO:
23109 more images
23110 more tables
23111 character entities
23112 and much more
23113 Try for 100% code coverage