Debian Codegraph @

tests/parser/parserTests.txt

raw
1 # The parsoid-compatible option below is only relevant when we are running
2 # parser tests in integrated mode with Parsoid. This option is ignored
3 # when this test file is run with Parsoid in standalone mode.
4 !! options
5 parsoid-compatible=wt2html,wt2wt
6 version=2
7 !! end
8
9 # MediaWiki Parser test cases
10 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
11 # All (C) their respective authors and released under the GPL
12 #
13 # The syntax should be fairly self-explanatory.
14 #
15 # Currently supported test options:
16 # One of the following modes:
17 #
18 # (default) generate HTML output
19 # pst apply pre-save transform
20 # msg apply message transform
21 # comment run through MediaWiki\CommentFormatter\CommentFormatter::format() instead of main parser
22 #
23 # Options for adding metadata to the metadata section:
24 # (Previously, these options pre- or post- pended to the html section)
25 #
26 # cat add category links
27 # extlinks add external link metadata
28 # ill add inter-language links
29 # iwl add inter-wiki links
30 # links add local wiki links
31 # special add links to special pages
32 # templates add template information
33 # property=XXX add the value of the page property with the given name.
34 # This can also be a comma-separated list.
35 # extension=XXX add the JSON-encoded value of the given extension data.
36 # This can also be a comma-separated list.
37 # showtitle add the rendered title
38 # showflags add the set parser output flags
39 # showtocdata add table of contents data
40 # showindicators add the page status indicators
41 # showmedia add the titles of the rendered media
42 #
43 # Parser parameters:
44 #
45 # subpage enable subpages (disabled by default)
46 # title=[[XXX]] run test using article title XXX
47 # language=XXX set content language to XXX for this test
48 # wtVariantLanguage=XXX set the wikitext (input) variant of language for this
49 # test using a BCP-47 code (eg zh-Hant-TW)
50 # htmlVariantLanguage=XXX set the html (output) variant of language for this
51 # test using a BCP-47 code (eg zh-Hant-TW)
52 # userLanguage=XXX set user language to XXX for this test
53 # notoc disable table of contents
54 # thumbsize=NNN set the default thumb size to NNNpx for this test
55 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
56 # local format section links in edit comment text as local links
57 #
58 # Configuration globals:
59 #
60 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
61 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
62 # wgEnableMagicLinks, wgLocaltimezone
63 #
64 # Test execution options:
65 #
66 # disabled do not run test
67 # parsoid parsoid-specific options (not run by PHP parser unless
68 # the test includes an html/php section)
69 # php php-only test (not run by the parsoid parser unless
70 # the test includes an html/parsoid section)
71 #
72 # For testing purposes, temporary articles can created:
73 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
74 # where '/' denotes a newline.
75
76 # This is the standard article assumed to exist.
77 !! article
78 Main Page
79 !! text
80 blah blah
81 !! endarticle
82
83 !!article
84 Foo
85 !!text
86 FOO
87 !!endarticle
88
89 !!article
90 Foo''s bar''s
91 !!text
92 Article titles can contain single quotes!
93 !!endarticle
94
95 !!article
96 Template:Foo
97 !!text
98 FOO
99 !!endarticle
100
101 !! article
102 Template:redirect to foo
103 !! text
104 #REDIRECT [[Template:Foo]]
105 !! endarticle
106
107 !! article
108 Template:Blank
109 !! text
110 !! endarticle
111
112 !! article
113 Template:pipe
114 !! text
115 |
116 !! endarticle
117
118 !! article
119 Template:=
120 !! text
121 <nowiki>=</nowiki>
122 !! endarticle
123
124 !! article
125 Template:inner list
126 !! text
127 * item 1
128 !! endarticle
129
130 !! article
131 Template:tbl-start
132 !! text
133 {|
134 !! endarticle
135
136 !! article
137 Template:tbl-end
138 !! text
139 |}
140 !! endarticle
141
142 !! article
143 Template:table_attribs_3
144 !! text
145 <noinclude>
146 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
147 !! endarticle
148
149 !! article
150 Template:table_attribs_6
151 !! text
152 style="background: <nowiki>
153
154
155 red;</nowiki>" |
156 !! endarticle
157
158 !! article
159 Template:1x
160 !! text
161 {{{1}}}
162 !! endarticle
163
164 # For is; localize Template namespace
165 !! article
166 Snið:1x
167 !! text
168 {{{1}}}
169 !! endarticle
170
171 !! article
172 Template:3x_on_newline
173 !! text
174 {{{1}}}
175 {{{1}}}
176 {{{1}}}
177 !! endarticle
178
179 !! article
180 Template:1x_with_span
181 !! text
182 <span>{{{1}}}</span>
183 !! endarticle
184
185 !! article
186 Template:1x_with_div
187 !! text
188 <div>{{{1}}}</div>
189 !! endarticle
190
191 !! article
192 Template:1x with depth
193 !! text
194 {{1x|{{{1}}}}}
195 !! endarticle
196
197 !! article
198 Template:blank_param
199 !! text
200 {{{1}}}
201 {{{}}}
202 !! endarticle
203
204 ## See T48811 for details
205 !! article
206 Template:mixed_attr_content_template
207 !! text
208 style="color:red;" title="T48811"
209 |-
210 |foo
211 !! endarticle
212
213 ## This template has a category in fosterable position. See T249740 for details
214 !! article
215 Template:mixed_attr_content_template_2
216 !! text
217 style="color:red;" title="T249740"
218 |-
219 [[Category:Fostered Content]]
220 |foo
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 *Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 !! article
275 Template:With: Colon
276 !! text
277 Template with colon
278 !! endarticle
279
280 !! article
281 Template:Template with pagename
282 !! text
283 This is {{PAGENAME}}.
284 !! endarticle
285
286 !! article
287 File:Redirect to foobar.jpg
288 !! text
289 #REDIRECT[[File:Foobar.jpg]]
290 !! endarticle
291
292 # Use an entity in the name
293 !! article
294 Template:Foo–bar
295 !! text
296 foo
297 !! endarticle
298
299 ###
300 ### Basic tests
301 ###
302
303 !! test
304 Blank input
305 !! wikitext
306 !! html
307 !! end
308
309 !! test
310 Simple paragraph
311 !! wikitext
312 This is a simple paragraph.
313 !! html
314 <p>This is a simple paragraph.
315 </p>
316 !! end
317
318 !! test
319 Paragraphs with extra newline spacing
320 !! wikitext
321 a
322
323 b (+2 nls)
324
325
326 c (+3 nls)
327
328
329
330 d (+4 nls)
331
332
333
334
335 e (+5 nls)
336 !! html
337 <p>a
338 </p><p>b (+2 nls)
339 </p><p><br />
340 c (+3 nls)
341 </p><p><br />
342 </p><p>d (+4 nls)
343 </p><p><br />
344 </p><p><br />
345 e (+5 nls)
346 </p>
347 !! end
348
349 !! test
350 Paragraphs with newline spacing with comment lines in between
351 !! wikitext
352 ----
353 a
354 <!--foo-->
355 b
356 ----
357 a
358 <!--foo--><!--More than 1 comment, still stripped-->
359 b
360 ----
361 a
362 <!--foo--> <!----> <!-- bar -->
363 b
364 ----
365 a
366 <!--foo-->
367
368 b
369 ----
370 a
371
372 <!--foo-->
373 b
374 ----
375 a
376 <!--foo-->
377
378
379 b
380 ----
381 a
382
383
384 <!--foo-->
385 b
386 ----
387 !! html
388 <hr />
389 <p>a
390 b
391 </p>
392 <hr />
393 <p>a
394 b
395 </p>
396 <hr />
397 <p>a
398 b
399 </p>
400 <hr />
401 <p>a
402 </p><p>b
403 </p>
404 <hr />
405 <p>a
406 </p><p>b
407 </p>
408 <hr />
409 <p>a
410 </p><p><br />
411 b
412 </p>
413 <hr />
414 <p>a
415 </p><p><br />
416 b
417 </p>
418 <hr />
419 !! end
420
421 !! test
422 Paragraphs with newline spacing with non-empty white-space lines in between
423 !! wikitext
424 ----
425 a
426
427 b
428 ----
429 a
430
431
432 b
433 ----
434 !! html
435 <hr />
436 <p>a
437 </p><p>b
438 </p>
439 <hr />
440 <p>a
441 </p><p><br />
442 b
443 </p>
444 <hr />
445 !! end
446
447 !! test
448 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
449 !! wikitext
450 ----
451 a
452 <!--foo-->
453 b
454 ----
455 a
456 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
457 b
458 ----
459 a
460
461 <!--foo-->
462 <!--bar-->
463 b
464 ----
465 a
466
467 <!--foo-->
468 <!--bar-->
469
470 b
471 ----
472 !! html
473 <hr />
474 <p>a
475 b
476 </p>
477 <hr />
478 <p>a
479 b
480 </p>
481 <hr />
482 <p>a
483 </p><p>b
484 </p>
485 <hr />
486 <p>a
487 </p><p><br />
488 b
489 </p>
490 <hr />
491 !! end
492
493 !! test
494 Extra newlines: More paragraphs with indented comment
495 !! wikitext
496 a
497
498 <!--boo-->
499
500 b
501 !! html
502 <p>a
503 </p><p><br />
504 b
505 </p>
506 !!end
507
508 !! test
509 Extra new lines before and after lists are preserved
510 !! wikitext
511 a
512
513
514 *b
515
516
517 c
518 !! html/php
519 <p>a
520 </p><p><br />
521 </p>
522 <ul><li>b</li></ul>
523 <p><br />
524 c
525 </p>
526 !! html/parsoid
527 <p>a</p>
528 <p>
529 <br></p>
530 <ul><li>b</li></ul>
531 <p>
532 <br>
533 c</p>
534 !! end
535
536 # Parsoid regression test
537 !!test
538 Multiple newlines after tables are converted to p-br-p tags
539 !!options
540 parsoid=wt2html,wt2wt
541 !! config
542 wgParserEnableLegacyHeadingDOM=false
543 !!wikitext
544 {|
545 |x
546 |}
547
548
549
550
551 =b=
552 !!html/php
553 <table>
554 <tbody><tr>
555 <td>x
556 </td></tr></tbody></table>
557 <p><br />
558 </p><p><br />
559 </p>
560 <div class="mw-heading mw-heading1"><h1 id="b">b</h1><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></div>
561 !!html/parsoid
562 <table>
563 <tbody>
564 <tr>
565 <td>x</td>
566 </tr>
567 </tbody>
568 </table>
569 <p><br/></p>
570 <p><br/></p>
571 <h1 id="b">b</h1>
572 !!end
573
574 !! test
575 Parsing an URL
576 !! wikitext
577 http://fr.wikipedia.org/wiki/🍺
578 <!-- EasterEgg we love beer, better be able be able to link to it -->
579 !! html
580 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
581 </p>
582 !! end
583
584 !! test
585 Simple list
586 !! wikitext
587 *Item 1
588 *Item 2
589 !! html
590 <ul><li>Item 1</li>
591 <li>Item 2</li></ul>
592 !! end
593
594
595 ###
596 ### Non-html5 tags
597 ###
598
599 ## The attribute on the font tag is so Parsoid won't normalize it away
600 !! test
601 Non-html5 tags should be accepted
602 !! wikitext
603 <center>''foo''</center>
604 <big>''foo''</big>
605 <font style="123">''foo''</font>
606 <strike>''foo''</strike>
607 <tt>''foo''</tt>
608 !! html
609 <center><i>foo</i></center>
610 <p><big><i>foo</i></big>
611 <font style="123"><i>foo</i></font>
612 <strike><i>foo</i></strike>
613 <tt><i>foo</i></tt>
614 </p>
615 !! end
616
617 !! test
618 <wbr> is valid wikitext (T54468)
619 !! wikitext
620 <wbr>
621 !! html
622 <p><wbr />
623 </p>
624 !! end
625
626 # <strike> is HTML4, <s> is HTML4/5.
627 !! test
628 <s> or <strike> for strikethrough
629 !! wikitext
630 <strike>strike</strike>
631
632 <s>s</s>
633 !! html
634 <p><strike>strike</strike>
635 </p><p><s>s</s>
636 </p>
637 !! end
638
639 ## a not permitted
640 ## i,b,br omitted
641 !! test
642 Text-level semantic html elements in wikitext
643 !! wikitext
644 <em>text</em>
645 <strong>text</strong>
646 <small>text</small>
647 <s>text</s>
648 <cite>text</cite>
649 <q>text</q>
650 <dfn>text</dfn>
651 <abbr>text</abbr>
652 <data>text</data>
653 <time>text</time>
654 <code>text</code>
655 <var>text</var>
656 <samp>text</samp>
657 <kbd>text</kbd>
658 <sub>text</sub>
659 <u>text</u>
660 <mark>text</mark>
661 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
662 <bdi>text</bdi>
663 <bdo>text</bdo>
664 <span>text</span>
665 <wbr />
666 !! html
667 <p><em>text</em>
668 <strong>text</strong>
669 <small>text</small>
670 <s>text</s>
671 <cite>text</cite>
672 <q>text</q>
673 <dfn>text</dfn>
674 <abbr>text</abbr>
675 <data>text</data>
676 <time>text</time>
677 <code>text</code>
678 <var>text</var>
679 <samp>text</samp>
680 <kbd>text</kbd>
681 <sub>text</sub>
682 <u>text</u>
683 <mark>text</mark>
684 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
685 <bdi>text</bdi>
686 <bdo>text</bdo>
687 <span>text</span>
688 <wbr />
689 </p>
690 !! end
691
692 # test cases taken from
693 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
694 !! test
695 Ruby markup (W3C-style)
696 !! wikitext
697 ;Mono-ruby for individual base characters
698 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
699 ;Group ruby
700 :<ruby>今日<rt>きょう</rt></ruby>
701 ;Jukugo ruby
702 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
703 ;Inline ruby
704 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
705 ;Double-sided ruby
706 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
707
708 <ruby>
709 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
710 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
711 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
712 </ruby>
713 !! html
714 <dl><dt>Mono-ruby for individual base characters</dt>
715 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
716 <dt>Group ruby</dt>
717 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
718 <dt>Jukugo ruby</dt>
719 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
720 <dt>Inline ruby</dt>
721 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
722 <dt>Double-sided ruby</dt>
723 <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>
724 <p><ruby>
725 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
726 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
727 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
728 </ruby>
729 </p>
730 !! end
731
732 # The next two test different paths in the sanitizer.
733 !! test
734 Non-word characters don't terminate tag names (T19663, T42670, T54022)
735 !! wikitext
736 <blockquote|>a</blockquote>
737
738 <b→> doesn't terminate </b→>
739
740 <bä> doesn't terminate </bä>
741
742 <boo> doesn't terminate </boo>
743
744 <s.foo> doesn't terminate </s.foo>
745
746 <sub-ID#1>
747 !! html
748 <p>&lt;blockquote|&gt;a
749 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
750 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
751 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
752 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
753 </p><p>&lt;sub-ID#1&gt;
754 </p>
755 !! end
756
757 ###
758 ### See tests/parser/ParserTestParserHook.php for the <tåg> extension)
759 ### This checks that HTML5 tags (with non-word characters in the tag
760 ### name) make it safely through the parser -- the Sanitizer will
761 ### munge them later, as it should.
762 ###
763 !! test
764 Non-word characters are valid in extension tags (T19663)
765 !! wikitext
766 <tåg>tåg</tåg>
767 !! html/php
768 <pre>'tåg'
769 array (
770 )
771 </pre>
772 !! html/parsoid
773 <pre typeof="mw:Extension/tåg" about="#mwt3" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}'>'tåg'
774 array (
775 )
776 </pre>
777 !! end
778
779 !! test
780 Isolated close tags should be treated as literal text (T54760)
781 !! options
782 parsoid=wt2html
783 !! wikitext
784 </b>
785
786 <s.foo>s</s>
787 !! html
788 <p class="mw-empty-elt">
789 </p><p>&lt;s.foo&gt;s
790 </p>
791 !! end
792
793 !! test
794 Self-closed tag hooks
795 !! wikitext
796 <pre />
797 <gallery />
798 <indicator name="something" />
799 !! html/php
800 <pre></pre>
801 <ul class="gallery mw-gallery-traditional">
802 </ul>
803 !! html/parsoid
804 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{}}'></pre>
805 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{}}'>
806 </ul>
807 <meta typeof="mw:Extension/indicator" about="#mwt6" data-mw='{"name":"indicator","attrs":{"name":"something"},"html":""}'/>
808 !! end
809
810 ###
811 ### Special characters
812 ###
813
814 !! test
815 Bare pipe character (T54363)
816 !! wikitext
817 |
818 !! html
819 <p>|
820 </p>
821 !! end
822
823 !! test
824 Bare pipe character from a template (T54363)
825 !! wikitext
826 {{pipe}}
827 !! html
828 <p>|
829 </p>
830 !! end
831
832 !! test
833 Implicit newline insertion/sol when expanding templates (T241150/T14974/T2529)
834 !! wikitext
835 {{1x|#foo}}{{1x|#foo}}
836 !! html/php
837 <ol><li>foo</li>
838 <li>foo</li></ol>
839 !! html/parsoid
840 <ol about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}],[{"k":"1"}]],"dsr":[0,22,null,null]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"#foo"}},"i":0}},{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"#foo"}},"i":1}}]}'><li>foo</li>
841 <li>foo</li></ol>
842 !! end
843
844 ###
845 ### <nowiki> test cases
846 ###
847
848 !! test
849 <nowiki> unordered list
850 !! wikitext
851 <nowiki>* This is not an unordered list item.</nowiki>
852 !! html/php
853 <p>* This is not an unordered list item.
854 </p>
855 !! html/parsoid
856 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
857 !! end
858
859 !! test
860 <nowiki> spacing
861 !! wikitext
862 <nowiki>Lorem ipsum dolor
863
864 sed abit.
865 sed nullum.
866
867 :and a colon
868 </nowiki>
869 !! html/php
870 <p>Lorem ipsum dolor
871
872 sed abit.
873 sed nullum.
874
875 :and a colon
876
877 </p>
878 !! html/parsoid
879 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
880
881 sed abit.
882 sed nullum.
883
884 :and a colon
885 </span></p>
886 !! end
887
888 !! test
889 Don't parse <nowiki><span class="error"></nowiki> (T149622)
890 !! wikitext
891 <nowiki><span class="error"></nowiki>
892 !! html/php
893 <p>&lt;span class="error"&gt;
894 </p>
895 !! html/parsoid
896 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
897 !! end
898
899 !! test
900 nowiki 3
901 !! wikitext
902 :There is not nowiki.
903 :There is <nowiki>nowiki</nowiki>.
904
905 #There is not nowiki.
906 #There is <nowiki>nowiki</nowiki>.
907
908 *There is not nowiki.
909 *There is <nowiki>nowiki</nowiki>.
910 !! html/php
911 <dl><dd>There is not nowiki.</dd>
912 <dd>There is nowiki.</dd></dl>
913 <ol><li>There is not nowiki.</li>
914 <li>There is nowiki.</li></ol>
915 <ul><li>There is not nowiki.</li>
916 <li>There is nowiki.</li></ul>
917 !! html/parsoid
918 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
919 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
920
921 <ol><li data-parsoid='{}'>There is not nowiki.</li>
922 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
923
924 <ul><li data-parsoid='{}'>There is not nowiki.</li>
925 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
926 !! end
927
928 !! test
929 Entities inside <nowiki>
930 !! wikitext
931 <nowiki>&lt;</nowiki>
932 !! html/php
933 <p>&lt;
934 </p>
935 !! html/parsoid
936 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
937 !! end
938
939 !! test
940 Entities inside template parameters
941 !! wikitext
942 {{1x|&ndash;}}
943 !! html/php
944 <p>&#8211;
945 </p>
946 !! html/parsoid
947 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
948 !! end
949
950 !! test
951 Properly escape nowiki when combined with other wiki markup
952 !! options
953 parsoid=html2wt
954 !! html/parsoid
955 <p>* &lt;/nowiki&gt; tag</p>
956 !! wikitext
957 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
958 !! end
959
960 !! test
961 T93824: Put escaped HTML tags inside nowiki
962 !! options
963 parsoid=html2wt
964 !! html/parsoid
965 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
966 !! wikitext
967 <nowiki><h2>foo</h2></nowiki>
968 !! end
969
970 !! test
971 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
972 !! options
973 parsoid=html2wt
974 !! html/parsoid
975 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
976 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
977 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
978 !! wikitext
979 This text: L'[[Foo]]
980 This text: L<nowiki>''</nowiki>[[Foo]]
981 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
982 !! end
983
984 !! test
985 T71950: 2. Put nowiki as close to cause as possible, after ' :'
986 !! options
987 parsoid=html2wt
988 !! html/parsoid
989 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
990 </p>
991 !! wikitext
992 This text : L<nowiki>''</nowiki>[[Foo]]
993 !! end
994
995 # This test and the next one are html2wt only as they test that incorrect wikitext
996 # passed in template arguments gets escaped or wrapped in nowikis where required.
997 !! test
998 T71482: Use {{!}} instead of nowiki for single pipe in template argument
999 !! options
1000 parsoid=html2wt
1001 !! html/parsoid
1002 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;1x&quot;,&quot;href&quot;:&quot;./Template:1x&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1003 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;1x&quot;,&quot;href&quot;:&quot;./Template:1x&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1004 !! wikitext
1005 {{1x|foo{{!}}bar}}
1006 {{1x|<nowiki>foo|bar |[[</nowiki>}}
1007 !! end
1008
1009 !! test
1010 T53961: Output correct nowikis in template arguments
1011 !! options
1012 parsoid=html2wt
1013 !! html/parsoid
1014 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;1x&quot;,&quot;href&quot;:&quot;./Template:1x&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1015 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;1x&quot;,&quot;href&quot;:&quot;./Template:1x&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1016 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;1x&quot;,&quot;href&quot;:&quot;./Template:1x&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1017 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;1x&quot;,&quot;href&quot;:&quot;./Template:1x&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1018 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;1x&quot;,&quot;href&quot;:&quot;./Template:1x&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1019 !! wikitext
1020 {{1x|a [ b}}
1021 {{1x|<nowiki>a }} b</nowiki>}}
1022 {{1x|<nowiki>a [[ b</nowiki>}}
1023 {{1x|<nowiki>a | {{ ]]</nowiki>}}
1024 {{1x|a <nowiki>}</nowiki>}}
1025 !! end
1026
1027 !! test
1028 Cases where "!!" needs nowiki protection
1029 !! options
1030 parsoid=html2wt
1031 !! html/parsoid
1032 <table>
1033 <tr><th>this needs protection !! here</th></tr>
1034 </table>
1035
1036 <table>
1037 <tr><th>this does not need
1038 protection !! here</th></tr>
1039 </table>
1040 !! wikitext
1041 {|
1042 !<nowiki>this needs protection !! here</nowiki>
1043 |}
1044
1045 {|
1046 !this does not need
1047 protection !! here
1048 |}
1049 !! end
1050
1051 !! test
1052 Nowiki with newlines in list
1053 !! wikitext
1054 :<nowiki>test
1055 123</nowiki>
1056 !! html/php
1057 <dl><dd>test
1058 123</dd></dl>
1059 !! html/parsoid
1060 <dl><dd data-parsoid="{}"><span typeof="mw:Nowiki">test
1061 123</span></dd></dl>
1062 !! end
1063
1064 ## The output here may change with the outcome of T255007
1065 !! test
1066 Nowiki and french spacing
1067 !! wikitext
1068 <nowiki>test : 123</nowiki>
1069 !! html/php
1070 <p>test&#160;: 123
1071 </p>
1072 !! html/parsoid
1073 <p><span typeof="mw:Nowiki">test<span typeof="mw:DisplaySpace"> </span>: 123</span></p>
1074 !! end
1075
1076 !! test
1077 T255007: French spacing in raw text elements
1078 !! options
1079 wgRawHtml=1
1080 !! wikitext
1081 <html>
1082 <script>test ; 123</script>
1083 <style>test : 123</style>
1084 </html>
1085 !! html/php
1086 <p>
1087 <script>test ; 123</script>
1088 <style>test : 123</style>
1089
1090 </p>
1091 !! html/parsoid
1092 <p><span typeof="mw:Extension/html" about="#mwt2" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"\n&lt;script>test ; 123&lt;/script>\n&lt;style>test : 123&lt;/style>\n"}}'>
1093 </span><script about="#mwt2">test ; 123</script><span about="#mwt2">
1094 </span><style about="#mwt2">test : 123</style><span about="#mwt2">
1095 </span></p>
1096 !! end
1097
1098 !! test
1099 T406391: HTML entities in raw text elements
1100 !! options
1101 wgRawHtml=1
1102 !! wikitext
1103 <html>
1104 <script>console.log("&");</script>
1105 <style>a::before { content: "&"; }</style>
1106 </html>
1107 A normal & should be encoded
1108 !! html/php
1109 <p>
1110 <script>console.log("&");</script>
1111 <style>a::before { content: "&"; }</style>
1112
1113 A normal &amp; should be encoded
1114 </p>
1115 !! html/parsoid
1116 <p><span typeof="mw:Extension/html" about="#mwt2" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"\n&lt;script>console.log(\"&amp;\");&lt;/script>\n&lt;style>a::before { content: \"&amp;\"; }&lt;/style>\n"}}'>
1117 </span><script about="#mwt2">console.log("&");</script><span about="#mwt2">
1118 </span><style about="#mwt2">a::before { content: "&"; }</style><span about="#mwt2">
1119 </span>
1120 A normal &amp; should be encoded</p>
1121 !! end
1122
1123 !! article
1124 Test
1125 !! text
1126 Dummy article to suppress redlinks in tests
1127 !! end
1128
1129 !! test
1130 French spacing and spans
1131 !! wikitext
1132 [[Test]] : <span>123</span>
1133 « Test »<span>123</span>
1134 !! html/php
1135 <p><a href="/wiki/Test" title="Test">Test</a>&#160;: <span>123</span>
1136 «&#160;Test&#160;»<span>123</span>
1137 </p>
1138 !! html/parsoid
1139 <p><a rel="mw:WikiLink" href="./Test" title="Test" data-parsoid='{"stx":"simple","a":{"href":"./Test"},"sa":{"href":"Test"}}'>Test</a><span typeof="mw:DisplaySpace"> </span>: <span data-parsoid='{"stx":"html"}'>123</span>
1140 «<span typeof="mw:DisplaySpace"> </span>Test<span typeof="mw:DisplaySpace"> </span>»<span data-parsoid='{"stx":"html"}'>123</span></p>
1141 !! end
1142
1143 !! test
1144 post-expand include size being exceeded
1145 !! options
1146 maxincludesize=30
1147 !! wikitext
1148 {{3x_on_newline|1234567890}}
1149 !! html/php
1150 <p><a href="/wiki/Template:3x_on_newline" title="Template:3x on newline">Template:3x on newline</a><!-- WARNING: template omitted, post-expand include size too large -->
1151 </p>
1152 !! html/parsoid+integrated
1153 <p><a rel="mw:WikiLink" href="./Template:3x_on_newline" title="Template:3x on newline" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Template:3x_on_newline"},"sa":{"href":":Template:3x on newline"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"3x_on_newline","href":"./Template:3x_on_newline"},"params":{"1":{"wt":"1234567890"}},"i":0}}]}'>Template:3x on newline</a><span about="#mwt1"><!-- WARNING: template omitted, post&#x2D;expand include size too large --></span></p>
1154 !! end
1155
1156 !! test
1157 max template depth being reached
1158 !! options
1159 maxtemplatedepth=1
1160 !! wikitext
1161 {{1x with depth|too deep!}}
1162 !! html/php
1163 <p><span class="error">Template recursion depth limit exceeded (1)</span>
1164 </p>
1165 !! html/parsoid+integrated
1166 <p><span class="error" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x with depth","href":"./Template:1x_with_depth"},"params":{"1":{"wt":"too deep!"}},"i":0}}]}'>Template recursion depth limit exceeded (1)</span></p>
1167 !! end
1168
1169 !! test
1170 multiple templates that are redirects
1171 !! options
1172 templates
1173 !! wikitext
1174 {{redirect to foo}}
1175 {{redirect to foo}}
1176 !! metadata
1177 template=Template:Redirect_to_foo
1178 template=Template:Foo
1179 !! html/php
1180 <p>FOO
1181 FOO
1182 </p>
1183 !! html/parsoid+integrated
1184 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"redirect to foo","href":"./Template:Redirect_to_foo"},"params":{},"i":0}}]}'>FOO</span>
1185 <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"redirect to foo","href":"./Template:Redirect_to_foo"},"params":{},"i":0}}]}'>FOO</span></p>
1186 !! end
1187
1188 !! test
1189 Transclusion with a (stripped) fragment
1190 !! options
1191 templates
1192 !! wikitext
1193 {{Foo#bar}}
1194 !! metadata
1195 template=Template:Foo
1196 !! html/php
1197 <p>FOO
1198 </p>
1199 !! html/parsoid+integrated
1200 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Foo#bar","href":"./Template:Foo#bar"},"params":{},"i":0}}]}'>FOO</span></p>
1201 !! end
1202
1203 !! test
1204 T53086: Double newlines in blockquotes should be turned into paragraphs
1205 !! wikitext
1206 <blockquote>
1207 Foo
1208
1209 Bar
1210 </blockquote>
1211 !! html
1212 <blockquote>
1213 <p>Foo
1214 </p><p>Bar
1215 </p>
1216 </blockquote>
1217 !! end
1218
1219 !! test
1220 T17491: <ins>/<del> in blockquote
1221 !! wikitext
1222 <blockquote>
1223 Foo <del>bar</del> <ins>baz</ins> quux
1224 </blockquote>
1225 !! html
1226 <blockquote>
1227 <p>Foo <del>bar</del> <ins>baz</ins> quux
1228 </p>
1229 </blockquote>
1230 !! end
1231
1232 !! test
1233 T17491: <ins>/<del> in blockquote (2)
1234 !! wikitext
1235 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1236 </blockquote>
1237 !! html
1238 <blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
1239 </p></blockquote>
1240 !! end
1241
1242 # Regression test to prevent problematic simplifications of parser tests
1243 !! test
1244 Don't paragraph-wrap empty newlines between HTML list items
1245 !! options
1246 parsoid=wt2html
1247 !! wikitext
1248 <ol>
1249 <li>foo</li>
1250
1251
1252
1253 <li>foo</li>
1254 </ol>
1255 !! html/php
1256 <ol>
1257 <li>foo</li>
1258
1259
1260
1261 <li>foo</li>
1262 </ol>
1263 !! html/parsoid
1264 <ol data-parsoid='{"stx":"html"}'>
1265 <li data-parsoid='{"stx":"html"}'>foo</li>
1266
1267
1268
1269 <li data-parsoid='{"stx":"html"}'>foo</li>
1270 </ol>
1271 !! end
1272
1273 #--------------------------------------------------------------------
1274 # Transclusion parameter whitespace stripping tests
1275 # Behavior is different for positional and named parameters
1276 #--------------------------------------------------------------------
1277 !! test
1278 Templates: Strip leading and trailing whitespace from named-param values
1279 !! wikitext
1280 {{1x|1= a }}
1281
1282 {{1x|1= {{1x|b}} }}
1283
1284 {{1x| 1 =
1285 c }}
1286
1287 {{1x| 1 =
1288 * d
1289 }}
1290 !! html
1291 <p>a
1292 </p><p>b
1293 </p><p>c
1294 </p>
1295 <ul><li>d</li></ul>
1296 !! end
1297
1298 !! test
1299 Templates: Don't strip whitespace from positional-param values
1300 !! wikitext
1301 {{1x|a }}
1302
1303 {{1x|{{1x|b}} }}
1304
1305 {{1x| c
1306 }}
1307
1308 {{1x| {{1x|d}}
1309 }}
1310
1311 {{1x|
1312 e}}
1313
1314 {{1x|
1315 *f}}
1316
1317 {{1x|
1318 }}g
1319 !! html
1320 <p>a
1321 </p><p>b
1322 </p>
1323 <pre>c
1324 </pre>
1325 <p><br />
1326 </p>
1327 <pre>d
1328 </pre>
1329 <p><br />
1330 </p>
1331 <pre>e
1332 </pre>
1333 <p><br />
1334 </p>
1335 <ul><li>f</li></ul>
1336 <p><br />
1337 </p>
1338 <pre>g
1339 </pre>
1340 !! html/parsoid
1341 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"a "}},"i":0}}]}'>a</span></p>
1342 <p><span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"{{1x|b}} "}},"i":0}}]}'>b </span></p>
1343
1344 <pre about="#mwt4" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":" c \n"}},"i":0}}]}'>c </pre><span about="#mwt4">
1345 </span>
1346
1347 <pre about="#mwt5" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":" {{1x|d}}\n"}},"i":0}}]}'>d</pre><span about="#mwt5">
1348 </span>
1349
1350 <span about="#mwt7" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"\n e"}},"i":0}}]}'>
1351 </span><pre about="#mwt7">e</pre>
1352
1353 <ul about="#mwt8" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"\n*f"}},"i":0}}]}'><li>f</li></ul>
1354
1355 <span about="#mwt9" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"\n "}},"i":0}},"g"]}'>
1356 </span><pre about="#mwt9">g</pre>
1357 !! end
1358
1359 !! test
1360 Templates: Don't recognize targets split by newlines
1361 !! options
1362 parsoid=wt2html
1363 !! wikitext
1364 {{ech
1365 o|foo}}
1366 !! html/php
1367 <p>{{ech
1368 o|foo}}
1369 </p>
1370 !! html/parsoid
1371 <p>{{ech
1372 o|foo}}</p>
1373 !! end
1374
1375 !! test
1376 Templates: Recognize targets when newlines and comments don't split the target
1377 !! options
1378 parsoid=wt2html
1379 !! wikitext
1380 {{
1381 <!--X--> 1<!--X-->x<!--X-->
1382 <!--X--> <!--X-->
1383
1384 |foo}}
1385 !! html/php
1386 <p>foo
1387 </p>
1388 !! html/parsoid
1389 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1&lt;!--X-->x&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:1x"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span></p>
1390 !! end
1391
1392 ## wt2html only, since the bare {{ will get escaped when serializing
1393 !! test
1394 Templates: Target with an extension tag
1395 !! options
1396 parsoid=wt2html
1397 !! wikitext
1398 {{{{1x|1x}}<nowiki>hi</nowiki>|ho}}
1399 !! html/php
1400 <p>{{1xhi|ho}}
1401 </p>
1402 !! html/parsoid
1403 <p>{{<span about="#mwt5" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"1x"}},"i":0}}]}'>1x</span><span typeof="mw:Nowiki">hi</span>|ho}}</p>
1404 !! end
1405
1406 !! test
1407 Templates: Handle empty comment-and-ws-only lines correctly
1408 !! wikitext
1409 {{1x|foo
1410 <!--should be ignored-->
1411 <!--should be ignored as well-->
1412 bar}}
1413 !! html/php
1414 <p>foo
1415 bar
1416 </p>
1417 !! html/parsoid+standalone
1418 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo
1419 </span><span about="#mwt1"><!--should be ignored--></span><span about="#mwt1">
1420 </span><span about="#mwt1"><!--should be ignored as well--></span><span about="#mwt1">
1421 bar</span></p>
1422 !! html/parsoid+integrated
1423 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo bar</span></p>
1424 !! end
1425
1426 !! test
1427 Templates: Handle comments in the target
1428 !! wikitext
1429 {{1x
1430 <!-- should be ignored -->
1431 |foo}}
1432
1433 {{1x
1434 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
1435 |foo}}
1436
1437 {{1x<!-- should be ignored -->
1438 |foo}}
1439
1440 {{1x<!-- should be ignored -->|foo}}
1441
1442 {{<!-- should be ignored -->1x|foo}}
1443 !! html/php
1444 <p>foo
1445 </p><p>foo
1446 </p><p>foo
1447 </p><p>foo
1448 </p><p>foo
1449 </p>
1450 !! html/parsoid
1451 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x\n&lt;!-- should be ignored -->\n","href":"./Template:1x"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span></p>
1452
1453 <p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:1x"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span></p>
1454
1455 <p><span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x&lt;!-- should be ignored -->\n","href":"./Template:1x"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span></p>
1456
1457 <p><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x&lt;!-- should be ignored -->","href":"./Template:1x"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span></p>
1458
1459 <p><span about="#mwt5" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span></p>
1460 !! end
1461
1462 !! test
1463 Templates: Handle comments in parameter names (T69657)
1464 !! wikitext
1465 {{1x|1
1466 <!-- should be ignored -->
1467 =foo}}
1468
1469 {{1x|
1470 <!-- should be ignored -->
1471 1 = foo}}
1472
1473 {{1x|1<!-- should be ignored -->=foo}}
1474
1475 {{1x|<!-- should be ignored -->1=foo}}
1476 !! html/php
1477 <p>foo
1478 </p><p>foo
1479 </p><p>foo
1480 </p><p>foo
1481 </p>
1482 !! html/parsoid
1483 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</span></p>
1484
1485 <p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</span></p>
1486
1487 <p><span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</span></p>
1488
1489 <p><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</span></p>
1490 !! end
1491
1492 !! test
1493 Templates: Other wikitext in parameter names (T69657)
1494 !! wikitext
1495 {{1x|''1''=foo}}
1496 !! html/php
1497 <p>{{{1}}}
1498 </p>
1499 !! html/parsoid+integrated
1500 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</span></p>
1501 !! end
1502
1503 !! test
1504 Templates: With colons
1505 !! wikitext
1506 {{With: Colon}}
1507 !! html/php
1508 <p>Template with colon
1509 </p>
1510 !! html/parsoid
1511 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"With: Colon","href":"./Template:With:_Colon"},"params":{},"i":0}}]}'>Template with colon</span></p>
1512 !! end
1513
1514 #--------------------------------------------------------------------
1515 # Transclusion parameter escaping tests
1516 #--------------------------------------------------------------------
1517
1518 !! test
1519 Templates: Parsoid parameter escaping test 1
1520 !! wikitext
1521 {{1x|[foo]|{{1x|[bar]}}}}
1522 !! html/php
1523 <p>[foo]
1524 </p>
1525 !! html/parsoid
1526 <p><span about="#mwt1" typeof="mw:Transclusion"
1527 data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{1x|[bar]}}"}},"i":0}}]}'>[foo]</span></p>
1528 !! end
1529
1530 !! test
1531 Parsoid: Pipes in external links in template parameter
1532 !! wikitext
1533 {{1x|[{{1x|http://example.com}} link]}}
1534 !! html/php
1535 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
1536 </p>
1537 !! html/parsoid
1538 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" class="external text" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[{{1x|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
1539 !! end
1540
1541 !! test
1542 Parsoid: pipe in transclusion parameter
1543 !! wikitext
1544 {{1x|http://foo.com/a&#124;b}}
1545 !! html/php
1546 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
1547 </p>
1548 !! html/parsoid
1549 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1" typeof="mw:Transclusion" class="external free" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
1550 !! end
1551
1552 !! test
1553 Parsoid: Pipe in external link target and content in template parameter
1554 !! options
1555 parsoid=html2wt,wt2wt
1556 !! wikitext
1557 {{1x|[http://foo.com/a&#124;b a&#124;b]}}
1558 !! html/php
1559 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
1560 </p>
1561 !! html/parsoid
1562 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1563 typeof="mw:Transclusion"
1564 data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},
1565 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
1566 !! end
1567
1568 !! test
1569 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
1570 !! wikitext
1571 {{1x|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
1572 !! html/php
1573 <p><a rel="nofollow" class="external text" href="http://example.org/index.php?title=Parser_test&amp;action=edit">bar</a>
1574 </p>
1575 !! html/parsoid
1576 <p><a rel="mw:ExtLink" href="http://example.org/index.php?title=Parser_test&amp;action=edit" typeof="mw:Transclusion" class="external text" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>bar</a></p>
1577 !! end
1578
1579 !! test
1580 Templates: Don't escape already nowiki-escaped text in template parameters
1581 !! options
1582 parsoid=html2wt,wt2wt
1583 !! wikitext
1584 {{1x|foo<nowiki>|</nowiki>bar}}
1585 {{1x|<nowiki>&lt;div&gt;</nowiki>}}
1586 {{1x|<nowiki></nowiki>}}
1587 !! html/php
1588 <p>foo|bar
1589 &lt;div&gt;
1590
1591 </p>
1592 !! html/parsoid
1593 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
1594 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"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>
1595 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
1596 </p>
1597 !! end
1598
1599 ## T54824
1600 !! test
1601 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
1602 !! options
1603 parsoid=html2wt,wt2wt
1604 !! wikitext
1605 {{1x|{{1x|1=bar}}}}
1606 !! html/php
1607 <p>bar
1608 </p>
1609 !! html/parsoid
1610 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"{{1x|1=bar}}"}},"i":0}}]}'>bar</span></p>
1611 !! end
1612
1613 ## T58733
1614 !! test
1615 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
1616 !! wikitext
1617 {{1x|a : b}}
1618 !! html/php
1619 <p>a&#160;: b
1620 </p>
1621 !! html/parsoid
1622 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace"> </span>: b</span></p>
1623 !! end
1624
1625 ## T73412
1626 !! test
1627 Templates: Preserve blank parameter names
1628 !! wikitext
1629 {{1x|=foo}}
1630 !! html/php
1631 <p>{{{1}}}
1632 </p>
1633 !! html/parsoid
1634 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</span></p>
1635 !! end
1636
1637 !! test
1638 Templates: Preserve blank parameter names in other positions
1639 !! wikitext
1640 {{blank_param|bar|=foo}}
1641 !! html/php
1642 <p>bar
1643 foo
1644 </p>
1645 !! html/parsoid
1646 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
1647 foo</span></p>
1648 !! end
1649
1650 # wt2html only because Parsoid would want to add <nowiki>s coming from html
1651 !! test
1652 Broken wikilinks (but not external links) prevent templates from closing
1653 !! options
1654 parsoid=wt2html
1655 !! wikitext
1656 [http://example.com x
1657
1658 {{1x|[http://example.com x}}
1659
1660 [[Foo
1661
1662 {{1x|[[Foo}}
1663 !! html/php
1664 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
1665 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
1666 </p><p>[[Foo
1667 </p><p>{{1x|[[Foo}}
1668 </p>
1669 !! html/parsoid
1670 <p>[<a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a> x</p>
1671 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[http://example.com x"}},"i":0}}]}'>[</span><a about="#mwt1" rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a><span about="#mwt1"> x</span></p>
1672 <p>[[Foo</p>
1673 <p>{{1x|[[Foo}}</p>
1674 !! end
1675
1676 !! test
1677 Wikilinks with embedded newlines are not broken
1678 !! wikitext
1679 {{1x|[[ Foo
1680 B
1681 C]]}}
1682 !! html/php
1683 <p>[[ Foo
1684 B
1685 C]]
1686 </p>
1687 !! html/parsoid
1688 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[ Foo\nB\nC]]"}},"i":0}}]}'>[[ Foo B C]]</span></p>
1689 !! end
1690
1691 !! test
1692 Broken templates
1693 !! options
1694 parsoid=wt2html
1695 !! wikitext
1696 {{1x|[[Foo|}}]]
1697
1698 [[Foo|{{1x|]]}}
1699 !! html/php
1700 <p>{{1x|<a href="/wiki/Foo" title="Foo">}}</a>
1701 </p><p>[[Foo|]]
1702 </p>
1703 !! html/parsoid
1704 <p>{{1x|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
1705 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
1706 !! end
1707
1708 !! article
1709 Template:pipe page
1710 !! text
1711 Main|Page
1712 !! endarticle
1713
1714 ## FIXME: Parsoid doesn't support this and may never. See T226523
1715 !! test
1716 Template returning pipe used in wikilink target
1717 !! wikitext
1718 [[{{pipe page}}]]
1719 !! html/php
1720 <p><a href="/index.php?title=Main&amp;action=edit&amp;redlink=1" class="new" title="Main (page does not exist)">Page</a>
1721 </p>
1722 !! html/parsoid
1723 <p>[[<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"pipe page","href":"./Template:Pipe_page"},"params":{},"i":0}}]}'>Main|Page</span>]]</p>
1724 !! end
1725
1726 # Italic/link nesting is changed in this test, but the rendered result is the
1727 # same. Currently the Parsoid result is actually an improvement over
1728 # the legacy parser output.
1729 !! test
1730 T4702: Mismatched <i>, <b> and <a> tags are invalid
1731 !! wikitext
1732 ''[http://example.com text'']
1733 [http://example.com '''text]'''
1734 ''Something [http://example.com in italic'']
1735 ''Something [http://example.com mixed''''', even bold]'''
1736 '''''Now [http://example.com both''''']
1737 !! html/php
1738 <p><i><a rel="nofollow" class="external text" href="http://example.com">text</a></i>
1739 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
1740 <i>Something <a rel="nofollow" class="external text" href="http://example.com">in italic</a></i>
1741 <i>Something <a rel="nofollow" class="external text" href="http://example.com">mixed</a></i><a rel="nofollow" class="external text" href="http://example.com"><b>, even bold</b></a>
1742 <i><b>Now <a rel="nofollow" class="external text" href="http://example.com">both</a></b></i>
1743 </p>
1744 !! html/parsoid
1745 <p><i data-parsoid='{"autoInsertedEnd":true}'><a rel="mw:ExtLink" href="http://example.com" class="external text">text<i data-parsoid='{"autoInsertedEnd":true}'></i></a></i>
1746 <a rel="mw:ExtLink" href="http://example.com" class="external text"><b data-parsoid='{"autoInsertedEnd":true}'>text</b></a><b data-parsoid='{"autoInsertedEnd":true}'></b>
1747 <i data-parsoid='{"autoInsertedEnd":true}'>Something <a rel="mw:ExtLink" href="http://example.com" class="external text">in italic<i data-parsoid='{"autoInsertedEnd":true}'></i></a></i>
1748 <i>Something <a rel="mw:ExtLink" href="http://example.com" class="external text">mixed<b data-parsoid='{"autoInsertedEnd":true}'><i data-parsoid='{"autoInsertedEnd":true}'>, even bold</i></b></a>'</i>
1749 <b data-parsoid='{"autoInsertedEnd":true}'><i data-parsoid='{"autoInsertedEnd":true}'>Now <a rel="mw:ExtLink" href="http://example.com" class="external text">both<b data-parsoid='{"autoInsertedEnd":true}'><i data-parsoid='{"autoInsertedEnd":true}'></i></b></a></i></b></p>
1750 !! end
1751
1752 !! test
1753 Serialize <a> tags with invalid link targets as plain text
1754 !! options
1755 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
1756 !! html/parsoid
1757 <a rel="mw:WikiLink" href="[[foo]]">text</a>
1758 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
1759 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
1760 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
1761 !! wikitext
1762 text
1763 <nowiki>*</nowiki>text
1764 <nowiki>[[foo]]</nowiki>
1765 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
1766 !! end
1767
1768 !! test
1769 mw:ExtLink -vs- mw:WikiLink (T94723)
1770 !! options
1771 parsoid=html2wt
1772 !! html/parsoid
1773 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
1774 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
1775 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
1776 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
1777 <p>
1778 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
1779 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
1780 </p>
1781 !! wikitext
1782 [[Foo|Bar]]
1783 [[Foo|Bar]]
1784 [[:en:Foo|Bar]]
1785 [[:en:Foo|Bar]]
1786
1787 [[:en:European_Robin|European Robin]]
1788 [[:en:European_Robin|European Robin]]
1789 !! end
1790
1791 !! test
1792 Break on | in element attribute in template
1793 !! options
1794 parsoid=wt2html,html2html
1795 !! wikitext
1796 {{1x|1=<div class="hi|ho">ha</div>}}
1797 !! html/php
1798 <p>ho"&gt;ha</p>
1799 !! html/parsoid
1800 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</p>
1801 !! end
1802
1803 !! test
1804 Break on | in element attribute name in template
1805 !! wikitext
1806 {{1x|<div cla|ss="hiho">ha</div>}}
1807 !! html/parsoid
1808 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</span></p>
1809 !! end
1810
1811 !! test
1812 Don't break on | in extension attribute in template
1813 !! wikitext
1814 {{1x|<tag name="hi|ho">ha</tag>}}
1815 !! html/parsoid
1816 <pre typeof="mw:Extension/tag mw:Transclusion" data-mw='{"name":"tag","attrs":{"name":"hi|ho"},"body":{"extsrc":"ha"},"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;tag name=\"hi|ho\">ha&lt;/tag>"}},"i":0}}]}'>'ha'
1817 array (
1818 'name' => 'hi|ho',
1819 )</pre>
1820 !! end
1821
1822 ###
1823 ### Internal links
1824 ###
1825 !! test
1826 Plain link, capitalized
1827 !! wikitext
1828 [[Main Page]]
1829 !! html
1830 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1831 </p>
1832 !! end
1833
1834 !! test
1835 Plain link, uncapitalized
1836 !! wikitext
1837 [[main Page]]
1838 !! html
1839 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1840 </p>
1841 !! end
1842
1843 !! test
1844 Piped link
1845 !! wikitext
1846 [[Main Page|The Main Page]]
1847 !! html
1848 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1849 </p>
1850 !! end
1851
1852 !! test
1853 Piped link with comment in link text
1854 !! wikitext
1855 [[Main Page|The Main<!--front--> Page]]
1856 !! html
1857 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1858 </p>
1859 !! end
1860
1861 !! test
1862 Piped link with multiple pipe characters in link text
1863 !! wikitext
1864 [[Main Page||The|Main|Page|]]
1865 !! html/php
1866 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
1867 </p>
1868 !! html/parsoid
1869 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
1870 !! end
1871
1872 !! test
1873 Piped link with no link text
1874 !! wikitext
1875 [[Thomas Bek (bishop of St David's)|]]
1876 !! html/php
1877 <p>[[Thomas Bek (bishop of St David's)|]]
1878 </p>
1879 !! html/parsoid
1880 <p>[[Thomas Bek (bishop of St David's)|]]</p>
1881 !! end
1882
1883 !! test
1884 Piped link with empty link text
1885 !! wikitext
1886 [[Main Page|<nowiki/>]] - empty nowiki
1887 [[Main Page|&nbsp;]] - empty non breaking space
1888 !! html/php
1889 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
1890 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
1891 </p>
1892 !! html/parsoid
1893 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
1894 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
1895 !! end
1896
1897 ## Separate from the above because Parsoid normalizes the empty link away
1898 !! test
1899 Piped link with empty link text - 2
1900 !! options
1901 parsoid=wt2html
1902 !! wikitext
1903 [[Main Page| ]] - empty space
1904 !! html/php
1905 <p><a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
1906 </p>
1907 !! html/parsoid
1908 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space</p>
1909 !! end
1910
1911 !! test
1912 Broken link
1913 !! wikitext
1914 [[Zigzagzogzagzig]]
1915 !! html/php
1916 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
1917 </p>
1918 !! html/parsoid
1919 <p><a rel="mw:WikiLink" href="./Zigzagzogzagzig?action=edit&amp;redlink=1" title="Zigzagzogzagzig" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Zigzagzogzagzig"},"sa":{"href":"Zigzagzogzagzig"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Zigzagzogzagzig"]}}'>Zigzagzogzagzig</a></p>
1920 !! end
1921
1922 # The PHP parser strips the hash fragment for non-existent pages, but
1923 # Parsoid does not. (T227693)
1924 !! test
1925 Broken link with fragment
1926 !! options
1927 links
1928 !! wikitext
1929 [[Zigzagzogzagzig#zug]]
1930 !! metadata
1931 link=Zigzagzogzagzig
1932 !! html/php
1933 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
1934 </p>
1935 !! html/parsoid
1936 <p><a rel="mw:WikiLink" href="./Zigzagzogzagzig?action=edit&amp;redlink=1#zug" title="Zigzagzogzagzig" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Zigzagzogzagzig#zug"},"sa":{"href":"Zigzagzogzagzig#zug"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Zigzagzogzagzig"]}}'>Zigzagzogzagzig#zug</a></p>
1937 !! end
1938
1939 !! test
1940 Special page link with fragment
1941 !! options
1942 special
1943 !! wikitext
1944 [[Special:Version#anchor]]
1945 !! metadata
1946 special=Special:Version
1947 !! html
1948 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
1949 </p>
1950 !! end
1951
1952 # Parsoid does not strip fragment from red links: T227693
1953 !! test
1954 Nonexistent special page link with fragment
1955 !! wikitext
1956 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
1957 !! html/php
1958 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
1959 </p>
1960 !! html/parsoid
1961 <p><a rel="mw:WikiLink" href="./Special:ThisNameWillHopefullyNeverBeUsed?action=edit&amp;redlink=1#anchor" title="Special:ThisNameWillHopefullyNeverBeUsed" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Special:ThisNameWillHopefullyNeverBeUsed#anchor"},"sa":{"href":"Special:ThisNameWillHopefullyNeverBeUsed#anchor"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Special:ThisNameWillHopefullyNeverBeUsed"]}}'>Special:ThisNameWillHopefullyNeverBeUsed#anchor</a></p>
1962 !! end
1963
1964 !! test
1965 Link with prefix
1966 !! wikitext
1967 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
1968 !! html
1969 <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>
1970 </p>
1971 !! end
1972
1973 !! test
1974 Link with suffix
1975 !! wikitext
1976 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
1977 !! html
1978 <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>!!!
1979 </p>
1980 !! end
1981
1982 !! article
1983 prefixed article
1984 !! text
1985 Some text
1986 !! endarticle
1987
1988 !! test
1989 T45661: Piped links with identical prefixes
1990 !! wikitext
1991 [[prefixed article|prefixed articles with spaces]]
1992
1993 [[prefixed article|prefixed articlesaoeu]]
1994
1995 [[Main Page|Main Page test]]
1996 !! html
1997 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
1998 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
1999 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
2000 </p>
2001 !! end
2002
2003
2004 !! test
2005 Link with HTML entity in suffix / tail
2006 !! wikitext
2007 [[Main Page]]&quot;, [[Main Page]]&#97;
2008 !! html/php
2009 <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;
2010 </p>
2011 !! html/parsoid
2012 <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>
2013 !! end
2014
2015 !! test
2016 Link with 3 brackets
2017 !! wikitext
2018 [[[Main Page]]]
2019 Foo [[[Main Page]]]
2020 !! html
2021 <p>[[[Main Page]]]
2022 Foo [[[Main Page]]]
2023 </p>
2024 !! end
2025
2026 !! test
2027 Link with 4 brackets
2028 !! wikitext
2029 [[[[Main Page]]]]
2030 !! html
2031 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
2032 </p>
2033 !! end
2034
2035 !! test
2036 Piped link with 3 brackets
2037 !! wikitext
2038 [[[main page|the main page]]]
2039 !! html
2040 <p>[[[main page|the main page]]]
2041 </p>
2042 !! end
2043
2044 !! test
2045 Piped link with extlink-like text
2046 !! wikitext
2047 [[Main Page|[bar]]]
2048 [[Main Page|This is a [bar]]]
2049 [[Main Page|[bar]]
2050 !! html/php
2051 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
2052 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
2053 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
2054 </p>
2055 !! html/parsoid
2056 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
2057 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
2058 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
2059 !! end
2060
2061 !! test
2062 Link with multiple pipes
2063 !! wikitext
2064 [[Main Page|The|Main|Page]]
2065 !! html
2066 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
2067 </p>
2068 !! end
2069
2070 !! test
2071 Anchor containing a #. (T65430)
2072 !! config
2073 wgFragmentMode=[ "html5", "legacy" ]
2074 !! options
2075 links
2076 !! wikitext
2077 [[Main Page#And#Link]]
2078 !! metadata
2079 link=Main_Page
2080 !! html/php
2081 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
2082 </p>
2083 !! html/parsoid
2084 <p><a rel="mw:WikiLink" href="./Main_Page#And#Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And#Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
2085 !! end
2086
2087 !! article
2088 Talk:Parser testing
2089 !! text
2090 Dummy article to suppress redlinks in tests
2091 !! end
2092
2093 !! article
2094 Meta:Disclaimers
2095 !! text
2096 Dummy article to suppress redlinks in tests
2097 !! end
2098
2099 !! test
2100 Link to namespaces
2101 !! wikitext
2102 [[Talk:Parser testing]], [[Meta:Disclaimers]]
2103 !! html/php
2104 <p><a href="/wiki/Talk:Parser_testing" title="Talk:Parser testing">Talk:Parser testing</a>, <a href="/wiki/Meta:Disclaimers" title="Meta:Disclaimers">Meta:Disclaimers</a>
2105 </p>
2106 !! html/parsoid
2107 <p><a rel="mw:WikiLink" href="./Talk:Parser_testing" title="Talk:Parser testing" data-parsoid='{"stx":"simple","a":{"href":"./Talk:Parser_testing"},"sa":{"href":"Talk:Parser testing"}}'>Talk:Parser testing</a>, <a rel="mw:WikiLink" href="./Meta:Disclaimers" title="Meta:Disclaimers" data-parsoid='{"stx":"simple","a":{"href":"./Meta:Disclaimers"},"sa":{"href":"Meta:Disclaimers"}}'>Meta:Disclaimers</a></p>
2108 !! end
2109
2110 !! article
2111 User talk:Foo bar
2112 !! text
2113 Dummy article to suppress redlinks in tests
2114 !! end
2115
2116 !! test
2117 Link with space in namespace
2118 !! wikitext
2119 [[User talk:Foo bar]]
2120 !! html/php
2121 <p><a href="/wiki/User_talk:Foo_bar" title="User talk:Foo bar">User talk:Foo bar</a>
2122 </p>
2123 !! html/parsoid
2124 <p><a rel="mw:WikiLink" href="./User_talk:Foo_bar" title="User talk:Foo bar" data-parsoid='{"stx":"simple","a":{"href":"./User_talk:Foo_bar"},"sa":{"href":"User talk:Foo bar"}}'>User talk:Foo bar</a></p>
2125 !! end
2126
2127 !! article
2128 MemoryAlpha:AlphaTest
2129 !! text
2130 This is an article in the MemoryAlpha namespace
2131 (which shadows the memoryalpha interwiki link).
2132 !! endarticle
2133
2134 !! test
2135 Namespace takes precedence over interwiki link (T53680)
2136 !! wikitext
2137 [[MemoryAlpha:AlphaTest]]
2138 !! html
2139 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
2140 </p>
2141 !! end
2142
2143 # The previous test doesn't work correctly in html2*, due to not recognizing the
2144 # link as an internal one. This one checks for the correct behavior.
2145 !! test
2146 Link to namespace preferred over interwiki with correct rel attribute
2147 !! options
2148 parsoid=html2wt,html2html
2149 !! html/parsoid
2150 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
2151 !! wikitext
2152 [[MemoryAlpha:AlphaTest]]
2153 !! end
2154
2155 !! test
2156 Piped link to namespace
2157 !! wikitext
2158 [[Meta:Disclaimers|The disclaimers]]
2159 !! html/php
2160 <p><a href="/wiki/Meta:Disclaimers" title="Meta:Disclaimers">The disclaimers</a>
2161 </p>
2162 !! html/parsoid
2163 <p><a rel="mw:WikiLink" href="./Meta:Disclaimers" title="Meta:Disclaimers" data-parsoid='{"stx":"piped","a":{"href":"./Meta:Disclaimers"},"sa":{"href":"Meta:Disclaimers"}}'>The disclaimers</a></p>
2164 !! end
2165
2166 !! test
2167 Link containing }
2168 !! wikitext
2169 [[Usually caused by a typo (oops}]]
2170 !! html
2171 <p>[[Usually caused by a typo (oops}]]
2172 </p>
2173 !! end
2174
2175 !! article
2176 7% Solution
2177 !! text
2178 Just a test of an article title containing a percent.
2179 !! endarticle
2180
2181 !! test
2182 Link containing % (not as a hex sequence)
2183 !! wikitext
2184 [[7% Solution]]
2185 [[7% Solution|7%25 Solution]]
2186 !! html/php
2187 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
2188 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
2189 </p>
2190 !! html/parsoid
2191 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
2192 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
2193 !! end
2194
2195 # note that the parsoid HTML is identical to the previous test output,
2196 # so the previous test ensures that the html2wt mode will generate the
2197 # "not as a hex sequence" wikitext.
2198 !! test
2199 Link containing % as a single hex sequence interpreted to char
2200 !! options
2201 parsoid=wt2wt,wt2html,html2html
2202 !! wikitext
2203 [[7%25 Solution]]
2204 [[7%25 Solution|7%25 Solution]]
2205 !! html/php
2206 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
2207 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
2208 </p>
2209 !! html/parsoid
2210 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
2211 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
2212 !!end
2213
2214 !! test
2215 Link containing % as a double hex sequence interpreted to hex sequence
2216 !! wikitext
2217 [[7%2525 Solution]]
2218 !! html
2219 <p>[[7%2525 Solution]]
2220 </p>
2221 !!end
2222
2223 ## Example for such a section: == < ==
2224 !! test
2225 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
2226 !! options
2227 title=[[Main Page]]
2228 !! config
2229 wgFragmentMode=[ "html5", "legacy" ]
2230 !! wikitext
2231 [[%23%3c]][[%23%3e]]
2232 !! html/php
2233 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
2234 </p>
2235 !! html/parsoid
2236 <p><a rel="mw:WikiLink" href="./Main_Page#&lt;" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#&lt;"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#>" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#>"},"sa":{"href":"%23%3e"}}'>#></a></p>
2237 !! end
2238
2239 ## Example for such a section: == < ==
2240 !! test
2241 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
2242 !! config
2243 wgFragmentMode=[ "legacy" ]
2244 !! wikitext
2245 [[%23%3c]][[%23%3e]]
2246 !! html/php
2247 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
2248 </p>
2249 !! end
2250
2251 !! test
2252 Link containing "<#" and ">#" as a hex sequences
2253 !! wikitext
2254 [[%3c%23]][[%3e%23]]
2255 !! html
2256 <p>[[%3c%23]][[%3e%23]]
2257 </p>
2258 !! end
2259
2260 !! test
2261 Link containing an equals sign
2262 !! wikitext
2263 [[Special:BookSources/isbn=4-00-026157-6]]
2264 !! html/php
2265 <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>
2266 </p>
2267 !! html/parsoid
2268 <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>
2269 !! end
2270
2271 !! article
2272 Foo & bar
2273 !! text
2274 Just a test of an article title containing an ampersand
2275 !! endarticle
2276
2277 !! test
2278 Link containing an ampersand
2279 !! wikitext
2280 [[Foo & bar]]
2281
2282 [[Foo &amp; bar]]
2283
2284 [[Foo &amp;amp; bar]]
2285 !! html/php
2286 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
2287 </p><p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
2288 </p><p>[[Foo &amp;amp; bar]]
2289 </p>
2290 !! html/parsoid
2291 <p><a rel="mw:WikiLink" href="./Foo_&amp;_bar" title="Foo &amp; bar">Foo &amp; bar</a></p>
2292 <p><a rel="mw:WikiLink" href="./Foo_&amp;_bar" title="Foo &amp; bar" data-parsoid='{"stx":"simple","a":{"href":"./Foo_&amp;_bar"},"sa":{"href":"Foo &amp;amp; bar"}}'>Foo &amp; bar</a></p>
2293 <p>[[Foo <span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp; bar]]</p>
2294 !! end
2295
2296 !! article
2297 Foo~bar
2298 !! text
2299 Just a test of an article title containing a tilde.
2300 !! endarticle
2301
2302 # note that links containing signatures, like [[Foo~~~~]], are
2303 # massaged by the pre-save transform (PST) and so the tildes are never
2304 # seen by the parser.
2305 !! test
2306 Link containing a tilde
2307 !! wikitext
2308 [[Foo~bar]]
2309 !! html/php
2310 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
2311 </p>
2312 !! html/parsoid
2313 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
2314 !! end
2315
2316 !! article
2317 Lista d''e paise d''o munno
2318 !! text
2319 Dummy article to suppress redlinks in tests
2320 !! end
2321
2322 !! test
2323 Link containing double-single-quotes '' (T6598)
2324 !! wikitext
2325 [[Lista d''e paise d''o munno]]
2326 !! html/php
2327 <p><a href="/wiki/Lista_d%27%27e_paise_d%27%27o_munno" title="Lista d&#39;&#39;e paise d&#39;&#39;o munno">Lista d''e paise d''o munno</a>
2328 </p>
2329 !! html/parsoid
2330 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno" data-parsoid='{"stx":"simple","a":{"href":"./Lista_d&apos;&apos;e_paise_d&apos;&apos;o_munno"},"sa":{"href":"Lista d&apos;&apos;e paise d&apos;&apos;o munno"}}'>Lista d''e paise d''o munno</a></p>
2331 !! end
2332
2333 !! article
2334 Cool "Gator"
2335 !! text
2336 Dummy article to suppress redlinks in tests
2337 !! end
2338
2339 !! test
2340 Link containing double quotes and spaces
2341 !! wikitext
2342 [[Cool "Gator"]]
2343 !! html/php
2344 <p><a href="/wiki/Cool_%22Gator%22" title="Cool &quot;Gator&quot;">Cool "Gator"</a>
2345 </p>
2346 !! html/parsoid
2347 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"' data-parsoid='{"stx":"simple","a":{"href":"./Cool_\"Gator\""},"sa":{"href":"Cool \"Gator\""}}'>Cool "Gator"</a></p>
2348 !! end
2349
2350 !! article
2351 Link
2352 !! text
2353 Dummy article to suppress redlinks in tests
2354 !! end
2355
2356 !! test
2357 Link containing double-single-quotes '' in text (T6598 check)
2358 !! wikitext
2359 Some [[Link|pretty ''italics'' and stuff]]!
2360 !! html/php
2361 <p>Some <a href="/wiki/Link" title="Link">pretty <i>italics</i> and stuff</a>!
2362 </p>
2363 !! html/parsoid
2364 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link" data-parsoid='{"stx":"piped","a":{"href":"./Link"},"sa":{"href":"Link"}}'>pretty <i>italics</i> and stuff</a>!</p>
2365 !! end
2366
2367 !! test
2368 Link containing double-single-quotes '' in text embedded in italics (T6598 check)
2369 !! wikitext
2370 ''Some [[Link|pretty ''italics'' and stuff]]!''
2371 !! html/php
2372 <p><i>Some <a href="/wiki/Link" title="Link">pretty <i>italics</i> and stuff</a>!</i>
2373 </p>
2374 !! html/parsoid
2375 <p><i>Some <a rel="mw:WikiLink" href="./Link" title="Link" data-parsoid='{"stx":"piped","a":{"href":"./Link"},"sa":{"href":"Link"}}'>pretty <i>italics</i> and stuff</a>!</i></p>
2376 !! end
2377
2378 !! article
2379 ''Pentecoste''
2380 !! text
2381 Dummy article to suppress redlinks in tests
2382 !! end
2383
2384 ## FIXME: Title part of filename is interpreted in php
2385 !! test
2386 Link with double quotes in title part (literal) and alternate part (interpreted)
2387 !! config
2388 wgParserEnableLegacyMediaDOM=false
2389 !! wikitext
2390 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
2391
2392 [[''Pentecoste'']]
2393
2394 [[''Pentecoste''|Pentecoste]]
2395
2396 [[''Pentecoste''|''Pentecoste'']]
2397 !! html/php
2398 <p><span class="mw-default-size" typeof="mw:Error mw:File"><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"><span class="mw-file-element mw-broken-media">File:Denys Savchenko <i>Pentecoste</i>.jpg</span></a></span>
2399 </p><p><a href="/wiki/%27%27Pentecoste%27%27" title="&#39;&#39;Pentecoste&#39;&#39;">''Pentecoste''</a>
2400 </p><p><a href="/wiki/%27%27Pentecoste%27%27" title="&#39;&#39;Pentecoste&#39;&#39;">Pentecoste</a>
2401 </p><p><a href="/wiki/%27%27Pentecoste%27%27" title="&#39;&#39;Pentecoste&#39;&#39;"><i>Pentecoste</i></a>
2402 </p>
2403 !! html/parsoid
2404 <p><span class="mw-default-size" typeof="mw:Error mw:File" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg"><span class="mw-file-element mw-broken-media" resource="./File:Denys_Savchenko_''Pentecoste''.jpg" data-parsoid='{"a":{"resource":"./File:Denys_Savchenko_&apos;&apos;Pentecoste&apos;&apos;.jpg"},"sa":{"resource":"File:Denys_Savchenko_&apos;&apos;Pentecoste&apos;&apos;.jpg"}}'>File:Denys Savchenko ''Pentecoste''.jpg</span></a></span></p>
2405
2406 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''" data-parsoid='{"stx":"simple","a":{"href":"./&apos;&apos;Pentecoste&apos;&apos;"},"sa":{"href":"&apos;&apos;Pentecoste&apos;&apos;"}}'>''Pentecoste''</a></p>
2407
2408 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''" data-parsoid='{"stx":"piped","a":{"href":"./&apos;&apos;Pentecoste&apos;&apos;"},"sa":{"href":"&apos;&apos;Pentecoste&apos;&apos;"}}'>Pentecoste</a></p>
2409
2410 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''" data-parsoid='{"stx":"piped","a":{"href":"./&apos;&apos;Pentecoste&apos;&apos;"},"sa":{"href":"&apos;&apos;Pentecoste&apos;&apos;"}}'><i>Pentecoste</i></a></p>
2411 !! end
2412
2413 !! test
2414 Plain link to URL
2415 !! wikitext
2416 [[http://www.example.com]]
2417 !! html/php
2418 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
2419 </p>
2420 !! html/parsoid
2421 <p>[<a rel="mw:ExtLink" href="http://www.example.com" class="external autonumber"></a>]</p>
2422 !! end
2423
2424 !! test
2425 Plain link to URL with link text
2426 !! wikitext
2427 [[http://www.example.com Link text]]
2428 !! html
2429 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
2430 </p>
2431 !! end
2432
2433 !! test
2434 Plain link to URL containing special characters, with link text (see T213950).
2435 !! wikitext
2436 [[http://www.example.com/?q=%7Babc%7D Link text]]
2437 !! html
2438 <p>[<a rel="nofollow" class="external text" href="http://www.example.com/?q=%7Babc%7D">Link text</a>]
2439 </p>
2440 !! end
2441
2442 !! test
2443 Plain link to protocol-relative URL
2444 !! wikitext
2445 [[//www.example.com]]
2446 !! html/php
2447 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
2448 </p>
2449 !! html/parsoid
2450 <p>[<a rel="mw:ExtLink" href="//www.example.com" class="external autonumber"></a>]</p>
2451 !! end
2452
2453 !! test
2454 Plain link to protocol-relative URL with link text
2455 !! wikitext
2456 [[//www.example.com Link text]]
2457 !! html
2458 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
2459 </p>
2460 !! end
2461
2462 !! test
2463 Plain link to page with question mark in title
2464 !! wikitext
2465 [[A?b]]
2466
2467 [[A?b|Baz]]
2468 !! html
2469 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
2470 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
2471 </p>
2472 !! end
2473
2474 # I'm fairly sure the expected result here is wrong.
2475 # We want these to be URL links, not pseudo-pages with URLs for titles....
2476 # However the current output is also pretty screwy.
2477 #
2478 # ----
2479 # I'm changing it to match the current output--it arguably makes more
2480 # sense in the light of the test above. Old expected result was:
2481 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
2482 #</p>
2483 # But I think this test is bordering on "garbage in, garbage out" anyway.
2484 # -- wtm
2485 !! test
2486 Piped link to URL
2487 !! wikitext
2488 Piped link to URL: [[http://www.example.com|an example URL]]
2489 !! html/php
2490 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
2491 </p>
2492 !! html/parsoid
2493 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com%7Can" class="external text" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
2494 !! end
2495
2496 !! article
2497 Example
2498 !! text
2499 Dummy article to suppress redlinks in tests
2500 !! end
2501
2502 !! test
2503 Nested wikilink syntax in wikilink syntax that parses as wikilink in extlink
2504 !! options
2505 parsoid=wt2html
2506 !! wikitext
2507 [[http://example.com|[[Example]]]]
2508 !! html/php
2509 <p>[<a rel="nofollow" class="external text" href="http://example.com%7C"></a><a href="/wiki/Example" title="Example">Example</a>]
2510 </p>
2511 !! html/parsoid
2512 <p>[<a rel="mw:ExtLink nofollow" href="http://example.com%7C" class="external autonumber" data-parsoid='{"a":{"href":"http://example.com%7C"},"sa":{"href":"http://example.com|"}}'></a><a rel="mw:WikiLink" href="./Example" title="Example" data-parsoid='{"stx":"simple","a":{"href":"./Example"},"sa":{"href":"Example"},"misnested":true}'>Example</a>]</p>
2513 !! end
2514
2515 !! test
2516 Plain link in template argument
2517 !! options
2518 parsoid=wt2html
2519 !! wikitext
2520 {{1x|[http://www.example.com |123]}}
2521
2522 {{1x|[[http://www.example.com |123]]}}
2523
2524 {{1x|[[http://www.example.com |123]}}
2525
2526 {{1x|[http://www.example.com |123]]}}
2527 !! html/php
2528 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
2529 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
2530 </p><p>{{1x|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
2531 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
2532 </p>
2533 !! html/parsoid
2534 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]"}},"i":0}}]}'>[</span><a about="#mwt1" rel="mw:ExtLink" href="http://www.example.com" class="external free">http://www.example.com</a><span about="#mwt1"> </span></p>
2535
2536 <p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[http://www.example.com |123]]"}},"i":0}}]}'>[</span><a about="#mwt2" rel="mw:ExtLink" href="http://www.example.com" class="external text">|123</a><span about="#mwt2">]</span></p>
2537
2538 <p>{{1x|[<a rel="mw:ExtLink" href="http://www.example.com" class="external text">|123</a>}}</p>
2539
2540 <p><span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]]"}},"i":0}}]}'>[</span><a about="#mwt3" rel="mw:ExtLink" href="http://www.example.com" class="external free">http://www.example.com</a><span about="#mwt3"> </span></p>
2541 !! end
2542
2543 !! test
2544 T2002: [[page|http://url/]] should link to page, not http://url/
2545 !! wikitext
2546 [[Main Page|http://url/]]
2547 !! html/php
2548 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
2549 </p>
2550 !! html/parsoid
2551 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
2552 !! end
2553
2554 !! test
2555 T2337: Escaped self-links should be bold
2556 !! options
2557 title=[[Bug462]]
2558 !! wikitext
2559 [[Bu&#103;462]] [[Bug462]]
2560 !! html/php
2561 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
2562 </p>
2563 !! html/parsoid
2564 <p><a rel="mw:WikiLink" href="./Bug462" class="mw-selflink selflink" data-parsoid='{"stx":"simple","a":{"href":"./Bug462"},"sa":{"href":"Bu&amp;#103;462"}}'>Bug462</a> <a rel="mw:WikiLink" href="./Bug462" class="mw-selflink selflink" data-parsoid='{"stx":"simple","a":{"href":"./Bug462"},"sa":{"href":"Bug462"}}'>Bug462</a></p>
2565 !! end
2566
2567 !! test
2568 Self-link to section should not be bold
2569 !! options
2570 title=[[Main Page]]
2571 !! wikitext
2572 [[Main Page#section]]
2573 !! html/php
2574 <p><a class="mw-selflink-fragment" href="#section">Main Page#section</a>
2575 </p>
2576 !! html/parsoid
2577 <p><a rel="mw:WikiLink" href="./Main_Page#section" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#section"},"sa":{"href":"Main Page#section"}}'>Main Page#section</a></p>
2578 !! end
2579
2580
2581 !! test
2582 Self-link hash fragment should be escaped
2583 !! options
2584 title=[[Main Page]]
2585 !! wikitext
2586 [[Main Page#section with spaces]]
2587 !! html/php
2588 <p><a class="mw-selflink-fragment" href="#section_with_spaces">Main Page#section with spaces</a>
2589 </p>
2590 !! html/parsoid
2591 <p><a rel="mw:WikiLink" href="./Main_Page#section_with_spaces" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#section_with_spaces"},"sa":{"href":"Main Page#section with spaces"}}'>Main Page#section with spaces</a></p>
2592 !! end
2593
2594 !! article
2595 00
2596 !! text
2597 This is 00.
2598 !! endarticle
2599
2600 !!test
2601 Self-link to numeric title
2602 !!options
2603 title=[[0]]
2604 !! wikitext
2605 [[0]]
2606 !! html/php
2607 <p><a class="mw-selflink selflink">0</a>
2608 </p>
2609 !! html/parsoid
2610 <p><a rel="mw:WikiLink" href="./0" class="mw-selflink selflink" data-parsoid='{"stx":"simple","a":{"href":"./0"},"sa":{"href":"0"}}'>0</a></p>
2611 !!end
2612
2613 !!test
2614 Link to numeric-equivalent title
2615 !!options
2616 title=[[0]]
2617 !! wikitext
2618 [[00]]
2619 !! html
2620 <p><a href="/wiki/00" title="00">00</a>
2621 </p>
2622 !!end
2623
2624 !! test
2625 <nowiki> inside a link
2626 !! wikitext
2627 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
2628 !! html/php
2629 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
2630 </p>
2631 !! html/parsoid
2632 <p>[[Main<span typeof="mw:Nowiki"> Page</span>]] <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">the main page <span typeof="mw:Nowiki">[it's not very good]</span></a></p>
2633 !! end
2634
2635 ## Parsoid doesn't get this right and even fails wt2html because, when doing the
2636 ## normalization for comparison, the html serialization / re-parse doesn't
2637 ## roundtrip. This is T49963
2638 !! test
2639 <pre> inside a link
2640 !! wikitext
2641 [[Main<pre> Page</pre>]] [[Main Page|the main page <pre>[it's not very good]</pre>]]
2642 !! html/php
2643 <p>[[Main</p><pre> Page</pre><p>]] <a href="/wiki/Main_Page" title="Main Page">the main page </a></p><a href="/wiki/Main_Page" title="Main Page"><pre>[it's not very good]</pre></a>
2644 !! html/parsoid
2645 <p>[[Main</p><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":" Page"}}'> Page</pre><p>]] <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">the main page <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"[it&apos;s not very good]"}}'>[it's not very good]</pre></a></p>
2646 !! end
2647
2648 !! test
2649 Non-breaking spaces in title
2650 !! wikitext
2651 [[&nbsp; Main &nbsp; Page &nbsp;]]
2652 !! html
2653 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
2654 </p>
2655 !!end
2656
2657 # Add new article for the test below so that it doesn't red-link
2658 !! article
2659 Foo bar baz
2660 !! text
2661 boo
2662 !! endarticle
2663
2664 !! test
2665 Multiple spaces in titles should normalize to a single underscore
2666 !! options
2667 parsoid=wt2html,wt2wt
2668 !! wikitext
2669 [[Foo bar baz|x]]
2670 [[Foo bar baz|x]]
2671 [[Foo bar baz|x]]
2672 !! html/php
2673 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
2674 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
2675 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
2676 </p>
2677 !! html/parsoid
2678 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
2679 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
2680 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
2681 </p>
2682 !! end
2683
2684 !! test
2685 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
2686 !! options
2687 language=ca
2688 !! wikitext
2689 '''[[Main Page]]'''
2690 !! html
2691 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
2692 </p>
2693 !! end
2694
2695 !! test
2696 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
2697 !! options
2698 language=ca
2699 !! wikitext
2700 ''[[Main Page]]''
2701 !! html
2702 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
2703 </p>
2704 !! end
2705
2706 !! test
2707 Internal link with en linktrail: no apostrophes (T29473)
2708 !! options
2709 language=en
2710 !! wikitext
2711 [[Something]]'nice
2712 !! html/php
2713 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
2714 </p>
2715 !! html/parsoid
2716 <p><a rel="mw:WikiLink" href="./Something?action=edit&amp;redlink=1" title="Something" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Something"},"sa":{"href":"Something"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Something"]}}'>Something</a>'nice</p>
2717 !! end
2718
2719 !! test
2720 Internal link with ca linktrail with apostrophes (T29473)
2721 !! options
2722 language=ca
2723 !! wikitext
2724 [[Something]]'nice
2725 !! html/php
2726 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
2727 </p>
2728 !! html/parsoid
2729 <p><a rel="mw:WikiLink" href="./Something?action=edit&amp;redlink=1" title="Something" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Something"},"sa":{"href":"Something"},"tail":"&apos;nice"}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Something"]}}'>Something'nice</a></p>
2730 !! end
2731
2732 !! test
2733 Internal link with kaa linktrail with apostrophes (T29473)
2734 !! options
2735 language=kaa
2736 !! wikitext
2737 [[Something]]'nice
2738 !! html/php
2739 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmaǵan)">Something'nice</a>
2740 </p>
2741 !! html/parsoid
2742 <p><a rel="mw:WikiLink" href="./Something?action=edit&amp;redlink=1" title="Something" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Something"},"sa":{"href":"Something"},"tail":"&apos;nice"}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Something"]}}'>Something'nice</a></p>
2743 !! end
2744
2745 !! article
2746 User:Foo/Test/63636:Bar
2747 !! text
2748 Dummy article to suppress redlinks in tests
2749 !! end
2750
2751 !! test
2752 Link with multiple ":" in a subpage-supporting namespace (T65636)
2753 !! wikitext
2754 [[User:Foo/Test/63636:Bar|Test]]
2755 !! html/php
2756 <p><a href="/wiki/User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a>
2757 </p>
2758 !! html/parsoid
2759 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar" data-parsoid='{"stx":"piped","a":{"href":"./User:Foo/Test/63636:Bar"},"sa":{"href":"User:Foo/Test/63636:Bar"}}'>Test</a></p>
2760 !! end
2761
2762 ## Mainly a check for Parsoid
2763 !! test
2764 Handle title parsing for subpages
2765 !! options
2766 title=[[/123123]]
2767 subpage
2768 !! wikitext
2769 123
2770 !! html/php
2771 <p>123
2772 </p>
2773 !! html/parsoid
2774 <p>123</p>
2775 !! end
2776
2777 !! article
2778 User:Test/123
2779 !! text
2780 test 123
2781 !! endarticle
2782
2783 !! test
2784 Link to a subpage from a namespace other than main
2785 !! options
2786 title=[[User:Test]]
2787 subpage
2788 !! wikitext
2789 [[/123]]
2790 !! html/php
2791 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
2792 </p>
2793 !! html/parsoid
2794 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
2795 !! end
2796
2797 !! test
2798 Ensure that transclusion titles are not url-decoded
2799 !! options
2800 subpage title=[[Test]]
2801 parsoid=wt2html
2802 !! wikitext
2803 {{Bar%C3%A9}} {{/Bar%C3%A9}}
2804 !! html/php
2805 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
2806 </p>
2807 !! html/parsoid
2808 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
2809 !! end
2810
2811 !! test
2812 Purely hash wikilink
2813 !! options
2814 title=[[User:Test/123]]
2815 subpage
2816 !! wikitext
2817 [[#a|b]]
2818 !! html/php
2819 <p><a href="#a">b</a>
2820 </p>
2821 !! html/parsoid
2822 <p><a rel="mw:WikiLink" href="./User:Test/123#a" class="mw-selflink-fragment" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
2823 !! end
2824
2825 !! test
2826 Purely hash wikilink on file page
2827 !! options
2828 title=[[File:Foobar.jpg]]
2829 !! wikitext
2830 [[#a|b]]
2831 !! html/php
2832 <p><a href="#a">b</a>
2833 </p>
2834 !! html/parsoid
2835 <p><a rel="mw:WikiLink" href="./File:Foobar.jpg#a" class="mw-selflink-fragment" data-parsoid='{"stx":"piped","a":{"href":"./File:Foobar.jpg#a"},"sa":{"href":"#a"}}'>b</a></p>
2836 !! end
2837
2838 !! test
2839 Purely hash wikilink on category page
2840 !! options
2841 title=[[Category:Foobar]]
2842 !! wikitext
2843 [[#a|b]]
2844 !! html/php
2845 <p><a href="#a">b</a>
2846 </p>
2847 !! html/parsoid
2848 <p><a rel="mw:WikiLink" href="./Category:Foobar#a" class="mw-selflink-fragment" data-parsoid='{"stx":"piped","a":{"href":"./Category:Foobar#a"},"sa":{"href":"#a"}}'>b</a></p>
2849 !! end
2850
2851 !! test
2852 Serialization of purely hash wikilink
2853 !! options
2854 title=[[User:Test/123]]
2855 subpage
2856 parsoid=html2wt
2857 !! html/parsoid
2858 <p><a href="#a">[[</a></p>
2859 !! wikitext
2860 [[#a|<nowiki>[[</nowiki>]]
2861 !! html/php
2862 <p><a href="#a">[[</a>
2863 </p>
2864 !! end
2865
2866 !! test
2867 1. Interaction of linktrail and template encapsulation
2868 !! wikitext
2869 {{1x|[[Foo]]}}l
2870
2871 {{1x|[[Foo]]l}}
2872
2873 {{1x|[[Foo]]l}}s
2874
2875 {{1x|[[Foo]]<span>ls</span>}}
2876
2877 [[{{1x|Foo}}]]l
2878 !! html/php
2879 <p><a href="/wiki/Foo" title="Foo">Fool</a>
2880 </p><p><a href="/wiki/Foo" title="Foo">Fool</a>
2881 </p><p><a href="/wiki/Foo" title="Foo">Fools</a>
2882 </p><p><a href="/wiki/Foo" title="Foo">Foo</a><span>ls</span>
2883 </p><p><a href="/wiki/Foo" title="Foo">Fool</a>
2884 </p>
2885 !! html/parsoid
2886 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"Foo"},"pi":[[{"k":"1"}]],"tail":"l"}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
2887
2888 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"Foo"},"pi":[[{"k":"1"}]],"tail":"l"}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[Foo]]l"}},"i":0}}]}'>Fool</a></p>
2889
2890 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"Foo"},"pi":[[{"k":"1"}]],"tail":"ls"}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[Foo]]l"}},"i":0}},"s"]}'>Fools</a></p>
2891
2892 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" about="#mwt4" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"Foo"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[Foo]]&lt;span>ls&lt;/span>"}},"i":0}}]}'>Foo</a><span about="#mwt4">ls</span></p>
2893
2894 <p><a typeof="mw:ExpandedAttrs" about="#mwt6" rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"{{1x|Foo}}"},"tail":"l"}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt5\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[85,95,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&apos;>Foo&lt;/span>"}]]}'>Fool</a></p>
2895 !! end
2896
2897 !! article
2898 Fool
2899 !! text
2900 Dummy article to suppress redlinks in tests
2901 !! end
2902
2903 !! test
2904 2. Interaction of linktrail and template encapsulation
2905 !! wikitext
2906 {{1x|Some [[Fool]]}}s
2907 !! html/php
2908 <p>Some <a href="/wiki/Fool" title="Fool">Fools</a>
2909 </p>
2910 !! html/parsoid
2911 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}'>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>
2912 !! end
2913
2914 !! test
2915 3. Interaction of linktrail and template encapsulation
2916 !! wikitext
2917 {{1x|Some [[Fool]]s are '''bold and foolish'''}}
2918 !! html/php
2919 <p>Some <a href="/wiki/Fool" title="Fool">Fools</a> are <b>bold and foolish</b>
2920 </p>
2921 !! html/parsoid
2922 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"Some [[Fool]]s are &apos;&apos;&apos;bold and foolish&apos;&apos;&apos;"}},"i":0}}]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1">Fools</a><span about="#mwt1"> are </span><b about="#mwt1">bold and foolish</b></p>
2923 !! end
2924
2925 !! article
2926 Söfnuður
2927 !! text
2928 Test.
2929 !! endarticle
2930
2931 !! test
2932 Internal link with is link prefix
2933 !! options
2934 language=is
2935 !! wikitext
2936 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
2937 {{1x|mótmælenda[[söfnuður|söfnuðir]]}}
2938 mótmæ{{1x|lenda[[söfnuður|söfnuðir]]}}
2939 !! html/php
2940 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
2941 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
2942 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
2943 </p>
2944 !! html/parsoid
2945 <p>Aðrir <a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður" data-parsoid='{"stx":"piped","a":{"href":"./Söfnuður"},"sa":{"href":"söfnuður"},"prefix":"mótmælenda"}'>mótmælendasöfnuðir</a> og
2946 <a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"piped","a":{"href":"./Söfnuður"},"sa":{"href":"söfnuður"},"prefix":"mótmælenda"}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Snið:1x"},"params":{"1":{"wt":"mótmælenda[[söfnuður|söfnuðir]]"}},"i":0}}]}'>mótmælendasöfnuðir</a>
2947 <a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"piped","a":{"href":"./Söfnuður"},"sa":{"href":"söfnuður"},"prefix":"mótmælenda"}' data-mw='{"parts":["mótmæ",{"template":{"target":{"wt":"1x","href":"./Snið:1x"},"params":{"1":{"wt":"lenda[[söfnuður|söfnuðir]]"}},"i":0}}]}'>mótmælendasöfnuðir</a></p>
2948 !! end
2949
2950 !! article
2951 Mótmælendatrú
2952 !! text
2953 Test.
2954 !! endarticle
2955
2956 !! test
2957 Internal link with is link trail and link prefix
2958 !! options
2959 language=is
2960 !! wikitext
2961 [[mótmælendatrú|xxx]]ar
2962 [[mótmælendatrú]]ar
2963 mótmælenda[[söfnuður]]
2964 mótmælenda[[söfnuður|söfnuðir]]
2965 mótmælenda[[söfnuður|söfnuðir]]xxx
2966 !! html
2967 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
2968 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
2969 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
2970 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
2971 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
2972 </p>
2973 !! end
2974
2975 !! test
2976 Parsoid link trail escaping
2977 !! options
2978 parsoid=html2wt,html2html
2979 !! html/parsoid
2980 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
2981 !! wikitext
2982 [[apple]]<nowiki/>s
2983 !! end
2984
2985 !! test
2986 Parsoid link prefix escaping
2987 !! options
2988 language=is
2989 parsoid=html2wt,html2html
2990 !! html/parsoid
2991 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
2992 !! wikitext
2993 Aðrir mótmælenda<nowiki/>[[söfnuður]]
2994 !! end
2995
2996 !! test
2997 Parsoid link bracket escaping
2998 !! options
2999 parsoid=html2wt,html2html
3000 !! html/parsoid
3001 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
3002 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
3003 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
3004 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
3005 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
3006 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
3007 !! wikitext
3008 [[Test]]
3009
3010 [<nowiki/>[[Test]]]
3011
3012 [[[[Test]]]]
3013
3014 [[[<nowiki/>[[Test]]]]]
3015
3016 [[[[[[Test]]]]]]
3017
3018 [[[[[<nowiki/>[[Test]]]]]]]
3019 !! end
3020
3021 !! test
3022 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
3023 !! wikitext
3024 [[Foo| bar]]
3025
3026 [[Foo| ''bar'']]
3027
3028 [http://wp.org foo]
3029
3030 [http://wp.org ''foo'']
3031 !! html
3032 <p><a href="/wiki/Foo" title="Foo"> bar</a>
3033 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
3034 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
3035 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
3036 </p>
3037 !! end
3038
3039 !! test
3040 Parsoid: Scoped parsing should handle mixed transclusions and plain text
3041 !! wikitext
3042 [[Foo|{{1x|a}} b {{1x|c}}]]
3043 !! html/parsoid
3044 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
3045 !! end
3046
3047 !! test
3048 Link with angle bracket after anchor
3049 !! config
3050 wgFragmentMode=[ "html5", "legacy" ]
3051 !! wikitext
3052 [[Foo#<bar>]]
3053 !! html/php
3054 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
3055 </p>
3056 !! html/parsoid
3057 <p><a rel="mw:WikiLink" href="./Foo#&lt;bar>" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#&lt;bar>"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
3058 !! end
3059
3060 !! test
3061 Link with angle bracket after anchor (legacy)
3062 !! config
3063 wgFragmentMode=[ "legacy" ]
3064 !! wikitext
3065 [[Foo#<bar>]]
3066 !! html/php
3067 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
3068 </p>
3069 !! end
3070
3071 !! article
3072 Ho
3073 !! text
3074 Dummy article to suppress redlinks in tests
3075 !! end
3076
3077 !! test
3078 Wikilink in wikilink
3079 !! wikitext
3080 [[Hi|[[Ho]]]]
3081 !! html/php
3082 <p>[[Hi|<a href="/wiki/Ho" title="Ho">Ho</a>]]
3083 </p>
3084 !! html/parsoid
3085 <p>[[Hi|<a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"stx":"simple","a":{"href":"./Ho"},"sa":{"href":"Ho"}}'>Ho</a>]]</p>
3086 !! end
3087
3088
3089 !! test
3090 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
3091 !! options
3092 language=ln
3093 !! wikitext
3094 [[WW&nbsp;II]]
3095 !! html/php
3096 <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>
3097 </p>
3098 !! html/parsoid
3099 <p><a rel="mw:WikiLink" href="./WW_II?action=edit&amp;redlink=1" title="WW II" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./WW_II"},"sa":{"href":"WW&amp;nbsp;II"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["WW II"]}}'>WW II</a></p>
3100 !! end
3101
3102 !! test
3103 Parsoid T55221: Wikilinks should be properly entity-escaped
3104 !! options
3105 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
3106 !! html/parsoid
3107 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
3108 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
3109 !! wikitext
3110 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
3111
3112 He&amp;nbsp;llo He&amp;nbsp;llo
3113 !! html/php
3114 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
3115 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
3116 </p>
3117 !! end
3118
3119 !! article
3120 16:30
3121 !! text
3122 Dummy article to suppress redlinks in tests
3123 !! end
3124
3125 !! test
3126 Wikilinks with : should roundtrip correctly, with and without redlinks
3127 !! wikitext
3128 [[16:30]]
3129 [[18:30]]
3130 !! html/parsoid
3131 <p><a rel="mw:WikiLink" href="./16:30" title="16:30" data-parsoid='{"stx":"simple","a":{"href":"./16:30"},"sa":{"href":"16:30"}}'>16:30</a>
3132 <a rel="mw:WikiLink" href="./18:30?action=edit&amp;redlink=1" title="18:30" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./18:30"},"sa":{"href":"18:30"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["18:30"]}}'>18:30</a></p>
3133 !! end
3134
3135 # html2wt will fail because of title normalization without data-parsoid
3136 !! test
3137 Parsoid: handle constructor well
3138 !! options
3139 parsoid=wt2html,wt2wt
3140 !! wikitext
3141 [[constructor]]
3142
3143 [[constructor:foo]]
3144 !! html/php
3145 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
3146 </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>
3147 </p>
3148 !! html/parsoid
3149 <p><a rel="mw:WikiLink" href="./Constructor?action=edit&amp;redlink=1" title="Constructor" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Constructor"]}}'>constructor</a></p>
3150
3151 <p><a rel="mw:WikiLink" href="./Constructor:foo?action=edit&amp;redlink=1" title="Constructor:foo" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Constructor:foo"]}}'>constructor:foo</a></p>
3152 !! end
3153
3154 !! test
3155 Template parameter named "constructor"
3156 !! wikitext
3157 {{1x| constructor = |hi}}
3158 !! html/parsoid
3159 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"constructor","named":true,"spc":[" "," ",""," "]},{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"constructor":{"wt":""},"1":{"wt":"hi"}},"i":0}}]}'>hi</span></p>
3160 !! end
3161
3162 ##
3163 ## XHTML tidiness
3164 ###
3165
3166 !! test
3167 <br> to <br />
3168 !! wikitext
3169 1<br>2<br />3
3170 !! html
3171 <p>1<br />2<br />3
3172 </p>
3173 !! end
3174
3175 !! test
3176 Broken br tag sanitization
3177 !! options
3178 parsoid=wt2html,html2html
3179 !! wikitext
3180 </br>
3181 !! html/php
3182 <p><br />
3183 </p>
3184 !! html/parsoid
3185 <p><br data-parsoid='{"stx":"html","noClose":true}'/></p>
3186 !! end
3187
3188 # TODO: Fix html2html mode (T53055)!
3189 !! test
3190 Parsoid: Broken br tag recognition
3191 !! options
3192 parsoid=wt2html
3193 !! wikitext
3194 </br>
3195
3196 <br/ >
3197 !! html
3198 <p><br />
3199 </p><p><br />
3200 </p>
3201 !! end
3202
3203 !! test
3204 Incorrecly removing closing slashes from correctly formed XHTML
3205 !! wikitext
3206 <br style="clear:both;" />
3207 !! html
3208 <p><br style="clear:both;" />
3209 </p>
3210 !! end
3211
3212 !! test
3213 Failing to transform badly formed HTML into correct XHTML
3214 !! wikitext
3215 <br style="clear: left;">
3216 <br style="clear: right;">
3217 <br style="clear: both;">
3218 !! html
3219 <p><br style="clear: left;" />
3220 <br style="clear: right;" />
3221 <br style="clear: both;" />
3222 </p>
3223 !!end
3224
3225 ## Parsoid's behavior w/ self-closing HTML tags is now a bug;
3226 ## see T134423. Legacy Parser now implements proper HTML5 semantics.
3227 !! test
3228 Handling html with a div self-closing tag
3229 !! wikitext
3230 <div title />
3231 <div title/>
3232 <div title/ >
3233 <div title=bar />
3234 <div title=bar/>
3235 <div title=bar/ >
3236 !! html
3237 <div title="">
3238 <div title="">
3239 <div title="">
3240 <div title="bar">
3241 <div title="bar">
3242 <div title="bar/"></div></div></div></div></div></div>
3243 !! end
3244
3245 !! test
3246 Elements with solidus in various attribute positions
3247 !! options
3248 parsoid=wt2html,html2html
3249 !! wikitext
3250 <div cla/ss="123">ha</div>
3251
3252 <div / class="123">ha</div>
3253
3254 <div class= / "123">ha</div>
3255 !! html/php
3256 <div>ha</div>
3257 <div class="123">ha</div>
3258 <div class="/">ha</div>
3259 !! html/parsoid
3260 <div data-parsoid='{"stx":"html","a":{"cla":null,"ss":null},"sa":{"cla":"","ss":"123"}}'>ha</div>
3261
3262 <div class="123" data-parsoid='{"stx":"html"}'>ha</div>
3263
3264 <div class="/" data-parsoid='{"stx":"html","a":{"\"123\"":null},"sa":{"\"123\"":""}}'>ha</div>
3265 !! end
3266
3267 !! test
3268 Handling html with a br self-closing tag
3269 !! wikitext
3270 <br title />
3271 <br title/>
3272 <br title/ >
3273 <br title=bar />
3274 <br title=bar/>
3275 <br title=bar/ >
3276 !! html/php
3277 <p><br title="" />
3278 <br title="" />
3279 <br title="" />
3280 <br title="bar" />
3281 <br title="bar" />
3282 <br title="bar/" />
3283 </p>
3284 !! html/parsoid
3285 <p><br title="" />
3286 <br title="" />
3287 <br title="" />
3288 <br title="bar" />
3289 <br title="bar" />
3290 <br title="bar/" />
3291 </p>
3292 !! end
3293
3294 !! test
3295 Quoted attributes without spaces
3296 !! options
3297 parsoid=wt2html
3298 !! wikitext
3299 <div class="foo"style="color:red">red</div>
3300 !! html/php
3301 <div class="foo" style="color:red">red</div>
3302 !! html/parsoid
3303 <div class="foo" style="color:red">red</div>
3304 !! end
3305
3306 !! test
3307 Horizontal ruler (should it add that extra space?)
3308 !! wikitext
3309 <hr>
3310 <hr >
3311 foo <hr
3312 > bar
3313 !! html/php
3314 <hr />
3315 <hr /><p>
3316 foo </p><hr /><p> bar</p>
3317 !! html/parsoid
3318 <hr data-parsoid='{"stx":"html","noClose":true}'/>
3319 <hr data-parsoid='{"stx":"html","noClose":true}'/><p>
3320 foo </p><hr data-parsoid='{"stx":"html","noClose":true}'/><p> bar</p>
3321 !! end
3322
3323 !! test
3324 Horizontal ruler -- 4+ dashes render hr
3325 !! wikitext
3326 ----
3327 !! html
3328 <hr />
3329 !! end
3330
3331 !! test
3332 Horizontal ruler -- eats additional dashes on the same line
3333 !! wikitext
3334 ---------
3335 !! html
3336 <hr />
3337 !! end
3338
3339 !! test
3340 Horizontal ruler -- does not collapse dashes on consecutive lines
3341 !! wikitext
3342 ----
3343 ----
3344 !! html
3345 <hr />
3346 <hr />
3347 !! end
3348
3349 !! test
3350 Horizontal ruler -- <4 dashes render as plain text
3351 !! wikitext
3352 ---
3353 !! html
3354 <p>---
3355 </p>
3356 !! end
3357
3358 !! test
3359 Horizontal ruler -- Supports content following dashes on same line
3360 !! wikitext
3361 ---- Foo
3362 !! html/php
3363 <hr /><p> Foo</p>
3364 !! html/parsoid
3365 <hr data-parsoid='{"lineContent":true}'/><p> Foo</p>
3366 !! end
3367
3368 ###
3369 ### Block-level elements
3370 ###
3371 !! test
3372 Common list
3373 !! wikitext
3374 *Common list
3375 *item 2
3376 *item 3
3377 !! html
3378 <ul><li>Common list</li>
3379 <li>item 2</li>
3380 <li>item 3</li></ul>
3381 !! end
3382
3383 !! test
3384 Numbered list
3385 !! wikitext
3386 #Numbered list
3387 #item 2
3388 #item 3
3389 !! html
3390 <ol><li>Numbered list</li>
3391 <li>item 2</li>
3392 <li>item 3</li></ol>
3393 !! end
3394
3395 # the switch from level 3 to ordered should not introduce a newline between
3396 !! test
3397 Mixed list
3398 !! wikitext
3399 *Mixed list
3400 *#with numbers
3401 **and bullets
3402 *#and numbers
3403 *bullets again
3404 **bullet level 2
3405 ***bullet level 3
3406 ***#Number on level 4
3407 **bullet level 2
3408 **#Number on level 3
3409 **#Number on level 3
3410 *#number level 2
3411 *Level 1
3412 ***Level 3
3413 #**Level 3, but ordered
3414 !! html
3415 <ul><li>Mixed list
3416 <ol><li>with numbers</li></ol>
3417 <ul><li>and bullets</li></ul>
3418 <ol><li>and numbers</li></ol></li>
3419 <li>bullets again
3420 <ul><li>bullet level 2
3421 <ul><li>bullet level 3
3422 <ol><li>Number on level 4</li></ol></li></ul></li>
3423 <li>bullet level 2
3424 <ol><li>Number on level 3</li>
3425 <li>Number on level 3</li></ol></li></ul>
3426 <ol><li>number level 2</li></ol></li>
3427 <li>Level 1
3428 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
3429 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
3430 !! end
3431
3432 !! test
3433 1. Nested mixed wikitext and html list
3434 !! wikitext
3435 *hi
3436 *<ul><li>ho</li></ul>
3437 *hi
3438 **ho
3439 !! html/php
3440 <ul><li>hi</li>
3441 <li><ul><li>ho</li></ul></li>
3442 <li>hi
3443 <ul><li>ho</li></ul></li></ul>
3444 !! html/parsoid
3445 <ul><li>hi</li>
3446 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
3447 <li>hi
3448 <ul><li>ho</li></ul></li></ul>
3449 !! end
3450
3451 !! test
3452 2. Nested mixed wikitext and html list (incompatible)
3453 !! wikitext
3454 ;hi
3455 :{{1x|<li>ho</li>}}
3456 !! html/php
3457 <dl><dt>hi</dt>
3458 <dd><li>ho</li></dd></dl>
3459 !! html/parsoid
3460 <dl><dt>hi</dt>
3461 <dd><li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
3462 !! end
3463
3464 !! test
3465 Nested lists 1
3466 !! wikitext
3467 *foo
3468 **bar
3469 !! html
3470 <ul><li>foo
3471 <ul><li>bar</li></ul></li></ul>
3472 !! end
3473
3474 !! test
3475 Nested lists 2
3476 !! wikitext
3477 **foo
3478 *bar
3479 !! html
3480 <ul><li><ul><li>foo</li></ul></li>
3481 <li>bar</li></ul>
3482 !! end
3483
3484 !! test
3485 Nested lists 3 (first element empty)
3486 !! wikitext
3487 *
3488 **bar
3489 !! html
3490 <ul><li>
3491 <ul><li>bar</li></ul></li></ul>
3492 !! end
3493
3494 !! test
3495 Nested lists 4 (first element empty)
3496 !! wikitext
3497 **
3498 *bar
3499 !! html
3500 <ul><li><ul><li class="mw-empty-elt"></li></ul></li>
3501 <li>bar</li></ul>
3502 !! end
3503
3504 !! test
3505 Nested lists 5 (both elements empty)
3506 !! wikitext
3507 **
3508 *
3509 !! html
3510 <ul><li><ul><li class="mw-empty-elt"></li></ul></li>
3511 <li class="mw-empty-elt"></li></ul>
3512 !! end
3513
3514 !! test
3515 Nested lists 6 (both elements empty)
3516 !! wikitext
3517 *
3518 **
3519 !! html
3520 <ul><li>
3521 <ul><li class="mw-empty-elt"></li></ul></li></ul>
3522 !! end
3523
3524 !! test
3525 Nested lists 7 (skip initial nesting levels)
3526 !! wikitext
3527 ***foo
3528 !! html
3529 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
3530 !! end
3531
3532 !! test
3533 Nested lists 8 (multiple nesting transitions)
3534 !! wikitext
3535 *foo
3536 ***bar
3537 **baz
3538 *boo
3539 !! html
3540 <ul><li>foo
3541 <ul><li><ul><li>bar</li></ul></li>
3542 <li>baz</li></ul></li>
3543 <li>boo</li></ul>
3544 !! end
3545
3546 !! test
3547 Nested lists 9 (extension interaction)
3548 !! wikitext
3549 *<tag />
3550 !! html/php
3551 <ul><li><pre></pre></li></ul>
3552 <p>NULL
3553 array (
3554 )
3555 </p>
3556 !! html/parsoid
3557 <ul><li data-parsoid='{}'><pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{"dsr":[1,8,7,0]}' data-mw='{"name":"tag","attrs":{}}'>NULL
3558 array (
3559 )
3560 </pre></li></ul>
3561 !! end
3562
3563 !! test
3564 Nested lists 10 (list and span siblings: wt2wt regression)
3565 !! wikitext
3566 *a <span>x</span>
3567 **b <span>y</span>
3568 !! html/parsoid
3569 <ul><li>a <span>x</span>
3570 <ul><li>b <span>y</span></li></ul></li></ul>
3571 !! end
3572
3573 !! test
3574 Nested lists 11 (T262409: trailing whitespace & selser)
3575 !! options
3576 parsoid={
3577 "modes": ["wt2html","selser"],
3578 "changes": [
3579 [ "ul > li > ul > li > ul > li", "after", "<li>b-new</li>" ]
3580 ]
3581 }
3582 !! wikitext
3583 **a
3584 ***b
3585 !! html/parsoid
3586 <ul><li><ul><li>a
3587 <ul><li>b</li></ul></li></ul></li></ul>
3588 !! wikitext/edited
3589 **a
3590 ***b
3591 *** b-new
3592 !! end
3593
3594 !! test
3595 1. Lists and block-element interaction
3596 !! options
3597 parsoid=wt2html,selser
3598 !! wikitext
3599 *<div>a
3600 *b
3601 </div>ಕ
3602 !! html/php
3603 <ul><li><div>a</div></li>
3604 <li>b</li></ul>
3605 <p>ಕ</p>
3606 !! html/parsoid
3607 <ul><li><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></li>
3608 <li>b</li></ul>
3609 <p>ಕ</p>
3610 !! end
3611
3612 !! test
3613 2. Lists and block-element interaction
3614 !! options
3615 parsoid=wt2html,selser
3616 !! wikitext
3617 *{{1x|<div>a
3618 *b
3619 }}</div>ಕ
3620 !! html/php
3621 <ul><li><div>a</div></li>
3622 <li>b</li></ul>
3623 <p>ಕ</p>
3624 !! html/parsoid
3625 <ul about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"firstWikitextNode":"UL","pi":[[{"k":"1"}]]}' data-mw='{"parts":["*",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;div>a\n*b\n"}},"i":0}}]}'><li><div>a</div></li>
3626 <li>b</li></ul><span about="#mwt1">
3627 </span><p>ಕ</p>
3628 !! end
3629
3630 !! test
3631 1. Lists with start-of-line-transparent tokens before bullets: Comments
3632 !! wikitext
3633 *foo
3634 *<!--cmt-->bar
3635 <!--cmt-->*baz
3636 !! html
3637 <ul><li>foo</li>
3638 <li>bar</li>
3639 <li>baz</li></ul>
3640 !! html/parsoid
3641 <ul><li>foo</li>
3642 <li><!--cmt-->bar</li>
3643 <!--cmt--><li>baz</li></ul>
3644 !! end
3645
3646 # Parsoid handles this case differently from the legacy parser, as a side
3647 # effect of handling SOL state in the tokenizer.
3648 !! test
3649 2. Lists with start-of-line-transparent tokens before bullets: Template close
3650 !! wikitext
3651 *foo {{1x|bar
3652 }}*baz
3653 !! html/php
3654 <ul><li>foo bar</li>
3655 <li>baz</li></ul>
3656 !! html/parsoid
3657 <ul about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"firstWikitextNode":"UL","pi":[[{"k":"1"}]]}' data-mw='{"parts":["*foo ",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"bar\n"}},"i":0}}]}'><li>foo bar</li><li about="#mwt1">
3658 baz</li></ul>
3659 !! end
3660
3661 !! test
3662 List items are not parsed correctly following a <pre> block (T2785)
3663 !! wikitext
3664 *<pre>foo</pre>
3665 *<pre>bar</pre>
3666 *zar
3667 !! html/php
3668 <ul><li><pre>foo</pre></li>
3669 <li><pre>bar</pre></li>
3670 <li>zar</li></ul>
3671 !! html/parsoid
3672 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
3673 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
3674 <li>zar</li></ul>
3675 !! end
3676
3677 !! test
3678 List items from template
3679 !! wikitext
3680
3681 {{inner list}}
3682 *item 2
3683
3684 *item 0
3685 {{inner list}}
3686 *item 2
3687
3688 *item 0
3689 *notSOL{{inner list}}
3690 *item 2
3691 !! html/php
3692 <ul><li>item 1</li>
3693 <li>item 2</li></ul>
3694 <ul><li>item 0</li>
3695 <li>item 1</li>
3696 <li>item 2</li></ul>
3697 <ul><li>item 0</li>
3698 <li>notSOL</li>
3699 <li>item 1</li>
3700 <li>item 2</li></ul>
3701 !! html/parsoid
3702 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"inner list","href":"./Template:Inner_list"},"params":{},"i":0}},"\n*item 2"]}'><li>item 1</li>
3703 <li>item 2</li></ul>
3704
3705 <ul><li>item 0</li>
3706 <li about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"inner list","href":"./Template:Inner_list"},"params":{},"i":0}}]}'>item 1</li>
3707 <li>item 2</li></ul>
3708
3709 <ul><li>item 0</li>
3710 <li>notSOL</li><span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"inner list","href":"./Template:Inner_list"},"params":{},"i":0}}]}'>
3711 </span><li about="#mwt3">item 1</li>
3712 <li>item 2</li></ul>
3713 !! end
3714
3715 !! test
3716 List interrupted by empty line or heading
3717 !! config
3718 wgParserEnableLegacyHeadingDOM=false
3719 !! wikitext
3720 *foo
3721
3722 **bar
3723 ==A heading==
3724 *Another list item
3725 !! html
3726 <ul><li>foo</li></ul>
3727 <ul><li><ul><li>bar</li></ul></li></ul>
3728 <div class="mw-heading mw-heading2"><h2 id="A_heading">A heading</h2><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></div>
3729 <ul><li>Another list item</li></ul>
3730 !! html/parsoid
3731 <ul><li>foo</li></ul>
3732
3733 <ul><li><ul><li>bar</li></ul></li></ul>
3734 <h2 id="A_heading">A heading</h2>
3735 <ul><li>Another list item</li></ul>
3736 !!end
3737
3738 !! test
3739 Multiple list tags generated by templates
3740 !! wikitext
3741 {{1x|<li>}}a
3742 {{1x|<li>}}b
3743 {{1x|<li>}}c
3744 !! html/php
3745 <li>a
3746 </li><li>b
3747 </li><li>c</li>
3748 !! html/parsoid
3749 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"a"]}'>a</li>
3750 <li about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"b"]}'>b</li>
3751 <li about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"c"]}'>c</li>
3752 !! end
3753
3754 !! test
3755 Multiple newlines in between HTML list items don't induce paragraph wrapping
3756 !! wikitext
3757 <ul>
3758 <li>hi</li>
3759
3760
3761
3762
3763 <li>ho</li>
3764 </ul>
3765
3766 <dl>
3767 <dt>hi</dt>
3768 <dd>ho<div>123</div>
3769 </dd>
3770
3771
3772 </dl>
3773 !! html/php
3774 <ul>
3775 <li>hi</li>
3776
3777
3778
3779
3780 <li>ho</li>
3781 </ul>
3782 <dl>
3783 <dt>hi</dt>
3784 <dd>ho<div>123</div>
3785 </dd>
3786
3787
3788 </dl>
3789 !! end
3790
3791 !!test
3792 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
3793 !! wikitext
3794 *a
3795 <!--This line will NOT split the list-->
3796 *b
3797 <!--This line will NOT split the list either-->
3798 *c
3799 <!--foo--> <!----> <!--This line NOT split the list either-->
3800 *d
3801 !! html
3802 <ul><li>a</li>
3803 <li>b</li>
3804 <li>c</li>
3805 <li>d</li></ul>
3806 !!end
3807
3808 !!test
3809 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
3810 !! wikitext
3811 *a
3812 <!--This line will NOT split the list-->
3813 *b
3814 <!--This line will NOT split the list either-->
3815 *c
3816 <!--foo--> <!----> <!--This line NOT split the list
3817 either-->
3818 *d
3819 !! html
3820 <ul><li>a</li>
3821 <li>b</li>
3822 <li>c</li>
3823 <li>d</li></ul>
3824 !!end
3825
3826 ## FIXME: This test could possibly be renamed / simplified since this is
3827 ## no longer a hack and works as expected without any special handling.
3828 !!test
3829 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
3830 !!options
3831 parsoid=wt2html,wt2wt
3832 !! wikitext
3833 *foo
3834 *<li>li-hack
3835 **bar1
3836 *{{1x|<li>templated li-hack}}
3837 **bar2
3838 *<!--foo--><li> unsupported li-hack with preceding comments
3839
3840 <ul>
3841 <li><li>not a li-hack
3842 </li>
3843 </ul>
3844 !! html/php
3845 <ul><li>foo</li>
3846 <li class="mw-empty-elt"></li><li>li-hack
3847 <ul><li>bar1</li></ul></li>
3848 <li class="mw-empty-elt"></li><li>templated li-hack
3849 <ul><li>bar2</li></ul></li>
3850 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
3851 <ul>
3852 <li class="mw-empty-elt"></li><li>not a li-hack
3853 </li>
3854 </ul>
3855 !! html/parsoid
3856 <ul><li>foo</li>
3857 <li class="mw-empty-elt"></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>li-hack
3858 <ul><li>bar1</li></ul></li>
3859 <li class="mw-empty-elt"></li><li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;li>templated li-hack"}},"i":0}},"\n**bar2"]}'>templated li-hack
3860 <ul><li>bar2</li></ul></li>
3861 <li class="mw-empty-elt"><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'> unsupported li-hack with preceding comments</li></ul>
3862
3863 <ul data-parsoid='{"stx":"html"}'>
3864 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
3865 </li>
3866 </ul>
3867 !! end
3868
3869 !! test
3870 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
3871 !! wikitext
3872 #foo
3873 ##bar
3874
3875 *foo
3876 **bar
3877
3878 :foo
3879 ::bar
3880 !! html/php
3881 <ol><li>foo
3882 <ol><li>bar</li></ol></li></ol>
3883 <ul><li>foo
3884 <ul><li>bar</li></ul></li></ul>
3885 <dl><dd>foo
3886 <dl><dd>bar</dd></dl></dd></dl>
3887 !! html/parsoid
3888 <ol>
3889 <li>foo<ol>
3890 <li>bar</li>
3891 </ol></li>
3892 </ol><ul>
3893 <li>foo<ul>
3894 <li>bar</li>
3895 </ul></li>
3896 </ul><dl>
3897 <dd>foo<dl>
3898 <dd>bar</dd>
3899 </dl></dd>
3900 </dl>
3901 !! end
3902
3903 !! test
3904 Parsoid: Test of whitespace serialization with Templated bullets
3905 !! options
3906 parsoid=wt2html
3907 !! wikitext
3908 * {{bullet}}
3909 !! html/php
3910 <ul><li class="mw-empty-elt"></li>
3911 <li>Bar</li></ul>
3912 !! html/parsoid
3913 <ul><li class="mw-empty-elt"></li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'>
3914 </span><li about="#mwt1">Bar</li></ul>
3915 !! end
3916
3917 # ------------------------------------------------------------------------
3918 # The next set of tests are about Parsoid's ability to handle badly nested
3919 # tags (parse, minimize scope of fixup, and roundtrip back)
3920 # ------------------------------------------------------------------------
3921
3922 !! test
3923 Unbalanced closing block tags break a list
3924 !! wikitext
3925 <div>
3926 *a</div><div>
3927 *b</div>
3928 !! html/php
3929 <div>
3930 <ul><li>a</li></ul></div><div>
3931 <li>b</li></div>
3932 !! html/parsoid
3933 <div><ul>
3934 <li>a</li>
3935 </ul></div>
3936 <div><ul>
3937 <li>b</li>
3938 </ul></div>
3939 !! end
3940
3941 ## We call this "wikitext block" because we're diverging a bit from the HTML5
3942 ## parsing spec. Remex output is because it doesn't need to generate the
3943 ## implied end tag for the list item when encountering the closing </p> but
3944 ## Parsoid's broader definition opts to. This can happen for a number of other
3945 ## tags but those aren't allowed literal tags in wikitext. There's also the
3946 ## opposite problem, where the wikitext blocks aren't a superset of the tags
3947 ## that generate implied ends in HTML5, but the missing ones again aren't
3948 ## allowed literal tags in wikitext.
3949 !! test
3950 Unbalanced closing wikitext block tags break a list
3951 !! wikitext
3952 <p>
3953 *a</p><p>
3954 *b</p>
3955 !! html/php
3956 <p class="mw-empty-elt">
3957 </p><ul><li>a<p class="mw-empty-elt"></p><p class="mw-empty-elt"></p></li>
3958 <li>b<p class="mw-empty-elt"></p></li></ul>
3959 !! html/parsoid
3960 <p class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p>
3961 <ul><li>a</li></ul><p class="mw-empty-elt" data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p><p class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p>
3962 <ul><li>b</li></ul><p class="mw-empty-elt" data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
3963 !! end
3964
3965 !! test
3966 Unbalanced closing non-block tags don't break a list
3967 !! options
3968 parsoid=wt2html,html2html
3969 !! wikitext
3970 <span>
3971 *a</span><span>
3972 *b</span>
3973 !! html/php
3974 <p><span>
3975 </span></p>
3976 <ul><li>a<span></span></li>
3977 <li>b</li></ul>
3978 !! html/parsoid
3979 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
3980 <ul><li>a<meta typeof="mw:Placeholder/StrippedTag" data-parsoid='{"src":"&lt;/span>","name":"span"}'/><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
3981 <li>b<meta typeof="mw:Placeholder/StrippedTag" data-parsoid='{"src":"&lt;/span>","name":"span"}'/></li></ul>
3982 !! end
3983
3984 ## The legacy parser output matches the HTML5 spec, the token is ignored.
3985 ## Parsoid's ListHandler doesn't track open elements outside of the list frame
3986 ## so the token induces an implied end to the list. Considering that Parsoid
3987 ## already diverges from the HTML5 spec in which tag names induce implied ends
3988 ## (see the discussion above about "wikitext block"), we accept this edge case
3989 ## as a known difference.
3990 !! test
3991 T368721: Closing block tags not on the stack of open elements in lists
3992 !! wikitext
3993 <!-- block tag -->
3994 *a</div>b
3995
3996 <!-- wikitext block tag -->
3997 *a</p>b
3998 !! html/php
3999 <ul><li>ab</li></ul>
4000 <ul><li>a<p class="mw-empty-elt"></p>b</li></ul>
4001 !! html/parsoid
4002 <!-- block tag -->
4003 <ul><li>a</li></ul><p>b</p>
4004
4005 <!-- wikitext block tag -->
4006 <ul><li>a</li></ul><p class="mw-empty-elt" data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p><p>b</p>
4007 !! end
4008
4009 # Parsoid does some post-dom-building cleanup
4010 # which is why its output differs from Remex.
4011 !! test
4012 Unclosed formatting tags that straddle lists are closed and reopened
4013 !! options
4014 parsoid=wt2html,wt2wt,html2html
4015 !! wikitext
4016 #<s> a
4017 #b </s>
4018 !! html/php
4019 <ol><li><s> a</s></li><s>
4020 </s><li><s>b </s></li></ol>
4021 !! html/parsoid
4022 <ol><li><s> a</s></li>
4023 <li><s>b </s></li></ol>
4024 !! end
4025
4026 # Output is ugly because of all the misnested tag fixups.
4027 !! test
4028 1. List embedded in a formatting tag
4029 !! wikitext
4030 <small>
4031 *foo
4032 </small>
4033 !! html/php
4034 <p><small>
4035 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
4036 </p>
4037 !! html/parsoid
4038 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
4039 <ul><li data-parsoid='{}'>foo</li></ul></small>
4040 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
4041 !! end
4042
4043 # Output is ugly because of all the misnested tag fixups.
4044 !! test
4045 2. List embedded in a formatting tag in a misnested way
4046 !! wikitext
4047 <small>
4048 *a
4049 *b</small>
4050 !! html/php
4051 <p><small>
4052 </small></p><small></small><ul><small><li>a</li>
4053 </small><li><small>b</small></li></ul>
4054 !! html/parsoid
4055 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
4056 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
4057 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
4058 !! end
4059
4060 # Output is ugly because of all the misnested tag fixups.
4061 !! test
4062 3. List embedded in a formatting tag in a misnested way
4063 !! wikitext
4064 <small>
4065
4066 ** 123</small>
4067 !! html/php
4068 <p><small>
4069 </small></p><small></small><ul><small></small><li><small></small><ul><small></small><li><small>123</small></li></ul></li></ul>
4070 !! html/parsoid
4071 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
4072
4073 <ul><li><ul><li data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedStart":true}'> 123</small></li></ul></li></ul>
4074 !! end
4075
4076 !! test
4077 Parsoid: unknown parser function (T314524)
4078 !! wikitext
4079 {{#tag:b|This is a known parser function}}
4080
4081 Now show the unknown parser functions for comparison.
4082
4083 {{#foo}}
4084
4085 {{#foo:bar|bat}}
4086 !! html/php
4087 <p><b>This is a known parser function</b>
4088 </p><p>Now show the unknown parser functions for comparison.
4089 </p><p>{{#foo}}
4090 </p><p>{{#foo:bar|bat}}
4091 </p>
4092 !! html/parsoid+standalone
4093 <p><b typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:b","function":"tag"},"params":{"1":{"wt":"This is a known parser function"}},"i":0}}]}'>This is a known parser function</b></p>
4094 <p>Now show the unknown parser functions for comparison.</p>
4095 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#foo","function":"foo"},"params":{},"i":0}}]}'>Parser function implementation for pf_foo missing in Parsoid.</span></p>
4096 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#foo:bar","function":"foo"},"params":{"1":{"wt":"bat"}},"i":0}}]}'>Parser function implementation for pf_foo missing in Parsoid.</span></p>
4097 !! html/parsoid+integrated
4098 <p><b typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:b","function":"tag"},"params":{"1":{"wt":"This is a known parser function"}},"i":0}}]}'>This is a known parser function</b></p>
4099 <p>Now show the unknown parser functions for comparison.</p>
4100 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#foo","function":"foo"},"params":{},"i":0}}]}'>{{#foo}}</span></p>
4101 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#foo:bar","function":"foo"},"params":{"1":{"wt":"bat"}},"i":0}}]}'>{{#foo:bar|bat}}</span></p>
4102 !! end
4103
4104 # From plwiki:PLOS_ONE
4105 !! test
4106 Parsoid: Page property magic word with magic word contents
4107 !! options
4108 showtitle
4109 !! config
4110 wgAllowDisplayTitle=true
4111 wgRestrictDisplayTitle=false
4112 !! wikitext
4113 {{DISPLAYTITLE:''{{PAGENAME}}''}}
4114 !! metadata
4115 <i>Parser test</i>
4116 !! html/php
4117 !! html/parsoid+integrated
4118 <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:&apos;&apos;{{PAGENAME}}&apos;&apos;","function":"displaytitle"},"params":{},"i":0}}]}'></span>
4119 !! end
4120
4121 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
4122 # But, this is a limitation of our representation and is documented in
4123 # TemplateHandler.php in processSpecialMagicWord
4124 !! test
4125 Parsoid: Template-generated DISPLAYTITLE
4126 !! wikitext
4127 {{{{1x|DISPLAYTITLE}}:Foo}}
4128 !! options
4129 showtitle
4130 !! config
4131 wgAllowDisplayTitle=true
4132 wgRestrictDisplayTitle=false
4133 !! metadata
4134 Foo
4135 !! html/php
4136 !! html/parsoid+integrated
4137 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{1x|DISPLAYTITLE}}:Foo","function":"displaytitle"},"params":{},"i":0}}]}'></span>
4138 !! end
4139
4140 # Can be removed when T335843 is addressed
4141 !! test
4142 Parsoid html2wt b/c check: Cached Parsoid HTML for DISPLAYTITLE should be handled properly
4143 !! options
4144 parsoid=html2wt
4145 !! html/parsoid
4146 <meta property='mw:PageProp/displaytitle' content='foo'/>
4147 <meta property="mw:PageProp/displaytitle" content="Parser test" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"DISPLAYTITLE:&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Parser test&lt;/span>&lt;/i>"}]]}'/>
4148 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}&#39;>DISPLAYTITLE&lt;/span>:Foo"}]]}'/>
4149 !! wikitext
4150 {{DISPLAYTITLE:foo}}
4151 {{DISPLAYTITLE:''{{PAGENAME}}''}}
4152 {{{{1x|DISPLAYTITLE}}:Foo}}
4153 !! end
4154
4155 !! test
4156 Namespace 1 {{ns:1}}
4157 !! wikitext
4158 {{ns:1}}
4159 !! html/php
4160 <p>Talk
4161 </p>
4162 !! html/parsoid+integrated
4163 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ns:1","function":"ns"},"params":{},"i":0}}]}'>Talk</span></p>
4164 !! end
4165
4166 !! test
4167 Namespace 1 {{ns:01}}
4168 !! wikitext
4169 {{ns:01}}
4170 !! html/php
4171 <p>Talk
4172 </p>
4173 !! html/parsoid+integrated
4174 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ns:01","function":"ns"},"params":{},"i":0}}]}'>Talk</span></p>
4175 !! end
4176
4177 !! test
4178 Namespace 0 {{ns:0}} (T6783)
4179 !! wikitext
4180 {{ns:0}}
4181 !! html/php
4182 !! html/parsoid+integrated
4183 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ns:0","function":"ns"},"params":{},"i":0}}]}'></span>
4184 !! end
4185
4186 !! test
4187 Namespace 0 {{ns:00}} (T6783)
4188 !! wikitext
4189 {{ns:00}}
4190 !! html/php
4191 !! html/parsoid+integrated
4192 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ns:00","function":"ns"},"params":{},"i":0}}]}'></span>
4193 !! end
4194
4195 !! test
4196 Namespace -1 {{ns:-1}}
4197 !! wikitext
4198 {{ns:-1}}
4199 !! html/php
4200 <p>Special
4201 </p>
4202 !! html/parsoid+integrated
4203 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ns:-1","function":"ns"},"params":{},"i":0}}]}'>Special</span></p>
4204 !! end
4205
4206 !! test
4207 Namespace User {{ns:User}}
4208 !! wikitext
4209 {{ns:User}}
4210 !! html
4211 <p>User
4212 </p>
4213 !! end
4214
4215 !! test
4216 Namespace User talk {{ns:User_talk}}
4217 !! wikitext
4218 {{ns:User_talk}}
4219 !! html
4220 <p>User talk
4221 </p>
4222 !! end
4223
4224 !! test
4225 Namespace User talk {{ns:uSeR tAlK}}
4226 !! wikitext
4227 {{ns:uSeR tAlK}}
4228 !! html
4229 <p>User talk
4230 </p>
4231 !! end
4232
4233 !! test
4234 Namespace File {{ns:File}}
4235 !! wikitext
4236 {{ns:File}}
4237 !! html
4238 <p>File
4239 </p>
4240 !! end
4241
4242 !! test
4243 Namespace File {{ns:Image}}
4244 !! wikitext
4245 {{ns:Image}}
4246 !! html
4247 <p>File
4248 </p>
4249 !! end
4250
4251 !! test
4252 Namespace (lang=de) Benutzer {{ns:User}}
4253 !! options
4254 language=de
4255 !! wikitext
4256 {{ns:User}}
4257 !! html
4258 <p>Benutzer
4259 </p>
4260 !! end
4261
4262 !! test
4263 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
4264 !! options
4265 language=de
4266 !! wikitext
4267 {{ns:3}}
4268 !! html
4269 <p>Benutzer Diskussion
4270 </p>
4271 !! end
4272
4273 !! test
4274 Urlencode
4275 !! wikitext
4276 {{urlencode:hi world?!}}
4277 {{urlencode:hi world?!|WIKI}}
4278 {{urlencode:hi world?!|PATH}}
4279 {{urlencode:hi world?!|QUERY}}
4280 !! html/php
4281 <p>hi+world%3F%21
4282 hi_world%3F!
4283 hi%20world%3F%21
4284 hi+world%3F%21
4285 </p>
4286 !! end
4287
4288 !!test
4289 __proto__ is treated as normal wikitext (T105997)
4290 !!wikitext
4291 __proto__
4292 !!html
4293 <p>__proto__
4294 </p>
4295 !!end
4296
4297 ###
4298 ### Templates
4299 ####
4300
4301 !! test
4302 Template titles with entities in them
4303 !! wikitext
4304 *{{Foo–bar}}
4305 *{{Foo&ndash;bar}}
4306 !! html/php
4307 <ul><li>foo</li>
4308 <li>foo</li></ul>
4309 !! html/parsoid
4310 <ul>
4311 <li data-parsoid="{}"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Foo–bar","href":"./Template:Foo–bar"},"params":{},"i":0}}]}'>foo</span></li>
4312 <li data-parsoid="{}"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Foo&amp;ndash;bar","href":"./Template:Foo–bar"},"params":{},"i":0}}]}'>foo</span></li>
4313 </ul>
4314 !! end
4315
4316 !! test
4317 Nonexistent template
4318 !! wikitext
4319 {{thistemplatedoesnotexist}}
4320 !! html/php
4321 <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>
4322 </p>
4323 !! html/parsoid
4324 <p><a rel="mw:WikiLink" href="./Template:Thistemplatedoesnotexist?action=edit&amp;redlink=1" title="Template:Thistemplatedoesnotexist" about="#mwt1" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./Template:Thistemplatedoesnotexist"},"sa":{"href":"Template:Thistemplatedoesnotexist"},"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"thistemplatedoesnotexist","href":"./Template:Thistemplatedoesnotexist"},"params":{},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Template:Thistemplatedoesnotexist"]}}'>Template:Thistemplatedoesnotexist</a></p>
4325 !! end
4326
4327 !! test
4328 Template with invalid target containing tags
4329 !! wikitext
4330 {{a<b>b</b>|{{1x|foo}}|{{1x|a}}={{1x|b}}|a = b}}
4331 !! html
4332 <p>{{a<b>b</b>|foo|a=b|a = b}}
4333 </p>
4334 !! end
4335
4336 !! test
4337 Template with invalid target containing unclosed tag
4338 !! options
4339 parsoid=wt2html
4340 !! wikitext
4341 {{a<b>|{{1x|foo}}|{{1x|a}}={{1x|b}}|a = b}}
4342 !! html/php
4343 <p>{{a<b>|foo|a=b|a = b}}
4344 </b></p>
4345 !! html/parsoid
4346 <p>{{a<b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>|<span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>|<span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span>=<span about="#mwt4" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span>|a = b}}</b></p>
4347 !! end
4348
4349 !! test
4350 Template with invalid target containing wikilink
4351 !! wikitext
4352 {{[[Main Page]]}}
4353 !! html/php
4354 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
4355 </p>
4356 !! html/parsoid
4357 <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>
4358 !! end
4359
4360 # The html2html output of this test is currently failing
4361 # because the html2wt output is broken; see
4362 # https://phabricator.wikimedia.org/T220018#5123777 for a discussion.
4363 # Not (yet) including html2wt as a test mode because there are
4364 # a couple of different correct ways this could be <nowiki>'ed.
4365 !! test
4366 Template with just whitespace in it, T70421
4367 !! wikitext
4368 {{1x|{{ }}}}
4369 !! options
4370 parsoid=wt2html,html2html
4371 !! html/php
4372 <p>{{ }}
4373 </p>
4374 !! html/parsoid
4375 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
4376 !! end
4377
4378 # This is currently the wikitext output of html2wt on the above test
4379 # case; note that it is broken! Adding a <nowiki> around the closing
4380 # brace changes how the open braces associate, breaking the outer
4381 # {{1x}} template invocation. *However* this "broken" wikitext
4382 # exposed a useful tokenizer bug (T221384) in how the broken_template
4383 # rule was being backtracked into, so it's a useful test case even
4384 # if/when the above test case gets its html2wt output fixed.
4385 !! test
4386 Template with just whitespace (bad template brace matching)
4387 !! options
4388 parsoid=wt2html
4389 !! wikitext
4390 {{1x|{{ }<nowiki>}</nowiki>}}
4391 !! html/php
4392 <p>{{1x|{{ }}}}
4393 </p>
4394 !! html/parsoid
4395 <p>{{1x|{{ }<span typeof="mw:Nowiki">}</span>}}</p>
4396 !! end
4397
4398 !! article
4399 Template:test
4400 !! text
4401 This is a test template
4402 !! endarticle
4403
4404 !! test
4405 Simple template
4406 !! wikitext
4407 {{test}}
4408 !! html
4409 <p>This is a test template
4410 </p>
4411 !! end
4412
4413 !! test
4414 Template with explicit namespace
4415 !! wikitext
4416 {{Template:test}}
4417 !! html
4418 <p>This is a test template
4419 </p>
4420 !! end
4421
4422
4423 !! article
4424 Template:paramtest
4425 !! text
4426 This is a test template with parameter {{{param}}}
4427 !! endarticle
4428
4429 !! test
4430 Template parameter
4431 !! wikitext
4432 {{paramtest|param=foo}}
4433 !! html
4434 <p>This is a test template with parameter foo
4435 </p>
4436 !! end
4437
4438 !! article
4439 Template:paramtestnum
4440 !! text
4441 [[{{{1}}}|{{{2}}}]]
4442 !! endarticle
4443
4444 !! test
4445 Template unnamed parameter
4446 !! wikitext
4447 {{paramtestnum|Main Page|the main page}}
4448 !! html
4449 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
4450 </p>
4451 !! end
4452
4453 !! article
4454 Template:templatesimple
4455 !! text
4456 (test)
4457 !! endarticle
4458
4459 !! article
4460 Template:templateredirect
4461 !! text
4462 #redirect [[Template:templatesimple]]
4463 !! endarticle
4464
4465 !! article
4466 Template:templateasargtestnum
4467 !! text
4468 {{{{{1}}}}}
4469 !! endarticle
4470
4471 !! article
4472 Template:templateasargtest
4473 !! text
4474 {{template{{{templ}}}}}
4475 !! endarticle
4476
4477 !! article
4478 Template:templateasargtest2
4479 !! text
4480 {{{{{templ}}}}}
4481 !! endarticle
4482
4483 !! test
4484 Template with template name as unnamed argument
4485 !! wikitext
4486 {{templateasargtestnum|templatesimple}}
4487 !! html
4488 <p>(test)
4489 </p>
4490 !! end
4491
4492 !! test
4493 Template with template name as argument
4494 !! wikitext
4495 {{templateasargtest|templ=simple}}
4496 !! html
4497 <p>(test)
4498 </p>
4499 !! end
4500
4501 !! test
4502 Template with template name as argument (2)
4503 !! wikitext
4504 {{templateasargtest2|templ=templatesimple}}
4505 !! html
4506 <p>(test)
4507 </p>
4508 !! end
4509
4510 !! article
4511 Template:templateasargtestdefault
4512 !! text
4513 {{{{{templ|templatesimple}}}}}
4514 !! endarticle
4515
4516 !! article
4517 Template:templa
4518 !! text
4519 '''templ'''
4520 !! endarticle
4521
4522 !! test
4523 Template with default value
4524 !! wikitext
4525 {{templateasargtestdefault}}
4526 !! html
4527 <p>(test)
4528 </p>
4529 !! end
4530
4531 !! test
4532 Template with default value (value set)
4533 !! wikitext
4534 {{templateasargtestdefault|templ=templa}}
4535 !! html
4536 <p><b>templ</b>
4537 </p>
4538 !! end
4539
4540 !! test
4541 Template redirect
4542 !! wikitext
4543 {{templateredirect}}
4544 !! html/php
4545 <p>(test)
4546 </p>
4547 !! html/parsoid+standalone
4548 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
4549 !! html/parsoid+integrated
4550 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'>(test)</span></p>
4551 !! end
4552
4553 !! test
4554 Template with argument in separate line
4555 !! wikitext
4556 {{ templateasargtest |
4557 templ = simple }}
4558 !! html
4559 <p>(test)
4560 </p>
4561 !! end
4562
4563 !! test
4564 Template with complex template as argument
4565 !! wikitext
4566 {{paramtest|
4567 param ={{ templateasargtest |
4568 templ = simple }}}}
4569 !! html
4570 <p>This is a test template with parameter (test)
4571 </p>
4572 !! end
4573
4574 !! test
4575 Templates with templated name
4576 !! wikitext
4577 {{{{1x|1x}}|foo}}
4578 {{{{1x|inner list}} }}
4579 !! html
4580 <p>foo
4581 </p>
4582 <ul><li>item 1</li></ul>
4583 !! html/parsoid
4584 <p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{1x|1x}}","href":"./Template:1x"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span></p>
4585 <ul about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{1x|inner list}} ","href":"./Template:Inner_list"},"params":{},"i":0}}]}'><li>item 1</li></ul>
4586 !! end
4587
4588 ## Regression test; the output here isn't really that interesting.
4589 ## wt2html only, since the bare {{ will get escaped when serializing
4590 ## needs investigation!
4591 ## In integrated mode, since the whole "{{...}}" is sent to core for
4592 ## processing, we wrap the output (unexpanded text) in a Transclusion.
4593 !! test
4594 Templates with templated name and top level template args
4595 !! options
4596 parsoid=wt2html
4597 !! wikitext
4598 {{1{{2{{{3}}}|4=5}}}}
4599 !! html/php
4600 <p>{{1{{2{{{3}}}|4=5}}}}
4601 </p>
4602 !! html/parsoid+standalone
4603 <p>{{1{{2<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"3"},"params":{},"i":0}}]}'>{{{3}}}</span>|4=5}}}}</p>
4604 !! html/parsoid+integrated
4605 <p>{{1<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"2{{{3}}}","href":"./Template:2"},"params":{"4":{"wt":"5"}},"i":0}}]}'>{{2{{{3}}}|4=5}}</span>}}</p>
4606 !! end
4607
4608 ## Regression test (T372669) that is only exercised in integrated mode.
4609 ## By adding {{1x|ignore-this[[Category:Foo]]}} to the 2nd param of the surround {{1x|1x}},
4610 ## it ensures that the output is discarded, but not if Parsoid eagerly processes the attribute.
4611 !! test
4612 T372669: While processing templates with templated names, other attributes shouldn't be processed
4613 !! options
4614 cat
4615 parsoid=wt2html
4616 !! wikitext
4617 {{{{1x|1x}}|foo|{{1x|ignore-this[[Category:Foo]]}}}}
4618 !! html/php
4619 <p>foo
4620 </p>
4621 !! html/parsoid+integrated
4622 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{1x|1x}}","href":"./Template:1x"},"params":{"1":{"wt":"foo"},"2":{"wt":"{{1x|ignore-this[[Category:Foo]]}}"}},"i":0}}]}'>foo</span></p>
4623 !! metadata/php
4624 !! metadata/parsoid+integrated
4625 !! end
4626
4627 !! test
4628 T372669: Template names from multiple templates
4629 !! options
4630 parsoid=wt2html
4631 !! wikitext
4632 {{{{1x|1}}{{1x|x}}|foo}}
4633 !! html/php
4634 <p>foo
4635 </p>
4636 !! html/parsoid
4637 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{1x|1}}{{1x|x}}","href":"./Template:1x"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span></p>
4638 !! end
4639
4640 ## wt2html only, since the bare {{ will get escaped when serializing
4641 !! test
4642 Templates with invalid templated targets
4643 !! options
4644 parsoid=wt2html
4645 !! wikitext
4646 {{1x
4647 {{1x|foo}}
4648 }}
4649 !! html/php
4650 <p>{{1x
4651 foo
4652 }}
4653 </p>
4654 !! html/parsoid
4655 <p>{{1x
4656 <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>
4657 }}</p>
4658 !! end
4659
4660 !! article
4661 Template:complextemplate
4662 !! text
4663 {{{1}}} {{paramtest|
4664 param ={{{param}}}}}
4665 !! endarticle
4666
4667 !! test
4668 Template with complex arguments
4669 !! wikitext
4670 {{complextemplate|
4671 param ={{ templateasargtest |
4672 templ = simple }}|[[Template:complextemplate|link]]}}
4673 !! html
4674 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
4675 </p>
4676 !! end
4677
4678 !! test
4679 T2553: link with two variables in a piped link
4680 !! wikitext
4681 {|
4682 |[[{{{1}}}|{{{2}}}]]
4683 |}
4684 !! html/php
4685 <table>
4686 <tbody><tr>
4687 <td>[[{{{1}}}|{{{2}}}]]
4688 </td></tr></tbody></table>
4689 !! html/parsoid
4690 <table>
4691 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
4692 </tbody></table>
4693 !! end
4694
4695 !! article
4696 One
4697 !! text
4698 Dummy article to suppress redlinks in tests
4699 !! end
4700
4701 # See: T2553
4702 !! test
4703 Bail on table cell attribute parsing on wikilink
4704 !! wikitext
4705 {|
4706 |testing [[one|two]] |three||four
4707 |testing one two |three||four
4708 |testing="[[one|two]]" |three||four
4709 |}
4710 !! html/php
4711 <table>
4712 <tbody><tr>
4713 <td>testing <a href="/wiki/One" title="One">two</a> |three</td>
4714 <td>four
4715 </td>
4716 <td>three</td>
4717 <td>four
4718 </td>
4719 <td>testing="<a href="/wiki/One" title="One">two</a>" |three</td>
4720 <td>four
4721 </td></tr></tbody></table>
4722 !! html/parsoid
4723 <table>
4724 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> |three</td><td data-parsoid='{"stx":"row"}'>four</td>
4725 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""}}'>three</td><td data-parsoid='{"stx":"row"}'>four</td>
4726 <td>testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" |three</td><td data-parsoid='{"stx":"row"}'>four</td></tr>
4727 </tbody></table>
4728 !! end
4729
4730 !! article
4731 Three
4732 !! text
4733 Dummy article to suppress redlinks in tests
4734 !! end
4735
4736 ## We don't care about Parsoid's output here as much as whether
4737 ## attribute parsing breaks because of a wikilink.
4738 ## Parsoid's standalone mode doesn't have a compliant {{#tag}} implementation
4739 !! test
4740 Don't bail on table cell attribute parsing if wikilink is found in template arg
4741 !! wikitext
4742 {|
4743 |Test {{#tag:spantag|One two "[[three]]" four}}
4744 |}
4745 !! html/parsoid+integrated
4746 <table>
4747 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>Test <span typeof="mw:Extension/spantag mw:Transclusion" data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"One two \"[[three]]\" four"},"parts":[{"template":{"target":{"wt":"#tag:spantag","function":"tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</span></td></tr>
4748 </tbody></table>
4749 !! end
4750
4751 !! test
4752 Magic variable as template parameter
4753 !! wikitext
4754 {{paramtest|param={{SITENAME}}}}
4755 !! html
4756 <p>This is a test template with parameter MediaWiki
4757 </p>
4758 !! end
4759
4760 !! article
4761 Template:linktest
4762 !! text
4763 [[{{{param}}}|link]]
4764 !! endarticle
4765
4766 !! test
4767 Template parameter as link source
4768 !! wikitext
4769 {{linktest|param=Main Page}}
4770 !! html
4771 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
4772 </p>
4773 !! end
4774
4775 !!article
4776 Template:paramtest2
4777 !! text
4778 including another template, {{paramtest|param={{{arg}}}}}
4779 !! endarticle
4780
4781 !! test
4782 Template passing argument to another template
4783 !! wikitext
4784 {{paramtest2|arg='hmm'}}
4785 !! html
4786 <p>including another template, This is a test template with parameter 'hmm'
4787 </p>
4788 !! end
4789
4790 !! article
4791 Template:Linktest2
4792 !! text
4793 Main Page
4794 !! endarticle
4795
4796 !! test
4797 Template as link source
4798 !! wikitext
4799 [[{{linktest2}}]]
4800
4801 [[{{linktest2}}|Main Page]]
4802
4803 [[{{linktest2}}]]Page
4804 !! html
4805 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4806 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4807 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
4808 </p>
4809 !! end
4810
4811
4812 !! article
4813 Template:loop1
4814 !! text
4815 {{loop2}}
4816 !! endarticle
4817
4818 !! article
4819 Template:loop2
4820 !! text
4821 {{loop1}}
4822 !! endarticle
4823
4824 !! test
4825 Template infinite loop
4826 !! wikitext
4827 {{loop1}}
4828 !! html/php
4829 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
4830 </p>
4831 !! html/parsoid
4832 <p><span class="error" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"loop1","href":"./Template:Loop1"},"params":{},"i":0}}]}'>Template loop detected: <a rel="mw:WikiLink" href="./Template:Loop1" title="Template:Loop1">Template:Loop1</a></span></p>
4833 !! end
4834
4835 !! test
4836 Template from main namespace
4837 !! wikitext
4838 {{:Main Page}}
4839 !! html
4840 <p>blah blah
4841 </p>
4842 !! end
4843
4844 !! test
4845 Template from non-includable namespace
4846 !! options
4847 wgNonincludableNamespaces=10
4848 !! wikitext
4849 {{1x|uh oh!}}
4850 !! html
4851 <p><a href="/wiki/Template:1x" title="Template:1x">Template:1x</a>
4852 </p>
4853 !! html/parsoid+integrated
4854 <p><a rel="mw:WikiLink" href="./Template:1x" title="Template:1x" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"uh oh!"}},"i":0}}]}'>Template:1x</a></p>
4855 !! end
4856
4857 !! article
4858 Template:table
4859 !! text
4860 {|
4861 | 1 || 2
4862 |-
4863 | 3 || 4
4864 |}
4865 !! endarticle
4866
4867 !! test
4868 T2529: Template with table, not included at beginning of line
4869 !! wikitext
4870 foo {{table}}
4871 !! html/php
4872 <p>foo
4873 </p>
4874 <table>
4875 <tbody><tr>
4876 <td>1</td>
4877 <td>2
4878 </td></tr>
4879 <tr>
4880 <td>3</td>
4881 <td>4
4882 </td></tr></tbody></table>
4883 !! html/parsoid
4884 <p>foo </p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"table","href":"./Template:Table"},"params":{},"i":0}}]}'>
4885 </span><table about="#mwt1">
4886 <tbody><tr><td>1</td><td>2</td></tr>
4887 <tr>
4888 <td>3</td><td>4</td></tr>
4889 </tbody></table>
4890 !! end
4891
4892 !! test
4893 T2523: Template shouldn't eat newline (or add an extra one before table)
4894 !! wikitext
4895 foo
4896 {{table}}
4897 !! html
4898 <p>foo
4899 </p>
4900 <table>
4901 <tbody><tr>
4902 <td>1</td>
4903 <td>2
4904 </td></tr>
4905 <tr>
4906 <td>3</td>
4907 <td>4
4908 </td></tr></tbody></table>
4909 !! end
4910
4911 !! test
4912 T2041: Template parameters shown as broken links
4913 !! wikitext
4914 {{{parameter}}}
4915 !! html/php
4916 <p>{{{parameter}}}
4917 </p>
4918 !! html/parsoid
4919 <p about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"parameter"},"params":{},"i":0}}]}'>{{{parameter}}}</p>
4920 !! end
4921
4922 !! test
4923 Unsubstituted template argument with newlines
4924 !! wikitext
4925 {{{testing
4926
4927 123}}}
4928 !! html/php
4929 <p>{{{testing
4930 </p><p>123}}}
4931 </p>
4932 !! html/parsoid
4933 <p about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"testing\n\n123"},"params":{},"i":0}}]}'>{{{testing</p><span about="#mwt1">
4934
4935 </span><p about="#mwt1">123}}}</p>
4936 !! end
4937
4938 !! test
4939 Template with targets containing wikilinks
4940 !! options
4941 parsoid=wt2html
4942 !! wikitext
4943 {{[[foo]]}}
4944
4945 {{[[{{1x|foo}}]]}}
4946
4947 {{{{1x|[[foo}}]]}}
4948 !! html/php
4949 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
4950 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
4951 </p><p>{{[[foo}}]]
4952 </p>
4953 !! html/parsoid
4954 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
4955 <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>"}]]}'>foo</a>}}</p>
4956 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
4957 !! end
4958
4959 !! article
4960 Template:''
4961 !! text
4962 bar
4963 !! endarticle
4964
4965 !! test
4966 Templates: Double quotes as template target
4967 !! wikitext
4968 foo {{''}} baz
4969 !! html/php
4970 <p>foo bar baz
4971 </p>
4972 !! html/parsoid
4973 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
4974 </p>
4975 !! end
4976
4977 ## This test is about making sure Parsoid's data-mw is well formed in the
4978 ## face of multiple templates with intersecting and overlapping ranges. The
4979 ## wikitext itself is wretched.
4980 !! test
4981 Templates with intersecting and overlapping ranges
4982 !! wikitext
4983 {|{{1x|1=class="foo"
4984 <p>ha</p>}}
4985 {|{{1x|1=class="bar"
4986 <p>ho</p>}}
4987 {{1x|{{!}}hi}}
4988 |}
4989 !! html/php
4990 <p>ha</p><table class="foo">
4991
4992 </table><p>ho</p><table class="bar">
4993
4994 <tbody><tr>
4995 <td>hi
4996 </td></tr></tbody></table>
4997 !! html/parsoid
4998 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1","named":true}],[{"k":"1","named":true}],[{"k":"1"}]],"firstWikitextNode":"TABLE"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"class=\"foo\"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"class=\"bar\"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table class="foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"class","html":"class=\"foo\"","uneditable":true},{"html":""}]]}'>
4999
5000 </table><p about="#mwt1">ho</p><table class="bar" about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"class","html":"class=\"bar\"","uneditable":true},{"html":""}]]}'>
5001
5002 <tbody><tr><td>hi</td></tr>
5003 </tbody></table>
5004 !! end
5005
5006 !! article
5007 Template:MSGNW test
5008 !! text
5009 ''None'' of '''this''' should be
5010 * interpreted
5011 but rather passed unmodified
5012 {{test}}
5013 <gallery>
5014 File:Foobar.jpg
5015 </gallery>
5016 <!-- comment -->
5017 !! endarticle
5018
5019 # hmm, fix this or just deprecate msgnw and document its behavior?
5020 !! test
5021 msgnw keyword
5022 !! wikitext
5023 {{msgnw:MSGNW test}}
5024 !! html/php
5025 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
5026 &#42; interpreted
5027 &#32;but rather passed unmodified
5028 &#123;&#123;test&#125;&#125;
5029 &#60;gallery&#62;
5030 File:Foobar.jpg
5031 &#60;/gallery&#62;
5032 &#60;!-- comment --&#62;
5033 </p>
5034 !! end
5035
5036 !! test
5037 int keyword
5038 !! wikitext
5039 {{int:new-messages|lots of money|not!}}
5040 !! html/php
5041 <p>You have lots of money (not!).
5042 </p>
5043 !! html/parsoid+integrated
5044 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"int:new-messages","function":"int"},"params":{"1":{"wt":"lots of money"},"2":{"wt":"not!"}},"i":0}}]}'>You have lots of money (not!).</span></p>
5045 !! end
5046
5047 !! test
5048 int keyword - non-existing message
5049 !! wikitext
5050 {{int:var}}
5051 !! html/php
5052 <p>⧼var⧽
5053 </p>
5054 !! html/parsoid+integrated
5055 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"int:var","function":"int"},"params":{},"i":0}}]}'>⧼var⧽</span></p>
5056 !! end
5057
5058 !! article
5059 Template:Includes
5060 !! text
5061 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5062 !! endarticle
5063
5064 !! test
5065 <includeonly> and <noinclude> being included
5066 !! wikitext
5067 {{Includes}}
5068 !! html
5069 <p>Foobar
5070 </p>
5071 !! end
5072
5073 !! article
5074 Template:Includes2
5075 !! text
5076 <onlyinclude>Foo</onlyinclude>bar
5077 !! endarticle
5078
5079 ## In integrated mode, Parsoid won't see the <*include*>..</*include*> tags from the expanded template
5080 !! test
5081 <onlyinclude> being included
5082 !! wikitext
5083 {{Includes2}}
5084 !! html/php
5085 <p>Foo
5086 </p>
5087 !! html/parsoid+standalone
5088 <p><meta typeof="mw:Transclusion mw:Includes/OnlyInclude" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"Includes2","href":"./Template:Includes2"},"params":{},"i":0}}]}'/><span about="#mwt1">Foo</span><meta typeof="mw:Includes/OnlyInclude/End" about="#mwt1"/></p>
5089 !! html/parsoid+integrated
5090 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"Includes2","href":"./Template:Includes2"},"params":{},"i":0}}]}'>Foo</span></p>
5091 !! end
5092
5093
5094 !! article
5095 Template:Includes3
5096 !! text
5097 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5098 !! endarticle
5099
5100 ## In integrated mode, Parsoid won't see the <*include*>..</*include*> tags from the expanded template
5101 !! test
5102 <onlyinclude> and <includeonly> being included
5103 !! wikitext
5104 {{Includes3}}
5105 !! html/php
5106 <p>Foo
5107 </p>
5108 !! html/parsoid+standalone
5109 <p><meta typeof="mw:Transclusion mw:Includes/OnlyInclude" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"Includes3","href":"./Template:Includes3"},"params":{},"i":0}}]}'/><span about="#mwt1">Foo</span><meta typeof="mw:Includes/OnlyInclude/End" about="#mwt1"/></p>
5110 !! html/parsoid+integrated
5111 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"Includes3","href":"./Template:Includes3"},"params":{},"i":0}}]}'>Foo</span></p>
5112 !! end
5113
5114 # FIXME: Parsoid's markup for this is quite ugly.
5115 !! test
5116 <includeonly> and <noinclude> on a page
5117 !! wikitext
5118 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5119 !! html/php
5120 <p>Foozar
5121 </p>
5122 !! html/parsoid
5123 <p>Foo<meta typeof="mw:Includes/NoInclude" data-parsoid="{}"/>zar</p><meta typeof="mw:Includes/NoInclude/End" data-parsoid="{}"/><meta typeof="mw:Includes/IncludeOnly" data-mw='{"src":"&lt;includeonly>bar&lt;/includeonly>"}' data-parsoid="{}"/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid="{}"/>
5124 !! end
5125
5126 !! test
5127 Un-closed <noinclude>
5128 !! wikitext
5129 <noinclude>
5130 !! html/php
5131 !! html/parsoid
5132 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
5133 !! end
5134
5135 !! test
5136 Empty <noinclude>
5137 !! wikitext
5138 Hello<noinclude></noinclude>!
5139 !! html/php
5140 <p>Hello!
5141 </p>
5142 !! html/parsoid
5143 <p>Hello<meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>!</p>
5144 !! end
5145
5146 !! test
5147 Nested <noinclude>s
5148 !! wikitext
5149 <noinclude>
5150 x
5151 <noinclude>y</noinclude>
5152 z
5153 </noinclude>
5154 !! html/php
5155 <p>x
5156 y
5157 z
5158 </p>
5159 !! html/parsoid
5160 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
5161 <p>x
5162 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>y<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>
5163 z</p>
5164 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>
5165 !! end
5166
5167 !! test
5168 <onlyinclude> on a page
5169 !! wikitext
5170 <onlyinclude>Foo</onlyinclude>bar
5171 !! html
5172 <p>Foobar
5173 </p>
5174 !! end
5175
5176 !! test
5177 Un-closed <onlyinclude>
5178 !! wikitext
5179 <onlyinclude>
5180 !! html
5181 !! end
5182
5183 !! test
5184 T236868: Un-closed <noinclude> caused bad SourceRange length
5185 !! wikitext
5186 {| <noinclude>
5187 |- <noinclude>
5188 | A
5189 |-</noinclude>
5190 |}
5191 !! html/parsoid
5192 <table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"&lt;noinclude>\n|- &lt;noinclude>\n| A\n|-&lt;/noinclude>":null},"sa":{"&lt;noinclude>\n|- &lt;noinclude>\n| A\n|-&lt;/noinclude>":""}}' data-mw='{"attribs":[[{"txt":" A","html":"&lt;meta typeof=\"mw:Includes/NoInclude\" data-parsoid=&apos;{\"src\":\"&amp;lt;noinclude>\",\"dsr\":[3,14,null,null]}&apos;/>\n|- &lt;meta typeof=\"mw:Includes/NoInclude\" data-parsoid=&apos;{\"src\":\"&amp;lt;noinclude>\",\"dsr\":[18,29,null,null]}&apos;/>\n| A\n|-&lt;meta typeof=\"mw:Includes/NoInclude/End\" data-parsoid=&apos;{\"src\":\"&amp;lt;/noinclude>\",\"dsr\":[36,48,null,null]}&apos;/>"},{"html":""}]]}'>
5193 </table>
5194 !! end
5195
5196 !!test
5197 Self-closed noinclude, includeonly, onlyinclude tags
5198 !! wikitext
5199 <noinclude />
5200 <includeonly />
5201 <onlyinclude />
5202 !! html
5203 <p><br />
5204 </p>
5205 !!end
5206
5207 !!test
5208 Unbalanced includeonly and noinclude tags
5209 !! wikitext
5210 {|
5211 |a</noinclude>
5212 |b</noinclude></noinclude>
5213 |c</noinclude></includeonly>
5214 |d</includeonly></includeonly>
5215 |}
5216 !! html
5217 <table>
5218 <tbody><tr>
5219 <td>a
5220 </td>
5221 <td>b
5222 </td>
5223 <td>c&lt;/includeonly&gt;
5224 </td>
5225 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5226 </td></tr></tbody></table>
5227 !!end
5228
5229 # We're more interested in the generation of <h2> when reading than in round-tripping these - the RT without the newline
5230 # wouldn't be acceptable if "real" text were in the include tags, for instance.
5231 !! test
5232 includeonly / noinclude / onlyinclude and headers
5233 !! options
5234 parsoid = wt2html
5235 !! config
5236 wgParserEnableLegacyHeadingDOM=false
5237 !! wikitext
5238 <includeonly><!--hello1 --></includeonly>== test 1 == <includeonly><!--hello2 --></includeonly>
5239 <noinclude><!--hello3 --></noinclude>== test 2 == <noinclude><!--hello4 --></noinclude>
5240 <onlyinclude><!--hello5 --></onlyinclude>== test 3 == <onlyinclude><!--hello6 --></onlyinclude>
5241 !! html/parsoid
5242 <meta typeof="mw:Includes/IncludeOnly" data-mw='{"src":"&lt;includeonly>&lt;!--hello1 -->&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h2 id="test_1">test 1</h2> <meta typeof="mw:Includes/IncludeOnly" data-mw='{"src":"&lt;includeonly>&lt;!--hello2 -->&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/>
5243 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!--hello3 --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><h2 id="test_2">test 2</h2> <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!--hello4 --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>
5244 <meta typeof="mw:Includes/OnlyInclude" data-parsoid='{"src":"&lt;onlyinclude>"}'/><!--hello5 --><meta typeof="mw:Includes/OnlyInclude/End" data-parsoid='{"src":"&lt;/onlyinclude>"}'/><h2 id="test_3">test 3</h2> <meta typeof="mw:Includes/OnlyInclude" data-parsoid='{"src":"&lt;onlyinclude>"}'/><!--hello6 --><meta typeof="mw:Includes/OnlyInclude/End" data-parsoid='{"src":"&lt;/onlyinclude>"}'/>
5245 !! html/php
5246 <div class="mw-heading mw-heading2"><h2 id="test_1">test 1</h2></div>
5247 <div class="mw-heading mw-heading2"><h2 id="test_2">test 2</h2></div>
5248 <div class="mw-heading mw-heading2"><h2 id="test_3">test 3</h2></div>
5249 !! end
5250
5251 # Uses same input as the contents of [[Template:Includeonly section]]
5252 !! test
5253 T8563: Section extraction for section shown by <includeonly>
5254 !! options
5255 section=T-2
5256 !! wikitext
5257 <includeonly>
5258 ==Includeonly section==
5259 </includeonly>
5260 ==Section T-2==
5261 !! html
5262 ==Section T-2==
5263 !! end
5264
5265 !! test
5266 T8563: Section extraction for section suppressed by <includeonly>
5267 !! options
5268 section=1
5269 !! wikitext
5270 <includeonly>
5271 ==Includeonly section==
5272 </includeonly>
5273 ==Section 1==
5274 !! html
5275 ==Section 1==
5276 !! end
5277
5278 !! test
5279 Un-closed <includeonly>
5280 !! wikitext
5281 <includeonly>
5282 !! html/php
5283 !! html/parsoid
5284 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}' data-mw='{"src":"&lt;includeonly>"}'/>
5285 !! end
5286
5287 ## We used to, but no longer wt2wt this test since the default serializer
5288 ## will normalize the include directives to serialize on their own line.
5289 ## Selser will take care of preserving formatting in scenarios where they
5290 ## intermingled with other wikitext.
5291 ## This test also triggered T223411 during Parsoid-PHP porting.
5292 !! test
5293 Includes and comments at SOL
5294 !! options
5295 parsoid=wt2html,html2html
5296 !! config
5297 wgParserEnableLegacyHeadingDOM=false
5298 !! wikitext
5299 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
5300
5301 <noinclude>
5302 some
5303 </noinclude>*stuff
5304 *here
5305
5306 <noinclude>
5307 some</noinclude>* stuff
5308 * here
5309
5310 <includeonly>can have stuff</includeonly>===here===
5311
5312 __INDEX__== hi ==
5313 !! html/php
5314 <div class="mw-heading mw-heading2"><h2 id="hu">hu</h2></div>
5315 <p>some
5316 </p>
5317 <ul><li>stuff</li>
5318 <li>here</li></ul>
5319 <p><br />
5320 some* stuff
5321 </p>
5322 <ul><li>here</li></ul>
5323 <div class="mw-heading mw-heading3"><h3 id="here">here</h3></div>
5324 <div class="mw-heading mw-heading2"><h2 id="hi">hi</h2></div>
5325 !! html/parsoid
5326 <!-- 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 id="hu">hu</h2>
5327
5328 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
5329 <p>some</p>
5330 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
5331 <li>here</li></ul>
5332
5333 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
5334 <p>some<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>* stuff</p>
5335 <ul><li>here</li></ul>
5336
5337 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}' data-mw='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3 id="here">here</h3>
5338
5339 <meta property="mw:PageProp/index"/><h2 id="hi">hi</h2>
5340 !! end
5341
5342 # TODO: test with DOM fragment reuse!
5343 !! test
5344 Parsoid: DOM fragment reuse
5345 !! options
5346 parsoid=wt2wt,wt2html
5347 !! wikitext
5348 a{{1x|b<table></table>c}}d
5349
5350 a{{1x|b
5351 <table></table>
5352 c}}d
5353
5354 {{1x|a
5355
5356 <table></table>
5357
5358 b}}
5359 !! html/php
5360 <p>ab</p><table></table><p>cd
5361 </p><p>ab
5362 </p>
5363 <table></table>
5364 <p>cd
5365 </p><p>a
5366 </p>
5367 <table></table>
5368 <p>b
5369 </p>
5370 !! html/parsoid
5371 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
5372
5373 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
5374 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
5375 </span><p about="#mwt2">cd</p>
5376
5377 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
5378
5379 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
5380
5381 </span><p about="#mwt3">b</p>
5382 !! end
5383
5384 !! article
5385 Template:Temp?
5386 !! text
5387 temp {{{1}}}
5388 !! endarticle
5389
5390 !! test
5391 Template name with question mark
5392 !! options
5393 parsoid={
5394 "modes": [ "selser", "wt2html", "html2wt" ],
5395 "changes": [
5396 ["span", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"temp?\",\"href\":\"./Template:Temp%3F\"},\"params\":{\"1\":{\"wt\":\"456\"}},\"i\":0}}]}"]
5397 ]
5398 }
5399 !! wikitext
5400 {{temp?|123}}
5401 !! wikitext/edited
5402 {{temp?|456}}
5403 !! html/php
5404 <p>temp 123
5405 </p>
5406 !! html/parsoid
5407 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"temp?","href":"./Template:Temp%3F"},"params":{"1":{"wt":"123"}},"i":0}}]}'>temp 123</span></p>
5408 !! end
5409
5410 ###
5411 ### <includeonly> and <noinclude> in attributes
5412 ###
5413 !!test
5414 0. includeonly around the entire attribute
5415 !! wikitext
5416 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5417 !! html
5418 <p><span id="v2">bar</span>
5419 </p>
5420 !!end
5421
5422 !!test
5423 1. includeonly in html attr key
5424 !! wikitext
5425 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5426 !! html
5427 <p><span id="foo">bar</span>
5428 </p>
5429 !!end
5430
5431 !!test
5432 2. includeonly in html attr value
5433 !! wikitext
5434 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5435 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5436 !! html
5437 <p><span id="v1">bar</span>
5438 <span id="v1">bar</span>
5439 </p>
5440 !!end
5441
5442 !!test
5443 3. includeonly in part of an attr value
5444 !! wikitext
5445 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
5446 !! html
5447 <p><span style="color:red;">bar</span>
5448 </p>
5449 !!end
5450
5451 !!test
5452 4. includeonly in table attributes
5453 !! wikitext
5454 {|
5455 |- <noinclude>
5456 |-
5457 |a
5458 </noinclude>
5459 |- <includeonly>
5460 |-
5461 |b
5462 </includeonly>
5463 |}
5464 !! html
5465 <table>
5466
5467
5468 <tbody><tr>
5469 <td>a
5470 </td></tr>
5471 </tbody></table>
5472 !!end
5473
5474 ###
5475 ### Token Stream Patcher tests
5476 ###
5477 ### These tests won't always pass wt2wt and other modes because
5478 ### on serialization, the table will be output on a new line.
5479 ### For now, we are prohibiting them, and using this to test selser.
5480 ###
5481
5482 !!test
5483 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
5484 !!options
5485 parsoid=wt2html,wt2wt
5486 !!wikitext
5487 {{1x|}}{| width = '100%'
5488 |foo
5489 |}
5490 !!html/parsoid
5491 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
5492 <tbody><tr><td>foo</td></tr>
5493 </tbody></table>
5494 !!end
5495
5496 ## We used to, but no longer wt2wt this test since the default serializer
5497 ## will normalize the include directives to serialize on their own line.
5498 ## Selser will take care of preserving formatting in scenarios where they
5499 ## intermingled with other wikitext.
5500 !!test
5501 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
5502 !!options
5503 parsoid=wt2html
5504 !!wikitext
5505 <includeonly>a</includeonly>{| {{{b}}}
5506 |c
5507 |}
5508 !!html/parsoid
5509 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}' data-mw='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
5510 <tbody><tr><td>c</td></tr>
5511 </tbody></table>
5512 !!end
5513
5514 !! test
5515 Table wikitext syntax outside wiki-tables
5516 !! wikitext
5517 a
5518 |+ not a caption
5519 ! not a table heading
5520 |- not a table row
5521 | not a table cell
5522 | class="foo bar" | baz
5523 b
5524 |}
5525 |-
5526 c
5527 !! html
5528 <p>a
5529 |+ not a caption
5530 ! not a table heading
5531 |- not a table row
5532 | not a table cell
5533 | class="foo bar" | baz
5534 b
5535 |}
5536 |-
5537 c
5538 </p>
5539 !! end
5540
5541 !! test
5542 Content after <tr> like wikitext should get fully processed
5543 !! wikitext
5544 x
5545 |- [[Foo]] and {{1x|bar}}
5546 y
5547 !! html/php
5548 <p>x
5549 |- <a href="/wiki/Foo" title="Foo">Foo</a> and bar
5550 y
5551 </p>
5552 !! html/parsoid
5553 <p>x
5554 |- <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Foo</a> and <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"bar"}},"i":0}}]}'>bar</span>
5555 y</p>
5556 !! end
5557
5558 !! test
5559 P-wrapping should not break after <td>s separated by newlines are converted back to pipes
5560 !! wikitext
5561 a
5562 |b
5563
5564 |c
5565 d
5566 !! html/php
5567 <p>a
5568 |b
5569 </p><p>|c
5570 d
5571 </p>
5572 !! html/parsoid
5573 <p>a
5574 |b</p>
5575
5576 <p>|c
5577 d</p>
5578 !! end
5579
5580 !! test
5581 Orphaned table row wikitext with templated table for an attribute should not duplicate table
5582 !! wikitext
5583 |-{{1x|
5584 {{{!}}
5585 {{!}}foo
5586 {{!}}}
5587 }}
5588 !! html/php
5589 <p>|-
5590 </p>
5591 <table>
5592 <tbody><tr>
5593 <td>foo
5594 </td></tr></tbody></table>
5595 !! html/parsoid
5596 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]],"firstWikitextNode":"TR"}' data-mw='{"parts":["|-",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}foo\n{{!}}}\n"}},"i":0}}]}'>|-</p><span about="#mwt1">
5597 </span><table about="#mwt1">
5598 <tbody><tr><td>foo</td></tr>
5599 </tbody></table><span about="#mwt1">
5600 </span>
5601 !! end
5602
5603 ###
5604 ### Testing parsing of templates where a template arg
5605 ### has the same name as the template itself.
5606 ###
5607
5608 !! article
5609 Template:quote
5610 !! text
5611 {{{quote|{{{1}}}}}}
5612 !! endarticle
5613
5614 !! test
5615 Templates: Template Name/Arg clash: 1. Use of positional param
5616 !! wikitext
5617 {{quote|foo}}
5618 !! html/php
5619 <p>foo
5620 </p>
5621 !! html/parsoid
5622 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"quote","href":"./Template:Quote"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span></p>
5623 !! end
5624
5625 !! test
5626 Templates: Template Name/Arg clash: 2. Use of named param
5627 !! wikitext
5628 {{quote|quote=foo}}
5629 !! html/php
5630 <p>foo
5631 </p>
5632 !! html/parsoid
5633 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"quote","href":"./Template:Quote"},"params":{"quote":{"wt":"foo"}},"i":0}}]}'>foo</span></p>
5634 !! end
5635
5636 ###
5637 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
5638 ###
5639
5640 !!test
5641 Templates: 1. Simple use
5642 !! wikitext
5643 {{1x|Foo}}
5644 !! html
5645 <p>Foo
5646 </p>
5647 !!end
5648
5649 !!test
5650 Templates: 2. Inside a block tag
5651 !! wikitext
5652 <div>{{1x|Foo}}</div>
5653 <blockquote>{{1x|Foo}}</blockquote>
5654 !! html
5655 <div>Foo</div>
5656 <blockquote><p>Foo</p></blockquote>
5657 !!end
5658
5659 !!test
5660 Templates: P-wrapping: 1a. Templates on consecutive lines
5661 !! wikitext
5662 {{1x|Foo}}
5663 {{1x|bar}}
5664 !! html
5665 <p>Foo
5666 bar
5667 </p>
5668 !!end
5669
5670 !!test
5671 Templates: P-wrapping: 1b. Templates on consecutive lines
5672 !! wikitext
5673 Foo
5674
5675 {{1x|bar}}
5676 {{1x|baz}}
5677 !! html
5678 <p>Foo
5679 </p><p>bar
5680 baz
5681 </p>
5682 !!end
5683
5684 !!test
5685 Templates: P-wrapping: 1c. Templates on consecutive lines
5686 !! wikitext
5687 {{1x|Foo}}
5688 {{1x|bar}} <div>baz</div>
5689 !! html
5690 <p>Foo
5691 </p><p>
5692 bar </p><div>baz</div>
5693 !! html/parsoid
5694 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"Foo"}},"i":0}}]}'>Foo</span></p>
5695 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"bar"}},"i":0}}]}'>bar</p> <div data-parsoid='{"stx":"html"}'>baz</div>
5696 !! end
5697
5698 !! test
5699 Templates: P-wrapping: 1d. Template preceded by comment-only line
5700 !! wikitext
5701 <!-- foo -->
5702 {{1x|Bar}}
5703 !! html/php
5704 <p>Bar
5705 </p>
5706 !! html/parsoid
5707 <!-- foo -->
5708
5709 <p><span about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</span></p>
5710 !!end
5711
5712 !! test
5713 Templates: Scopes should not be expanded unnecessarily
5714 !! options
5715 parsoid=wt2html,wt2wt
5716 !! wikitext
5717 {{1x|<div>a</div>}}b{{1x|
5718 <div>c</div>}}
5719 !! html/php
5720 <div>a</div><p>b
5721 </p><div>c</div>
5722 !! html/parsoid
5723 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;div>a&lt;/div>"}},"i":0}}]}'>a</div><p>b</p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"\n&lt;div>c&lt;/div>"}},"i":0}}]}'>
5724 </span><div about="#mwt2">c</div>
5725 !! end
5726
5727 !!test
5728 Templates: Inline Text: 1. Multiple template uses
5729 !! wikitext
5730 {{1x|Foo}}bar{{1x|baz}}
5731 !! html
5732 <p>Foobarbaz
5733 </p>
5734 !!end
5735
5736 !!test
5737 Templates: Inline Text: 2. Back-to-back template uses
5738 !! wikitext
5739 {{1x|Foo}}{{1x|bar}}
5740 !! html
5741 <p>Foobar
5742 </p>
5743 !!end
5744
5745 !!test
5746 Templates: Block Tags: 1. Multiple template uses
5747 !! wikitext
5748 {{1x|<div>Foo</div>}}<div>bar</div>{{1x|<div>baz</div>}}
5749 !! html
5750 <div>Foo</div><div>bar</div><div>baz</div>
5751 !!end
5752
5753 !!test
5754 Templates: Block Tags: 2. Back-to-back template uses
5755 !! wikitext
5756 {{1x|<div>Foo</div>}}{{1x|<div>bar</div>}}
5757 !! html
5758 <div>Foo</div><div>bar</div>
5759 !!end
5760
5761 ## Parsoid drops empty elements in templates.
5762 !! test
5763 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
5764 !! wikitext
5765 {{1x|a
5766 b</p>}}
5767 !! html/php
5768 <p>a
5769 </p><p>
5770 b</p><p class="mw-empty-elt"></p>
5771 !! html/parsoid
5772 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a</p><span about="#mwt1">
5773 </span><p about="#mwt1">b</p>
5774 !! end
5775
5776 !! test
5777 Drop stripped tag markers, unless they have encapsulation info
5778 !! wikitext
5779 {{1x|<tr></tr>}}
5780 !! html/php
5781
5782 !! html/parsoid
5783 <meta typeof="mw:Transclusion mw:Placeholder/StrippedTag" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;tr>&lt;/tr>"}},"i":0}}]}'/>
5784 !! end
5785
5786 !!test
5787 Templates: Links: 1. Simple example
5788 !! wikitext
5789 {{1x|[[Foo|bar]]}}
5790 !! html
5791 <p><a href="/wiki/Foo" title="Foo">bar</a>
5792 </p>
5793 !!end
5794
5795 !!test
5796 Templates: Links: 2. Generation of link href
5797 !! wikitext
5798 [[{{1x|Foo}}|bar]]
5799 !! html
5800 <p><a href="/wiki/Foo" title="Foo">bar</a>
5801 </p>
5802 !!end
5803
5804 !! article
5805 Foobar
5806 !! text
5807 Dummy article to suppress redlinks in tests
5808 !! end
5809
5810 !! article
5811 Foobarbaz
5812 !! text
5813 Dummy article to suppress redlinks in tests
5814 !! end
5815
5816 !!test
5817 Templates: Links: 3. Generation of part of a link href
5818 !! wikitext
5819 [[Fo{{1x|o}}|bar]]
5820
5821 [[Foo{{1x|bar}}]]
5822
5823 [[Foo{{1x|bar}}baz]]
5824
5825 [[Foo{{1x|bar}}|bar]]
5826
5827 [[:Foo{{1x|bar}}]]
5828
5829 [[:Foo{{1x|bar}}|bar]]
5830 !! html/php
5831 <p><a href="/wiki/Foo" title="Foo">bar</a>
5832 </p><p><a href="/wiki/Foobar" title="Foobar">Foobar</a>
5833 </p><p><a href="/wiki/Foobarbaz" title="Foobarbaz">Foobarbaz</a>
5834 </p><p><a href="/wiki/Foobar" title="Foobar">bar</a>
5835 </p><p><a href="/wiki/Foobar" title="Foobar">Foobar</a>
5836 </p><p><a href="/wiki/Foobar" title="Foobar">bar</a>
5837 </p>
5838 !! html/parsoid
5839 <p><a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Fo{{1x|o}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"Fo&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[4,12,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"o\"}},\"i\":0}}]}&apos;>o&lt;/span>"}]]}'>bar</a></p>
5840
5841 <p><a typeof="mw:ExpandedAttrs" about="#mwt4" rel="mw:WikiLink" href="./Foobar" title="Foobar" data-parsoid='{"stx":"simple","a":{"href":"./Foobar"},"sa":{"href":"Foo{{1x|bar}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"Foo&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[25,35,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"bar\"}},\"i\":0}}]}&apos;>bar&lt;/span>"}]]}'>Foobar</a></p>
5842
5843 <p><a typeof="mw:ExpandedAttrs" about="#mwt6" rel="mw:WikiLink" href="./Foobarbaz" title="Foobarbaz" data-parsoid='{"stx":"simple","a":{"href":"./Foobarbaz"},"sa":{"href":"Foo{{1x|bar}}baz"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"Foo&lt;span about=\"#mwt5\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[44,54,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"bar\"}},\"i\":0}}]}&apos;>bar&lt;/span>baz"}]]}'>Foobarbaz</a></p>
5844
5845 <p><a typeof="mw:ExpandedAttrs" about="#mwt8" rel="mw:WikiLink" href="./Foobar" title="Foobar" data-parsoid='{"stx":"piped","a":{"href":"./Foobar"},"sa":{"href":"Foo{{1x|bar}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"Foo&lt;span about=\"#mwt7\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[66,76,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"bar\"}},\"i\":0}}]}&apos;>bar&lt;/span>"}]]}'>bar</a></p>
5846
5847 <p><a typeof="mw:ExpandedAttrs" about="#mwt10" rel="mw:WikiLink" href="./Foobar" title="Foobar" data-parsoid='{"stx":"simple","a":{"href":"./Foobar"},"sa":{"href":":Foo{{1x|bar}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":":Foo&lt;span about=\"#mwt9\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[90,100,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"bar\"}},\"i\":0}}]}&apos;>bar&lt;/span>"}]]}'>Foobar</a></p>
5848
5849 <p><a typeof="mw:ExpandedAttrs" about="#mwt12" rel="mw:WikiLink" href="./Foobar" title="Foobar" data-parsoid='{"stx":"piped","a":{"href":"./Foobar"},"sa":{"href":":Foo{{1x|bar}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":":Foo&lt;span about=\"#mwt11\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[110,120,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"bar\"}},\"i\":0}}]}&apos;>bar&lt;/span>"}]]}'>bar</a></p>
5850 !!end
5851
5852 !!test
5853 Templates: Links: 4. Multiple templates generating link href
5854 !! wikitext
5855 [[{{1x|F}}{{1x|o}}ob{{1x|ar}}]]
5856 !! html/php
5857 <p><a href="/wiki/Foobar" title="Foobar">Foobar</a>
5858 </p>
5859 !! html/parsoid
5860 <p><a typeof="mw:ExpandedAttrs" about="#mwt4" rel="mw:WikiLink" href="./Foobar" title="Foobar" data-parsoid='{"stx":"simple","a":{"href":"./Foobar"},"sa":{"href":"{{1x|F}}{{1x|o}}ob{{1x|ar}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,10,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"F\"}},\"i\":0}}]}&apos;>F&lt;/span>&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[10,18,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"o\"}},\"i\":0}}]}&apos;>o&lt;/span>ob&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,29,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"ar\"}},\"i\":0}}]}&apos;>ar&lt;/span>"}]]}'>Foobar</a></p>
5861 !!end
5862
5863 !!test
5864 Templates: Links: 5. Generation of link text
5865 !! wikitext
5866 [[Foo|{{1x|bar}}]]
5867 !! html
5868 <p><a href="/wiki/Foo" title="Foo">bar</a>
5869 </p>
5870 !!end
5871
5872 !!test
5873 Templates: Links: 5. Nested templates (only outermost template should be marked)
5874 !! wikitext
5875 {{1x|[[{{1x|Foo}}|bar]]}}
5876 !! html
5877 <p><a href="/wiki/Foo" title="Foo">bar</a>
5878 </p>
5879 !!end
5880
5881 !! test
5882 File with template filename
5883 !! wikitext
5884 [[File:{{1x|Foobar.jpg}}]]
5885 !! html/parsoid
5886 <p><span class="mw-default-size" typeof="mw:File mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"href"},{"html":"File:&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"Foobar.jpg\"}},\"i\":0}}]}&apos;>Foobar.jpg&lt;/span>"}]]}'><a href="./File:Foobar.jpg" class="mw-file-description"><img resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:{{1x|Foobar.jpg}}"}}' class="mw-file-element"/></a></span></p>
5887 !! end
5888
5889 !!test
5890 Templates: HTML Tag: 1. Generation of HTML attr. key
5891 !! wikitext
5892 <div {{1x|style}}="color:red;">foo</div>
5893 !! html
5894 <div style="color:red;">foo</div>
5895 !!end
5896
5897 !!test
5898 Templates: HTML Tag: 2. Generation of HTML attr. value
5899 !! wikitext
5900 <div style={{1x|'color:red;'}}>foo</div>
5901 !! html
5902 <div style="color:red;">foo</div>
5903 !!end
5904
5905 !!test
5906 Templates: HTML Tag: 3. Generation of HTML attr key and value
5907 !! wikitext
5908 <div {{1x|style}}={{1x|'color:red;'}}>foo</div>
5909 !! html
5910 <div style="color:red;">foo</div>
5911 !!end
5912
5913 !!test
5914 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
5915 !! wikitext
5916 <div title="{{1x|This is a long title}} with just one piece templated">foo</div>
5917 !! html
5918 <div title="This is a long title with just one piece templated">foo</div>
5919 !!end
5920
5921 !!test
5922 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
5923 !! wikitext
5924 <div title="This is a long title with just {{1x|one piece}} templated">foo</div>
5925 !! html
5926 <div title="This is a long title with just one piece templated">foo</div>
5927 !!end
5928
5929 !!test
5930 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
5931 !! wikitext
5932 <div title="This is a long title with just one piece {{1x|templated}}">foo</div>
5933 !! html
5934 <div title="This is a long title with just one piece templated">foo</div>
5935 !!end
5936
5937 # SSS FIXME: While it is great we added support for all this,
5938 # do we want to make this part of the spec? Maybe we want to
5939 # deprecate this kind of usage in the future?
5940 !!test
5941 Templates: HTML Tag: 7. Generation of partial attribute key string
5942 !! wikitext
5943 <div st{{1x|yle}}="color:red;">foo</div>
5944 !! html
5945 <div style="color:red;">foo</div>
5946 !!end
5947
5948 !! test
5949 Templates: HTML Tag: 8. Template-generated attribute (k=v)
5950 !! wikitext
5951 <div {{1x|1=id="v1"}}>bar</div>
5952 !! html
5953 <div id="v1">bar</div>
5954 !!end
5955
5956 !! test
5957 Templates: HTML Tag: 9. Multiple template-generated attributes
5958 !! wikitext
5959 <div {{1x|1=id="v1" title="foo"}}>bar</div>
5960 !! html
5961 <div id="v1" title="foo">bar</div>
5962 !!end
5963
5964 !! test
5965 Templates: Support for templates generating attributes and content
5966 !! wikitext
5967 {| {{mixed_attr_content_template}}
5968 |-
5969 |bar
5970 |}
5971 !! html/php
5972 <table style="color:red;" title="T48811">
5973
5974 <tbody><tr>
5975 <td>foo
5976 </td></tr>
5977 <tr>
5978 <td>bar
5979 </td></tr></tbody></table>
5980 !! html/parsoid
5981 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"style","html":"style=\"color:red;\" title=\"T48811\"","uneditable":true},{"html":""}]],"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
5982 <tbody><tr>
5983 <td>foo</td></tr>
5984 <tr>
5985 <td>bar</td></tr>
5986 </tbody></table>
5987 !!end
5988
5989 !! test
5990 Templates: Support for templates generating table attributes and content (with fostered categories)
5991 !! wikitext
5992 {| {{mixed_attr_content_template_2}}
5993 |-
5994 |bar
5995 |}
5996 !! html/php
5997 <table style="color:red;" title="T249740">
5998 <tbody><tr>
5999 <td>foo
6000 </td></tr>
6001 <tr>
6002 <td>bar
6003 </td></tr></tbody></table>
6004 !! html/parsoid
6005 <link rel="mw:PageProp/Category" href="./Category:Fostered_Content" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Fostered_Content"},"sa":{"href":"Category:Fostered Content"},"pi":[[]],"firstWikitextNode":"TABLE"}' data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template_2","href":"./Template:Mixed_attr_content_template_2"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'/><table style="color:red;" title="T249740" about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"style","html":"style=\"color:red;\" title=\"T249740\"","uneditable":true},{"html":""}]]}'>
6006 <tbody><tr>
6007
6008 <td>foo</td></tr>
6009 <tr>
6010 <td>bar</td></tr>
6011 </tbody></table>
6012 !!end
6013
6014 !! article
6015 Template:attribute_from_template
6016 !! text
6017 class="123"
6018 !! endarticle
6019
6020 !! test
6021 Table cell with attribute before expanded attribute
6022 !! wikitext
6023 {|
6024 | align="center" {{attribute_from_template}} |456
6025 |}
6026 !! html/parsoid
6027 <table>
6028 <tbody><tr><td align="center" class="123" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"class","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[]],\"dsr\":[20,47,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"attribute_from_template\",\"href\":\"./Template:Attribute_from_template\"},\"params\":{},\"i\":0}}]}&apos;>class=\"123\"&lt;/span>"},{"html":""}]]}'>456</td></tr>
6029 </tbody></table>
6030 !! end
6031
6032 # In integrated mode, the {{=}} template is expanded before Parsoid sees it
6033 !! test
6034 1. Entities and nowikis inside templated attributes should be handled correctly
6035 !! wikitext
6036 <div {{1x|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
6037 !! html/php
6038 <div style="background:#f9f9f9;">foo</div>
6039 !! html/parsoid+standalone
6040 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
6041 !! html/parsoid+integrated
6042 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>style=\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
6043 !! end
6044
6045 !! test
6046 2. Entities and nowikis inside templated attributes should be handled correctly
6047 !! wikitext
6048 {|
6049 |{{table_attribs_3}}
6050 |}
6051 !! html/php
6052 <table>
6053 <tbody><tr>
6054 <td style="background:#f9f9f9;">Foo
6055 </td></tr></tbody></table>
6056 !! html/parsoid
6057 <table>
6058 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
6059 </tbody></table>
6060 !! end
6061
6062 !! test
6063 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
6064 !! wikitext
6065 {{tbl-start}}
6066 |{{table_attribs_3}}
6067 {{tbl-end}}
6068 !! html/php
6069 <table>
6070 <tbody><tr>
6071 <td style="background:#f9f9f9;">Foo
6072 </td></tr></tbody></table>
6073 !! html/parsoid
6074 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
6075 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
6076 </tbody></table>
6077 !! end
6078
6079 # T107622
6080 !! test
6081 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
6082 !! wikitext
6083 {|
6084 |{{table_attribs_6}} hi
6085 |}
6086 !! html/php
6087 <table>
6088 <tbody><tr>
6089 <td style="background: red;">hi
6090 </td></tr></tbody></table>
6091 !! html/parsoid
6092 <table>
6093 <tbody><tr><td style="background: red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
6094 </tbody></table>
6095 !! end
6096
6097 !! test
6098 Extension tag in templated tag attribute
6099 !! wikitext
6100 {{1x|1=
6101 {{{!}} class="123" <nowiki />
6102 {{!}} hi
6103 {{!}}}
6104 }}
6105 !! html/php
6106 <table class="123">
6107 <tbody><tr>
6108 <td>hi
6109 </td></tr></tbody></table>
6110 !! html/parsoid
6111 <table class="123" about="#mwt2" typeof="mw:Transclusion mw:ExpandedAttrs" data-parsoid='{"startTagSrc":"{{{!}}","a":{"&lt;nowiki />":null},"sa":{"&lt;nowiki />":""},"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"attribs":[[{"txt":"","html":"&lt;span typeof=\"mw:Nowiki\">&lt;/span>"},{"html":""}]],"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"{{{!}} class=\"123\" &lt;nowiki />\n{{!}} hi\n{{!}}}"}},"i":0}}]}'>
6112 <tbody><tr><td>hi</td></tr>
6113 </tbody></table>
6114 !! end
6115
6116 !!test
6117 Templates: HTML Tables: 1. Generating start of a HTML table
6118 !! wikitext
6119 {{1x|<table><tr><td>foo</td>}}</tr></table>
6120 !! html
6121 <table><tbody><tr><td>foo</td></tr></tbody></table>
6122 !!end
6123
6124 !!test
6125 Templates: HTML Tables: 2a. Generating middle of a HTML table
6126 !! wikitext
6127 <table><tr>{{1x|<td>foo</td>}}</tr></table>
6128 !! html
6129 <table><tbody><tr><td>foo</td></tr></tbody></table>
6130 !!end
6131
6132 !!test
6133 Templates: HTML Tables: 2b. Generating middle of a HTML table
6134 !! wikitext
6135 <table>{{1x|<tr><td>foo</td></tr>}}</table>
6136 !! html
6137 <table><tbody><tr><td>foo</td></tr></tbody></table>
6138 !!end
6139
6140 !!test
6141 Templates: HTML Tables: 3. Generating end of a HTML table
6142 !! wikitext
6143 <table><tr>{{1x|<td>foo</td></tr></table>}}
6144 !! html
6145 <table><tbody><tr><td>foo</td></tr></tbody></table>
6146 !! end
6147
6148 !!test
6149 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6150 !! wikitext
6151 {{1x|<table>}}<tr><td>foo</td></tr></table>
6152 !! html
6153 <table><tbody><tr><td>foo</td></tr></tbody></table>
6154 !! end
6155
6156 !!test
6157 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6158 !! wikitext
6159 <table>{{1x|<tr>}}<td>foo</td></tr></table>
6160 !! html
6161 <table><tbody><tr><td>foo</td></tr></tbody></table>
6162 !! end
6163
6164 !!test
6165 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6166 !! wikitext
6167 <table><tr>{{1x|<td>}}foo</td></tr></table>
6168 !! html
6169 <table><tbody><tr><td>foo</td></tr></tbody></table>
6170 !! end
6171
6172 !!test
6173 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6174 !! wikitext
6175 <table><tr><td>foo{{1x|</td>}}</tr></table>
6176 !! html
6177 <table><tbody><tr><td>foo</td></tr></tbody></table>
6178 !! end
6179
6180 !!test
6181 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6182 !! wikitext
6183 <table><tr><td>foo</td>{{1x|</tr>}}</table>
6184 !! html
6185 <table><tbody><tr><td>foo</td></tr></tbody></table>
6186 !! end
6187
6188 !!test
6189 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6190 !! wikitext
6191 <table><tr><td>foo</td></tr>{{1x|</table>}}
6192 !! html
6193 <table><tbody><tr><td>foo</td></tr></tbody></table>
6194 !! end
6195
6196 !!test
6197 Templates: HTML Tables: 5. Proper fostering of categories from inside
6198 !!options
6199 parsoid=wt2html,wt2wt
6200 !! wikitext
6201 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
6202 <!--Two categories (T52330)-->
6203 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
6204 !! html/php
6205 <table><tbody><tr><td>foo</td></tr></tbody></table>
6206 <table><tbody><tr><td>foo</td></tr></tbody></table>
6207 !! html/parsoid
6208 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
6209 <!--Two categories (T52330)-->
6210 <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>
6211 !!end
6212
6213 ## Remex doesn't account for fostered content.
6214 !! test
6215 Templates: Wiki Tables: 1a. Fostering of entire template content
6216 !! wikitext
6217 {|
6218 {{1x|a}}
6219 |}
6220 !! html/php
6221
6222 a
6223 <table><tbody><tr><td></td></tr></tbody></table>
6224 !! html/parsoid
6225 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"a"}},"i":0}},"\n|}"]}'>a</p><table about="#mwt2">
6226
6227 </table>
6228 !! end
6229
6230 !!test
6231 Templates: Wiki Tables: 1b. Fostering of entire template content
6232 !! wikitext
6233 {|
6234 {{1x|<div>}}
6235 foo
6236 {{1x|</div>}}
6237 |}
6238 !! html/php
6239 <div>
6240 <p>foo
6241 </p>
6242 </div><table>
6243
6244 <tbody><tr><td></td></tr></tbody></table>
6245 !! html/parsoid
6246 <div about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"stx":"html","fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;div>"}},"i":0}},"\nfoo\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;/div>"}},"i":1}},"\n|}"]}'>
6247 <p>foo</p>
6248 </div><table about="#mwt3">
6249
6250 </table>
6251 !! end
6252
6253 ## Remex doesn't account for fostered content.
6254 !! test
6255 Templates: Wiki Tables: 2. Fostering of partial template content
6256 !! wikitext
6257 {|
6258 {{1x|a
6259 <div>b</div>}}
6260 |}
6261 !! html/php
6262
6263 a
6264 <div>b</div><table>
6265 <tbody><tr><td></td></tr></tbody></table>
6266 !! html/parsoid
6267 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"a\n&lt;div>b&lt;/div>"}},"i":0}},"\n|}"]}'>a</p><div about="#mwt2">b</div><table about="#mwt2">
6268
6269
6270 </table>
6271 !! end
6272
6273 !!test
6274 Templates: Wiki Tables: 3. td-content via multiple templates
6275 !! wikitext
6276 {|
6277 {{1x|{{pipe}}a}}{{1x|b}}
6278 |}
6279 !! html
6280 <table>
6281 <tbody><tr>
6282 <td>ab
6283 </td></tr></tbody></table>
6284 !! end
6285
6286 !!test
6287 Templates: Wiki Tables: 4. Templated tags, no content
6288 !! wikitext
6289 {{tbl-start}}
6290 {{tbl-end}}
6291 !! html/php
6292 <table>
6293 <tbody><tr><td></td></tr></tbody></table>
6294 !! html/parsoid
6295 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":1}}]}'>
6296 </table>
6297 !! end
6298
6299 !!test
6300 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6301 !! wikitext
6302 {{tbl-start}}
6303 |foo
6304 {{tbl-end}}
6305 !! html
6306 <table>
6307 <tbody><tr>
6308 <td>foo
6309 </td></tr></tbody></table>
6310 !! end
6311
6312 !!test
6313 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6314 !! wikitext
6315 {{tbl-start}}
6316 {{!}}foo
6317 {{tbl-end}}
6318 !! html
6319 <table>
6320 <tbody><tr>
6321 <td>foo
6322 </td></tr></tbody></table>
6323 !! end
6324
6325 !!article
6326 Template:UnclosedTableEndsWithTR
6327 !!text
6328 {|
6329 |-
6330 !!endarticle
6331
6332 !! test
6333 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
6334 !! wikitext
6335 {{UnclosedTableEndsWithTR}}
6336 <onlyinclude>
6337 |foo
6338 </onlyinclude>
6339 |}
6340
6341 <noinclude>
6342 {{UnclosedTableEndsWithTR}}
6343 </noinclude>
6344 |foo
6345 |}
6346 !! html/parsoid
6347 <meta typeof="mw:Transclusion mw:Includes/OnlyInclude" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"UnclosedTableEndsWithTR","href":"./Template:UnclosedTableEndsWithTR"},"params":{},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n|}"]}'/>
6348 <table about="#mwt1">
6349 <tbody><tr>
6350
6351 <td>foo
6352 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
6353 </tbody></table>
6354
6355 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
6356 <meta about="#mwt2" typeof="mw:Transclusion mw:Includes/NoInclude/End" data-mw='{"parts":[{"template":{"target":{"wt":"UnclosedTableEndsWithTR","href":"./Template:UnclosedTableEndsWithTR"},"params":{},"i":0}},"\n&lt;/noinclude>\n|foo\n|}"]}'/> <table about="#mwt2">
6357 <tbody><tr>
6358
6359 <td>foo</td></tr>
6360 </tbody></table>
6361 !! end
6362
6363 ## Parsoid standalone mode seems to drop nonexisting templates
6364 !! test
6365 Templates: Lists: Multi-line list-items via templates
6366 !! wikitext
6367 *{{1x|a {{nonexistent|
6368 unused}}}}
6369 *{{1x|b {{nonexistent|
6370 unused}}}}
6371 !! html/php
6372 <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>
6373 <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>
6374 !! html/parsoid
6375 <ul><li><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"a {{nonexistent|\nunused}}"}},"i":0}}]}'>a </span><a rel="mw:WikiLink" href="./Template:Nonexistent?action=edit&amp;redlink=1" title="Template:Nonexistent" about="#mwt1" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Template:Nonexistent"},"sa":{"href":"Template:Nonexistent"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Template:Nonexistent"]}}'>Template:Nonexistent</a></li>
6376 <li><span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"b {{nonexistent|\nunused}}"}},"i":0}}]}'>b </span><a rel="mw:WikiLink" href="./Template:Nonexistent?action=edit&amp;redlink=1" title="Template:Nonexistent" about="#mwt3" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Template:Nonexistent"},"sa":{"href":"Template:Nonexistent"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Template:Nonexistent"]}}'>Template:Nonexistent</a></li></ul>
6377 !! end
6378
6379 !!test
6380 Templates: Ugly nesting: 1. Quotes opened/closed across templates (1x)
6381 !! wikitext
6382 {{1x|''a}}{{1x|b''c''d}}{{1x|''e}}
6383 !! html
6384 <p><i>ab</i>c<i>d</i>e
6385 </p>
6386 !!end
6387
6388 ## Legacy parser generates misnested html
6389 !! test
6390 Templates: Ugly nesting: 2. Quotes opened/closed across templates (1x_with_span)
6391 !! wikitext
6392 {{1x_with_span|''a}}{{1x_with_span|b''c''d}}{{1x_with_span|''e}}
6393 !! html/parsoid
6394 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x_with_span","href":"./Template:1x_with_span"},"params":{"1":{"wt":"&apos;&apos;a"}},"i":0}}]}'><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"autoInsertedStart":true,"pi":[[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x_with_span","href":"./Template:1x_with_span"},"params":{"1":{"wt":"b&apos;&apos;c&apos;&apos;d"}},"i":0}},{"template":{"target":{"wt":"1x_with_span","href":"./Template:1x_with_span"},"params":{"1":{"wt":"&apos;&apos;e"}},"i":1}}]}'><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
6395 !! end
6396
6397 ## Legacy parser generates misnested html; Parsoid html2wt mode adds newlines between {{1x}}s
6398 !! test
6399 Templates: Ugly nesting: 3. Quotes opened/closed across templates (1x_with_div)
6400 !! options
6401 parsoid=wt2html,wt2wt
6402 !! wikitext
6403 {{1x_with_div|''a}}{{1x_with_div|b''c''d}}{{1x_with_div|''e}}
6404 !! html/php
6405 <div><i>a</i></div><div><i>b</i>c<i>d</i></div><div>e</div>
6406 !! html/parsoid
6407 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x_with_div","href":"./Template:1x_with_div"},"params":{"1":{"wt":"&apos;&apos;a"}},"i":0}}]}'><i>a</i></div>
6408 <div about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x_with_div","href":"./Template:1x_with_div"},"params":{"1":{"wt":"b&apos;&apos;c&apos;&apos;d"}},"i":0}}]}'><i>b</i>c<i>d</i></div>
6409 <div about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x_with_div","href":"./Template:1x_with_div"},"params":{"1":{"wt":"&apos;&apos;e"}},"i":0}}]}'>e</div>
6410 !! end
6411
6412 !! test
6413 Templates: Ugly nesting: 4. Divs opened/closed across templates
6414 !! wikitext
6415 a<div>b{{1x|c</div>d}}e
6416 !! html
6417 <p>a</p><div>bc</div><p>de</p>
6418 !! end
6419
6420 !! test
6421 Templates: Ugly templates: 3. newline-only template parameter
6422 !! wikitext
6423 foo {{1x|
6424 }}
6425 !! html
6426 <p>foo
6427 </p>
6428 !! end
6429
6430 # This looks like a bug: a single newline triggers p/br for some reason.
6431 !! test
6432 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6433 !! wikitext
6434 {{1x|
6435 }}
6436 !! html
6437 <p><br />
6438 </p>
6439 !! end
6440
6441 # T66017 -- ugly wikitext with fostered content generates two template ranges that
6442 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
6443 !! test
6444 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
6445 !! wikitext
6446 {{1x|<table>}}
6447 {{1x|<div>foo}}
6448 {{1x|</table>}}
6449 !! html/parsoid
6450 <div about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}'>foo</div><span about="#mwt1">
6451 </span><table about="#mwt1">
6452 </table>
6453 !! end
6454
6455 # T66017 -- ugly wikitext with fostered content generates two template ranges
6456 # that are "identical" and generate nesting cycles in the algorithm
6457 !! test
6458 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
6459 !! wikitext
6460 {{1x|<table><tr><td><table>}}
6461 {{1x|<div>}}
6462 {{1x|</div>}}
6463 !! html/parsoid
6464 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
6465 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
6466 </table></td></tr></tbody></table>
6467 !! end
6468
6469 !! test
6470 Templates: Parameters substituted at the top-level
6471 !! wikitext
6472 {{{foo|''who'' {{1x|me}}? '''never!'''}}}
6473
6474 {{{foo|bar|baz}}}
6475 !! html/php
6476 <p><i>who</i> me? <b>never!</b>
6477 </p><p>bar
6478 </p>
6479 !! html/parsoid
6480 <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{1x|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
6481
6482 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
6483 !! end
6484
6485 !! test
6486 Templates: Param with empty arg in the final position
6487 !! wikitext
6488 {{{hi|}}}
6489 !! html/parsoid
6490 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
6491 !! end
6492
6493 !! test
6494 Compound transclusion with template and top level templatearg
6495 !! wikitext
6496 {{1x|<table>}}
6497 {{{top|<td>123</td>}}}
6498 </table>
6499 !! html/php
6500 <table>
6501 <tbody><tr><td>123</td>
6502 </tr></tbody></table>
6503 !! html/parsoid
6504 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"templatearg":{"target":{"wt":"top"},"params":{"1":{"wt":"&lt;td>123&lt;/td>"}},"i":1}},"\n&lt;/table>"]}'>
6505 <tbody><tr><td>123</td></tr>
6506 </tbody></table>
6507 !! end
6508
6509 !!test
6510 Parser Functions: 1. Simple example
6511 !! wikitext
6512 {{uc:foo}}
6513 !! html
6514 <p>FOO
6515 </p>
6516 !!end
6517
6518 !!test
6519 Parser Functions: 2. Nested use (only outermost should be marked up)
6520 !! wikitext
6521 {{uc:{{lc:FOO}}}}
6522 !! html
6523 <p>FOO
6524 </p>
6525 !!end
6526
6527 ## Note that the templates inside the extension tag are not wrapped
6528 ## and that the extsrc attributes in integrated mode are missing
6529 ## the nested template (FIXME!)
6530 !! test
6531 Template nested in extension tag in template
6532 !! options
6533 title=[[Main Page]]
6534 language=zh
6535 !! wikitext
6536 {{1x|hi<span>[[ho|{{1x|hi}}]]</span>}}
6537 {{1x|hi<spantag>[[ho|{{1x|hi}}]]</spantag>}}
6538 {{1x|hi<spantag>[http://test.com?q={{1x|ho}}]</spantag>}}
6539 {{1x|hi<spantag>-{ho|{{1x|hi}}}-</spantag>}}
6540 !! html/php
6541 <p>hi<span><a href="/wiki/Ho" title="Ho">hi</a></span>
6542 hi<span><a href="/wiki/Ho" title="Ho">hi</a></span>
6543 hi<span><a rel="nofollow" class="external autonumber" href="http://test.com?q=ho">[1]</a></span>
6544 hi<span>hi</span>
6545 </p>
6546 !! html/parsoid
6547 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi&lt;span>[[ho|{{1x|hi}}]]&lt;/span>"}},"i":0}}]}'>hi</span><span about="#mwt1" data-parsoid='{"stx":"html"}'><a rel="mw:WikiLink" href="./Ho" title="Ho">hi</a></span>
6548 <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi&lt;spantag>[[ho|{{1x|hi}}]]&lt;/spantag>"}},"i":0}}]}'>hi</span><span about="#mwt2" typeof="mw:Extension/spantag" data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"[[ho|{{1x|hi}}]]"}}'><a rel="mw:WikiLink" href="./Ho" title="Ho">hi</a></span>
6549 <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi&lt;spantag>[http://test.com?q={{1x|ho}}]&lt;/spantag>"}},"i":0}}]}'>hi</span><span about="#mwt3" typeof="mw:Extension/spantag" data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"[http://test.com?q={{1x|ho}}]"}}'><a rel="mw:ExtLink" href="http://test.com?q=ho" class="external autonumber"></a></span>
6550 <span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi&lt;spantag>-{ho|{{1x|hi}}}-&lt;/spantag>"}},"i":0}}]}'>hi</span><span about="#mwt4" typeof="mw:Extension/spantag" data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"-{ho|{{1x|hi}}}-"}}'><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["ho"],"t":"hi"}}'></span></span></p>
6551 !! end
6552
6553 !! test
6554 ParserTest <spantag> tag, using data-mw.body serialization shortcut
6555 !! wikitext
6556 Hello <spantag>'''world'''!</spantag>
6557 !! html/php
6558 <p>Hello <span><b>world</b>!</span>
6559 </p>
6560 !! html/parsoid
6561 <p>Hello <span typeof="mw:Extension/spantag" data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"&apos;&apos;&apos;world&apos;&apos;&apos;!"}}'><b>world</b>!</span></p>
6562 !! end
6563
6564 !! test
6565 ParserTest <spantag> tag, without data-mw.body serialization shortcut
6566 !! options
6567 parsoid=html2wt
6568 !! wikitext
6569 Hello <spantag>'''world'''!</spantag>
6570 !! html/php
6571 <p>Hello <span><b>world</b>!</span>
6572 </p>
6573 !! html/parsoid
6574 <p>Hello <span typeof="mw:Extension/spantag" data-mw='{"name":"spantag","attrs":{}}'><b>world</b>!</span></p>
6575 !! end
6576
6577 !! test
6578 Parsoid: Recognize nowiki with odd capitalization
6579 !! options
6580 parsoid=wt2html
6581 !! wikitext
6582 <noWikI ><div>[[foo]]</Nowiki >
6583 !! html/php
6584 <p>&lt;div&gt;[[foo]]
6585 </p>
6586 !! html/parsoid
6587 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
6588 !! end
6589
6590
6591 !! test
6592 Parsoid: Escape nowiki with trailing space in tags
6593 !! options
6594 parsoid=html2wt
6595 !! html/parsoid
6596 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
6597 <p>a&lt;nowiki /&gt;b</p>
6598 <p>c&lt;nowiki/ &gt;d</p>
6599 !! wikitext
6600 &lt;nowiki &gt; foo &lt;/nowiki &gt;
6601
6602 a&lt;nowiki /&gt;b
6603
6604 c&lt;nowiki/ &gt;d
6605 !! end
6606
6607 !! test
6608 Parsoid: Escape weird noWikI capitalizations
6609 !! options
6610 parsoid=html2wt
6611 !! html/parsoid
6612 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
6613 !! wikitext
6614 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
6615 !! end
6616
6617 ###
6618 ### Message transform tests
6619 ###
6620 !! test
6621 message transform: magic variables
6622 !! options
6623 msg
6624 !! wikitext
6625 {{SITENAME}}
6626 !! html
6627 MediaWiki
6628 !! end
6629
6630 !! test
6631 message transform: should not transform wiki markup
6632 !! options
6633 msg
6634 !! wikitext
6635 ''test''
6636 !! html
6637 ''test''
6638 !! end
6639
6640 !! test
6641 message transform: <noinclude> in transcluded template (T6926)
6642 !! options
6643 msg
6644 !! wikitext
6645 {{Includes}}
6646 !! html/php
6647 Foobar
6648 !! html/parsoid
6649 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Includes","href":"./Template:Includes"},"params":{},"i":0}}]}'>Foobar</span></p>
6650 !! end
6651
6652 !! test
6653 message transform: <onlyinclude> in transcluded template (T6926)
6654 !! options
6655 msg
6656 !! wikitext
6657 {{Includes2}}
6658 !! html/php
6659 Foo
6660 !! html/parsoid+standalone
6661 <p><meta typeof="mw:Transclusion mw:Includes/OnlyInclude" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"Includes2","href":"./Template:Includes2"},"params":{},"i":0}}]}'/><span about="#mwt1">Foo</span><meta typeof="mw:Includes/OnlyInclude/End" about="#mwt1"/></p>
6662 !! html/parsoid+integrated
6663 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Includes2","href":"./Template:Includes2"},"params":{},"i":0}}]}'>Foo</span></p>
6664 !! end
6665
6666 !! test
6667 {{#special:}} page name, known
6668 !! options
6669 msg
6670 !! wikitext
6671 {{#special:Recentchanges}}
6672 !! html/php
6673 Special:RecentChanges
6674 !! html/parsoid
6675 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#special:Recentchanges","function":"special"},"params":{},"i":0}}]}'>Special:RecentChanges</span></p>
6676 !! end
6677
6678 !! test
6679 {{#special:}} page name with subpage, known
6680 !! options
6681 msg
6682 !! wikitext
6683 {{#special:Recentchanges/param}}
6684 !! html/php
6685 Special:RecentChanges/param
6686 !! html/parsoid+integrated
6687 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#special:Recentchanges/param","function":"special"},"params":{},"i":0}}]}'>Special:RecentChanges/param</span></p>
6688 !! end
6689
6690 !! test
6691 {{#special:}} page name, unknown
6692 !! options
6693 msg
6694 !! wikitext
6695 {{#special:foobar nonexistent}}
6696 !! html/php
6697 Special:Foobar nonexistent
6698 !! html/parsoid+integrated
6699 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#special:foobar nonexistent","function":"special"},"params":{},"i":0}}]}'>Special:Foobar nonexistent</span></p>
6700 !! end
6701
6702 !! test
6703 {{#speciale:}} page name, known
6704 !! options
6705 msg
6706 !! wikitext
6707 {{#speciale:Recentchanges}}
6708 !! html/php
6709 Special:RecentChanges
6710 !! html/parsoid+integrated
6711 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#speciale:Recentchanges","function":"speciale"},"params":{},"i":0}}]}'>Special:RecentChanges</span></p>
6712 !! end
6713
6714 !! test
6715 {{#speciale:}} page name with subpage, known
6716 !! options
6717 msg
6718 !! wikitext
6719 {{#speciale:Recentchanges/param}}
6720 !! html/php
6721 Special:RecentChanges/param
6722 !! html/parsoid+integrated
6723 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#speciale:Recentchanges/param","function":"speciale"},"params":{},"i":0}}]}'>Special:RecentChanges/param</span></p>
6724 !! end
6725
6726 !! test
6727 {{#speciale:}} page name, unknown
6728 !! options
6729 msg
6730 !! wikitext
6731 {{#speciale:foobar nonexistent}}
6732 !! html/php
6733 Special:Foobar_nonexistent
6734 !! html/parsoid+integrated
6735 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#speciale:foobar nonexistent","function":"speciale"},"params":{},"i":0}}]}'>Special:Foobar_nonexistent</span></p>
6736 !! end
6737
6738 ###
6739 ### Subpages
6740 ###
6741
6742 !! article
6743 Subpage test/subpage
6744 !! text
6745 foo
6746 !! endarticle
6747
6748 !! test
6749 Subpage link
6750 !! options
6751 subpage title=[[Subpage test]]
6752 !! wikitext
6753 [[/subpage]]
6754 !! html
6755 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
6756 </p>
6757 !! end
6758
6759 !! test
6760 Subpage noslash link
6761 !! options
6762 subpage title=[[Subpage test]]
6763 !! wikitext
6764 [[/subpage/]]
6765 !! html
6766 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
6767 </p>
6768 !! end
6769
6770 !! article
6771 Subpage test/1/2/subpage
6772 !! text
6773 blah
6774 !! endarticle
6775
6776 !! test
6777 Relative subpage noslash link
6778 !! options
6779 parsoid=wt2wt,wt2html,html2html
6780 subpage title=[[Subpage test/1/2/3/4]]
6781 !! wikitext
6782 [[../../subpage/]]
6783
6784 [[../../subpage]]
6785 !! html/php
6786 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
6787 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
6788 </p>
6789 !! html/parsoid
6790 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
6791 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a></p>
6792 !! end
6793
6794 !! test
6795 Parsoid: dot-slash prefixed wikilinks
6796 !! wikitext
6797 [[./foo]]
6798
6799 [[././bar]]
6800
6801 [[././baz/]]
6802 !! html/php
6803 <p>[[./foo]]
6804 </p><p>[[././bar]]
6805 </p><p>[[././baz/]]
6806 </p>
6807 !! html/parsoid
6808 <p>[[./foo]]
6809 </p><p>[[././bar]]
6810 </p><p>[[././baz/]]
6811 </p>
6812 !! end
6813
6814 !! test
6815 Render invalid page names as plain text (T53090)
6816 !! wikitext
6817 [[./../foo|bar]]
6818 [[foo�|bar]]
6819 [[foo/.|bar]]
6820 [[foo/..|bar]]
6821 [[foo~~~bar]]
6822 [[foo>bar]]
6823 [[foo[bar]]
6824 [[.]]
6825 [[..]]
6826 [[foo././bar]]
6827 [[foo[http://example.com]xyz]]
6828
6829 [[{{1x|./../foo}}|bar]]
6830 [[{{1x|foo/.}}|bar]]
6831 [[{{1x|foo/..}}|bar]]
6832 [[{{1x|foo~~~~bar}}]]
6833 [[{{1x|foo>bar}}]]
6834 [[{{1x|foo././bar}}]]
6835 [[{{1x|foo{bar}}]]
6836 [[{{1x|foo}bar}}]]
6837 [[{{1x|foo[bar}}]]
6838 [[{{1x|foo]bar}}]]
6839 [[{{1x|foo<bar}}]]
6840 !!html/php
6841 <p>[[./../foo|bar]]
6842 [[foo�|bar]]
6843 [[foo/.|bar]]
6844 [[foo/..|bar]]
6845 [[foo~~~bar]]
6846 [[foo&gt;bar]]
6847 [[foo[bar]]
6848 [[.]]
6849 [[..]]
6850 [[foo././bar]]
6851 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
6852 </p><p>[[./../foo|bar]]
6853 [[foo/.|bar]]
6854 [[foo/..|bar]]
6855 [[foo~~~~bar]]
6856 [[foo&gt;bar]]
6857 [[foo././bar]]
6858 [[foo{bar]]
6859 [[foo}bar]]
6860 [[foo[bar]]
6861 [[foo]bar]]
6862 [[foo&lt;bar]]
6863 </p>
6864 !!html/parsoid
6865 <p>[[./../foo|bar]]
6866 [[foo�|bar]]
6867 [[foo/.|bar]]
6868 [[foo/..|bar]]
6869 [[foo~~~bar]]
6870 [[foo>bar]]
6871 [[foo[bar]]
6872 [[.]]
6873 [[..]]
6874 [[foo././bar]]
6875 [[foo<a rel="mw:ExtLink" href="http://example.com" class="external autonumber"></a>xyz]]</p>
6876
6877 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
6878 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
6879 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
6880 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
6881 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
6882 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
6883 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
6884 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
6885 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
6886 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
6887 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
6888 !!end
6889
6890 !! test
6891 Disabled subpages
6892 !! wikitext
6893 [[/subpage]]
6894 !! html/php
6895 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
6896 </p>
6897 !! html/parsoid
6898 <p><a rel="mw:WikiLink" href=".//subpage?action=edit&amp;redlink=1" title="/subpage" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":".//subpage"},"sa":{"href":"/subpage"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["/subpage"]}}'>/subpage</a></p>
6899 !! end
6900
6901 !! test
6902 T2561: {{/Subpage}}
6903 !! options
6904 subpage title=[[Page]]
6905 !! wikitext
6906 {{/Subpage}}
6907 !! html/php
6908 <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>
6909 </p>
6910 !! html/parsoid
6911 <p><a rel="mw:WikiLink" href="./Page/Subpage?action=edit&amp;redlink=1" title="Page/Subpage" about="#mwt1" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./Page/Subpage"},"sa":{"href":"Page/Subpage"},"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"/Subpage","href":"./Page/Subpage"},"params":{},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Page/Subpage"]}}'>Page/Subpage</a></p>
6912 !! end
6913
6914 !! test
6915 Subpage with namespaces
6916 !! options
6917 subpage title=[[Subpage test/1/2/3/4]]
6918 !! wikitext
6919 [[User:../subpage]]
6920 [[meatball:../subpage]]
6921 !! html
6922 <p>[[User:../subpage]]
6923 [[meatball:../subpage]]
6924 </p>
6925 !! end
6926
6927 !! test
6928 T335847: Resolve forward slash title
6929 !! options
6930 subpage title=[[/]]
6931 !! config
6932 wgParserEnableLegacyHeadingDOM=false
6933 !! wikitext
6934 ===123===
6935 !! html/php
6936 <div class="mw-heading mw-heading3"><h3 id="123">123</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=/&amp;action=edit&amp;section=1" title="Edit section: 123">edit</a><span class="mw-editsection-bracket">]</span></span></div>
6937 !! html/parsoid
6938 <h3 id="123" data-parsoid="{}">123</h3>
6939 !! end
6940
6941 ## The next two tests capture an inconsistency between relative link parsing on
6942 ## the "/" page in the legacy parser. Parsoid's output seems preferable.
6943
6944 !! test
6945 T335847: Resolve subpage of control title
6946 !! options
6947 subpage title=[[Asdf]]
6948 !! wikitext
6949 [[../Hi]]
6950 !! html/php
6951 <p>[[../Hi]]
6952 </p>
6953 !! html/parsoid
6954 <p>[[../Hi]]</p>
6955 !! end
6956
6957 !! test
6958 T335847: Resolve subpage of forward slash title
6959 !! options
6960 subpage title=[[/]]
6961 !! wikitext
6962 [[../Hi]]
6963 !! html/php
6964 <p><a href="/index.php?title=/Hi&amp;action=edit&amp;redlink=1" class="new" title="/Hi (page does not exist)">/Hi</a>
6965 </p>
6966 !! html/parsoid
6967 <p>[[../Hi]]</p>
6968 !! end
6969
6970 ###
6971 ### Categories
6972 ###
6973 !! article
6974 Category:MediaWiki User's Guide
6975 !! text
6976 blah
6977 !! endarticle
6978
6979 !! test
6980 Link to category
6981 !! options
6982 cat
6983 !! wikitext
6984 [[:Category:MediaWiki User's Guide]]
6985 !! metadata
6986 !! html
6987 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
6988 </p>
6989 !! end
6990
6991 !! test
6992 Simple category
6993 !! options
6994 cat
6995 !! metadata
6996 cat=MediaWiki_User's_Guide sort=
6997 !! wikitext
6998 [[Category:MediaWiki User's Guide]]
6999 !! html/php
7000 !! html/parsoid
7001 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
7002 !! end
7003
7004 !! test
7005 Simple category with whitespace as sort key
7006 !! options
7007 cat
7008 !! metadata
7009 cat=Foo sort=
7010 !! wikitext
7011 [[Category:Foo| ]]
7012 !! html/php
7013 !! html/parsoid
7014 <link rel="mw:PageProp/Category" href="./Category:Foo#%20" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo#%20"},"sa":{"href":"Category:Foo#%20"}}'/>
7015 !! end
7016
7017 !! test
7018 PAGESINCATEGORY invalid title fatal (r33546 fix)
7019 !! wikitext
7020 {{PAGESINCATEGORY:<bogus>}}
7021 !! html
7022 <p>0
7023 </p>
7024 !! end
7025
7026 !! test
7027 Category with different sort key
7028 !! options
7029 cat
7030 !! metadata
7031 cat=MediaWiki_User's_Guide sort=Foo
7032 !! wikitext
7033 [[Category:MediaWiki User's Guide|Foo]]
7034 !! html/php
7035 !! html/parsoid
7036 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
7037 !! end
7038
7039 !! test
7040 Category with identical sort key
7041 !! options
7042 cat
7043 !! metadata
7044 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
7045 !! wikitext
7046 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7047 !! html/php
7048 !! html/parsoid
7049 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
7050 !! end
7051
7052 !! test
7053 Category with identical sort key, except underscores
7054 !! options
7055 cat
7056 !! metadata
7057 cat=MediaWiki_User's_Guide sort=MediaWiki_User's_Guide
7058 !! wikitext
7059 [[Category:MediaWiki User's Guide|MediaWiki_User's_Guide]]
7060 !! html/php
7061 !! html/parsoid
7062 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki_User's_Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
7063 !! end
7064
7065 !! test
7066 Category with newline in sort key
7067 !! options
7068 cat
7069 parsoid=wt2html,html2html
7070 !! wikitext
7071 [[Category:Wikidata:Tools|
7072 *]]
7073 !! metadata
7074 cat=Wikidata:Tools sort=
7075 *
7076 !! html/php
7077 !! html/parsoid
7078 <link rel="mw:PageProp/Category" href="./Category:Wikidata:Tools#*"/>
7079 !! end
7080
7081 !! test
7082 Category with template-generated sort key
7083 !! options
7084 cat
7085 !! metadata
7086 cat=MediaWiki_User's_Guide sort=MediaWiki Foo Guide
7087 !! wikitext
7088 [[Category:MediaWiki User's Guide|MediaWiki {{1x|Foo}} Guide]]
7089 !! html/php
7090 !! html/parsoid
7091 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20Foo%20Guide" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"mw:sortKey"},{"html":"MediaWiki &lt;span typeof=\"mw:Transclusion\" data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&apos;>Foo&lt;/span> Guide"}]]}'/>
7092 !! end
7093
7094 ## We used to, but no longer wt2wt this test since the default serializer
7095 ## will normalize all categories to serialize on their own line.
7096 ## This wikitext usage is going to be fairly uncommon in production and
7097 ## selser will take care of preserving formatting in those scenarios.
7098 !! test
7099 Category / paragraph interactions
7100 !! options
7101 parsoid=wt2html
7102 !! wikitext
7103 Foo [[Category:Baz]] Bar
7104
7105 Foo [[Category:Baz]]
7106 Bar
7107
7108 Foo
7109 [[Category:Baz]]
7110 Bar
7111
7112 Foo
7113 [[Category:Baz]] Bar
7114
7115 Foo
7116 [[Category:Baz]]
7117 [[Category:Baz]]
7118 [[Category:Baz]]
7119 Bar
7120
7121 [[Category:Baz]]
7122 [[Category:Baz]]
7123 [[Category:Baz]]
7124
7125 [[Category:Baz]]
7126 {{1x|[[Category:Baz]]}}
7127 [[Category:Baz]]
7128 !! html/php
7129 <p>Foo Bar
7130 </p><p>Foo
7131 Bar
7132 </p><p>Foo
7133 Bar
7134 </p><p>Foo Bar
7135 </p><p>Foo
7136 Bar
7137 </p>
7138 !! html/parsoid
7139 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
7140 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
7141 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
7142 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
7143 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
7144 <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/>
7145 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
7146 !! end
7147
7148 ## We used to, but no longer wt2wt this test since the default serializer
7149 ## will normalize all categories to serialize on their own line.
7150 ## This wikitext usage is going to be fairly uncommon in production and
7151 ## selser will take care of preserving formatting in those scenarios.
7152 !! test
7153 Category / non-newline whitespace interactions (T359886)
7154 !! options
7155 parsoid=wt2html
7156 !! wikitext
7157 * Foo[[Category:Foo]]Bar
7158 * Foo[[Category:Foo]] Bar
7159 * Foo [[Category:Foo]]Bar
7160 * Foo [[Category:Foo]] Bar
7161
7162 * Foo[[Category:Foo]][[Category:Bar]]Bar
7163 * Foo[[Category:Foo]][[Category:Bar]] Bar
7164 * Foo[[Category:Foo]] [[Category:Bar]]Bar
7165 * Foo[[Category:Foo]] [[Category:Bar]] Bar
7166 * Foo [[Category:Foo]][[Category:Bar]]Bar
7167 * Foo [[Category:Foo]][[Category:Bar]] Bar
7168 * Foo [[Category:Foo]] [[Category:Bar]]Bar
7169 * Foo [[Category:Foo]] [[Category:Bar]] Bar
7170 !! html/php
7171 <ul><li>FooBar</li>
7172 <li>Foo Bar</li>
7173 <li>Foo Bar</li>
7174 <li>Foo Bar</li></ul>
7175 <ul><li>FooBar</li>
7176 <li>Foo Bar</li>
7177 <li>Foo Bar</li>
7178 <li>Foo Bar</li>
7179 <li>Foo Bar</li>
7180 <li>Foo Bar</li>
7181 <li>Foo Bar</li>
7182 <li>Foo Bar</li></ul>
7183 !! html/parsoid
7184 <ul>
7185 <li>Foo<link rel="mw:PageProp/Category" href="./Category:Foo"/>Bar</li>
7186 <li>Foo<link rel="mw:PageProp/Category" href="./Category:Foo"/> Bar</li>
7187 <li>Foo <link rel="mw:PageProp/Category" href="./Category:Foo"/>Bar</li>
7188 <li>Foo <link rel="mw:PageProp/Category" href="./Category:Foo"/> Bar</li>
7189 </ul>
7190 <ul>
7191 <li>Foo<link rel="mw:PageProp/Category" href="./Category:Foo"/><link rel="mw:PageProp/Category" href="./Category:Bar"/>Bar</li>
7192 <li>Foo<link rel="mw:PageProp/Category" href="./Category:Foo"/><link rel="mw:PageProp/Category" href="./Category:Bar"/> Bar</li>
7193 <li>Foo<link rel="mw:PageProp/Category" href="./Category:Foo"/> <link rel="mw:PageProp/Category" href="./Category:Bar"/>Bar</li>
7194 <li>Foo<link rel="mw:PageProp/Category" href="./Category:Foo"/> <link rel="mw:PageProp/Category" href="./Category:Bar"/> Bar</li>
7195 <li>Foo <link rel="mw:PageProp/Category" href="./Category:Foo"/><link rel="mw:PageProp/Category" href="./Category:Bar"/>Bar</li>
7196 <li>Foo <link rel="mw:PageProp/Category" href="./Category:Foo"/><link rel="mw:PageProp/Category" href="./Category:Bar"/> Bar</li>
7197 <li>Foo <link rel="mw:PageProp/Category" href="./Category:Foo"/> <link rel="mw:PageProp/Category" href="./Category:Bar"/>Bar</li>
7198 <li>Foo <link rel="mw:PageProp/Category" href="./Category:Foo"/> <link rel="mw:PageProp/Category" href="./Category:Bar"/> Bar</li>
7199 </ul>
7200 !! end
7201
7202 ## Same as the above test, but with equally-invisible interlanguage links
7203 !! test
7204 Language link / non-newline whitespace interactions (T359886)
7205 !! options
7206 parsoid=wt2html
7207 !! wikitext
7208 * Foo[[es:Foo]]Bar
7209 * Foo[[es:Foo]] Bar
7210 * Foo [[es:Foo]]Bar
7211 * Foo [[es:Foo]] Bar
7212
7213 * Foo[[es:Foo]][[es:Bar]]Bar
7214 * Foo[[es:Foo]][[es:Bar]] Bar
7215 * Foo[[es:Foo]] [[es:Bar]]Bar
7216 * Foo[[es:Foo]] [[es:Bar]] Bar
7217 * Foo [[es:Foo]][[es:Bar]]Bar
7218 * Foo [[es:Foo]][[es:Bar]] Bar
7219 * Foo [[es:Foo]] [[es:Bar]]Bar
7220 * Foo [[es:Foo]] [[es:Bar]] Bar
7221 !! html/php
7222 <ul><li>FooBar</li>
7223 <li>Foo Bar</li>
7224 <li>Foo Bar</li>
7225 <li>Foo Bar</li></ul>
7226 <ul><li>FooBar</li>
7227 <li>Foo Bar</li>
7228 <li>Foo Bar</li>
7229 <li>Foo Bar</li>
7230 <li>Foo Bar</li>
7231 <li>Foo Bar</li>
7232 <li>Foo Bar</li>
7233 <li>Foo Bar</li></ul>
7234 !! html/parsoid
7235 <ul>
7236 <li>Foo<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"/>Bar</li>
7237 <li>Foo<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"/> Bar</li>
7238 <li>Foo <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"/>Bar</li>
7239 <li>Foo <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"/> Bar</li>
7240 </ul>
7241 <ul>
7242 <li>Foo<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"/><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Bar"/>Bar</li>
7243 <li>Foo<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"/><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Bar"/> Bar</li>
7244 <li>Foo<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"/> <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Bar"/>Bar</li>
7245 <li>Foo<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"/> <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Bar"/> Bar</li>
7246 <li>Foo <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"/><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Bar"/>Bar</li>
7247 <li>Foo <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"/><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Bar"/> Bar</li>
7248 <li>Foo <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"/> <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Bar"/>Bar</li>
7249 <li>Foo <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"/> <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Bar"/> Bar</li>
7250 </ul>
7251 !! end
7252
7253 ## We used to, but no longer wt2wt this test since the default serializer
7254 ## will normalize all categories to serialize on their own line.
7255 ## This wikitext usage is going to be fairly uncommon in production and
7256 ## selser will take care of preserving formatting in those scenarios.
7257 ##
7258 ## The whitespace on the empty line is part of the test. Please do not delete
7259 !! test
7260 1. cats/langlinks and newlines: All preceding newlines should be suppressed (courtesy T2087)
7261 !! options
7262 parsoid=wt2html
7263 !! wikitext
7264 This
7265
7266 [[Category:Foo]] and this
7267 [[es:Foo]] and this should be part of same paragraph (not an indent-pre)
7268
7269 {{1x|[[Category:Foo]] and so should this!}}
7270 {{1x|[[es:Foo]] and this!}}
7271 !! html/php
7272 <p>This and this and this should be part of same paragraph (not an indent-pre) and so should this! and this!
7273 </p>
7274 !! html/parsoid
7275 <p>This
7276
7277 <link rel="mw:PageProp/Category" href="./Category:Foo" /> and this
7278 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" /> and this should be part of same paragraph (not an indent-pre)
7279
7280 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[Category:Foo]] and so should this!"}},"i":0}}]}'/><span about="#mwt1"> and so should this!</span>
7281 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[es:Foo]] and this!"}},"i":0}}]}'/><span about="#mwt2"> and this!</span></p>
7282 !! end
7283
7284 ## Parsoid will not try to wt2wt this while preserving newlines because
7285 ## it suppresses excess newlines within list items -- and we don't want to
7286 ## introduce a special case just for categories, which is, in reality somewhat
7287 ## odd behavior -- categories are unlikely to be used in list items like this
7288 ## in top-level pages and are only likely to show up in template-generated
7289 ## list items where this RT-ing is a non-issue.
7290 ##
7291 ## The whitespace on the empty line is part of the test. Please do not delete
7292 !! test
7293 2. cats/langlinks and newlines: All preceding newlines should be suppressed (courtesy T2087)
7294 !! options
7295 parsoid=wt2html
7296 !! wikitext
7297 * This
7298
7299 [[Category:Foo]] and this
7300 [[es:Foo]] and this should be part of the same list item
7301 * So should this
7302
7303 {{1x|[[Category:Foo]] and this}}
7304 {{1x|[[es:Foo]] and this should be part of the same list item}}
7305 !! html/php
7306 <ul><li>This and this and this should be part of the same list item</li>
7307 <li>So should this and this and this should be part of the same list item</li></ul>
7308 !! html/parsoid
7309 <ul><li>This
7310
7311 <link rel="mw:PageProp/Category" href="./Category:Foo" /> and this
7312 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" /> and this should be part of the same list item</li>
7313 <li>So should this
7314
7315 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[Category:Foo]] and this"}},"i":0}}]}'/><span about="#mwt1"> and this</span>
7316 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[es:Foo]] and this should be part of the same list item"}},"i":0}}]}'/><span about="#mwt2"> and this should be part of the same list item</span></li></ul>
7317 !! end
7318
7319 ## Newlines and categories that follow the last item of a list
7320 ## are treated differently because this (list followed by categories)
7321 ## is an extremely common pattern on wikis.
7322 !! test
7323 3. cats/langlinks and newlines: newline suppression for last list item should RT properly
7324 !! wikitext
7325 *a
7326 *b
7327
7328 [[Category:Foo]]
7329
7330 [[Category:Bar]]
7331 [[Category:Baz]]
7332 [[es:Foo]]
7333
7334 :c
7335
7336 [[Category:C]]
7337
7338 ;d
7339
7340 [[Category:D]]
7341 [[es:Bar]]
7342 !! html/parsoid
7343 <ul><li>a</li>
7344 <li>b</li></ul>
7345
7346 <link rel="mw:PageProp/Category" href="./Category:Foo" />
7347
7348 <link rel="mw:PageProp/Category" href="./Category:Bar" />
7349 <link rel="mw:PageProp/Category" href="./Category:Baz" />
7350 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" />
7351
7352 <dl><dd>c</dd></dl>
7353
7354 <link rel="mw:PageProp/Category" href="./Category:C" />
7355
7356 <dl><dt>d</dt></dl>
7357
7358 <link rel="mw:PageProp/Category" href="./Category:D" />
7359 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Bar" />
7360 !! end
7361
7362 !! test
7363 4. cats/langlinks: newline suppression for last list item should RT properly
7364 !! wikitext
7365 *a
7366 ****b
7367
7368 [[Category:Foo]]
7369 [[es:Foo]]
7370 !! html/parsoid
7371 <ul><li>a
7372 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
7373
7374 <link rel="mw:PageProp/Category" href="./Category:Foo" />
7375 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" />
7376 !! end
7377
7378 ## only wt2html for this to make sure the algo only applies to the rightmost path
7379 !! test
7380 5. cats/langlinks: migrateTrailingSolTransparentLinks dom pass should only run on the rightmost path of nested lists
7381 !! options
7382 parsoid=wt2html
7383 !! wikitext
7384 *a
7385 **b
7386 [[Category:Foo]]
7387 *c
7388 **d
7389 [[Category:Foo]]
7390 [[es:Foo]]
7391 !! html/parsoid
7392 <ul><li>a
7393 <ul><li>b
7394 <link rel="mw:PageProp/Category" href="./Category:Foo" /></li></ul></li>
7395 <li>c
7396 <ul><li>d</li></ul></li></ul>
7397 <link rel="mw:PageProp/Category" href="./Category:Foo" />
7398 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" />
7399 !! end
7400
7401 ## We used to, but no longer wt2wt this test since the default serializer
7402 ## will normalize all categories to serialize on their own line.
7403 ## This wikitext usage is going to be fairly uncommon in production and
7404 ## selser will take care of preserving formatting in those scenarios.
7405 !! test
7406 6. cats/langlinks: migrateTrailingSolTransparentLinks dom pass should not migrate them when not preceded by newlines
7407 !! options
7408 parsoid=wt2html
7409 !! wikitext
7410 *a [[Category:Foo]]
7411 *b [[es:Foo]]
7412 !! html/parsoid
7413 <ul><li>a<link rel="mw:PageProp/Category" href="./Category:Foo" /></li>
7414 <li>b<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" /></li></ul>
7415 !! end
7416
7417 # This test also demonstrates because of newline+category tunneling
7418 # through the list hander, template wrapping doesn't expand to the
7419 # containing list when the list item swallows the category.
7420 !! test
7421 7. cats/langlinks: migrateTrailingSolTransparentLinks dom pass should leave template content alone
7422 !! wikitext
7423 *{{1x|a
7424 [[Category:Foo]]
7425 [[es:Foo]]}}
7426 !! html/parsoid
7427 <ul><li><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"a\n[[Category:Foo]]\n[[es:Foo]]"}},"i":0}}]}'>a
7428 </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" /><span about="#mwt1">
7429 </span><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" about="#mwt1"/></li></ul>
7430 !! end
7431
7432 !! test
7433 8. cats/langlinks: migrateTrailingSolTransparentLinks dom pass should not get tripped by intervening templates
7434 !! wikitext
7435 *a
7436
7437 {{1x|[[Category:Foo]]
7438 [[Category:Bar]]}}
7439 [[Category:Baz]]
7440 [[es:Baz]]
7441 !! html/parsoid
7442 <ul><li>a</li></ul>
7443
7444 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
7445 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
7446 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
7447 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Baz" />
7448 !! end
7449
7450 !! test
7451 cats/langlinks: migrateTrailingSolTransparentLinks dom pass should not get tripped by comments and whitespace
7452 !! wikitext
7453 *a
7454
7455 [[Category:Bar]]<!--boo1--> <!--boo2-->
7456 [[Category:Baz]]<!--boo3--> <!--boo4-->
7457 [[es:Foo]]<!--boo5--> <!--boo6-->
7458 !! html/parsoid
7459 <ul><li>a</li></ul>
7460
7461 <link rel="mw:PageProp/Category" href="./Category:Bar" /><!--boo1--> <!--boo2-->
7462 <link rel="mw:PageProp/Category" href="./Category:Baz" /><!--boo3--> <!--boo4-->
7463 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" /><!--boo5--> <!--boo6-->
7464 !! end
7465
7466 !! test
7467 Categories and newlines: should behave properly with linkprefix (T87753)
7468 !! options
7469 language=ar
7470 !! wikitext
7471 foo bar
7472 foo bar
7473 [[تصنيف:Foo]]
7474 [[تصنيف:Bar]]
7475 !! html/php
7476 <p>foo bar
7477 foo bar
7478 </p>
7479 !! html/parsoid
7480 <p>foo bar
7481 foo bar</p>
7482 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
7483 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
7484 !! end
7485
7486 !! test
7487 No regressions on internal links following category (T174639)
7488 !! options
7489 parsoid=wt2html,html2html
7490 !! wikitext
7491 [[Category:Foo]]<div>a
7492
7493 [[Foo]]</div>
7494 !! html/php
7495 <div>a
7496 <a href="/wiki/Foo" title="Foo">Foo</a></div>
7497 !! html/parsoid
7498 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
7499
7500 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
7501 !! end
7502
7503 # Note that Parsoid differs slightly from PHP due to T175421
7504 !! test
7505 11. Special case where only newlines separate links (T175416)
7506 !! options
7507 parsoid=wt2html,html2html
7508 !! wikitext
7509 [[Category:Foo]]
7510
7511 [[Foo]][[es:Alimento]]
7512
7513 [[Foo]]
7514 !! html/php
7515 <p><br />
7516 <a href="/wiki/Foo" title="Foo">Foo</a>
7517 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
7518 </p>
7519 !! html/parsoid
7520 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
7521
7522 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
7523
7524 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
7525 !! end
7526
7527 !! test
7528 Category links with multiple namespaces
7529 !! wikitext
7530 [[Category:Project:Foo]]
7531 !! html/parsoid
7532 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
7533 !! end
7534
7535 !! test
7536 Parsoid: Serialize link to category page with colon escape
7537 !! wikitext
7538 [[:Category:Foo]]
7539 [[:Category:Foo|Bar]]
7540 !! html/php
7541 <p><a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Category:Foo</a>
7542 <a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Bar</a>
7543 </p>
7544 !! html/parsoid
7545 <p><a rel="mw:WikiLink" href="./Category:Foo?action=edit&amp;redlink=1" title="Category:Foo" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":":Category:Foo"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Category:Foo"]}}'>Category:Foo</a>
7546 <a rel="mw:WikiLink" href="./Category:Foo?action=edit&amp;redlink=1" title="Category:Foo" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"piped","a":{"href":"./Category:Foo"},"sa":{"href":":Category:Foo"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Category:Foo"]}}'>Bar</a></p>
7547 !! end
7548
7549 # We used to, but no longer wt2wt this test since the default serializer
7550 # will normalize all categories to serialize on their own line.
7551 # This wikitext usage is going to be fairly uncommon in production and
7552 # selser will take care of preventing whitespace insertion if this
7553 # occurs in an article.
7554 #
7555 # html2html disabled for the same reason (whitespace insertion between
7556 # x and y).
7557 #
7558 # html2wt disabled because it localizes the "Category" namespace.
7559 !! test
7560 Link prefix/suffixes aren't applied to category links
7561 !! options
7562 parsoid=wt2html
7563 language=is
7564 !! wikitext
7565 x[[Category:Foo]]y
7566 !! html/php
7567 <p>xy
7568 </p>
7569 !! html/parsoid
7570 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
7571 !! end
7572
7573 !! test
7574 Link prefix/suffixes aren't applied to language links
7575 !! options
7576 parsoid=wt2html
7577 language=is
7578 !! wikitext
7579 x[[es:Foo]]y
7580 !! html/php
7581 <p>xy
7582 </p>
7583 !! html/parsoid
7584 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
7585 !! end
7586
7587 !! test
7588 Parsoid: Serialize link to file page with colon escape
7589 !! wikitext
7590
7591 [[:File:Foo.png]]
7592 [[:File:Foo.png|Bar]]
7593 !! html/php
7594 <p><a href="/index.php?title=File:Foo.png&amp;action=edit&amp;redlink=1" class="new" title="File:Foo.png (page does not exist)">File:Foo.png</a>
7595 <a href="/index.php?title=File:Foo.png&amp;action=edit&amp;redlink=1" class="new" title="File:Foo.png (page does not exist)">Bar</a>
7596 </p>
7597 !! html/parsoid
7598
7599 <p><a rel="mw:WikiLink" href="./File:Foo.png?action=edit&amp;redlink=1" title="File:Foo.png" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./File:Foo.png"},"sa":{"href":":File:Foo.png"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["File:Foo.png"]}}'>File:Foo.png</a>
7600 <a rel="mw:WikiLink" href="./File:Foo.png?action=edit&amp;redlink=1" title="File:Foo.png" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"piped","a":{"href":"./File:Foo.png"},"sa":{"href":":File:Foo.png"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["File:Foo.png"]}}'>Bar</a></p>
7601 !! end
7602
7603 !! test
7604 Parsoid: Serialize a genuine category link without colon escape
7605 !! wikitext
7606 [[Category:Foo]]
7607 [[Category:Foo|Bar]]
7608 !! html/php
7609 !! html/parsoid
7610 <link rel="mw:PageProp/Category" href="./Category:Foo">
7611 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
7612 !! end
7613
7614 !! test
7615 Normalize hrefs properly before testing for invalid link targets (T72894)
7616 !! options
7617 parsoid=html2wt
7618 !! html/parsoid
7619 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
7620 !! wikitext
7621 [[Category:Toxine bactérienne]]
7622 !! end
7623
7624 !! article
7625 Template:emptytemplate
7626 !! text
7627 !! endarticle
7628
7629 !! test
7630 Empty templates should be handled properly without being redlinked
7631 !! options
7632 parsoid=wt2html
7633 !! wikitext
7634 {{emptytemplate}}
7635 !! html/php
7636 !! html/parsoid
7637 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"emptytemplate","href":"./Template:Emptytemplate"},"params":{},"i":0}}]}'></span>
7638 !! end
7639
7640 !! test
7641 Parsoid: Defaultsort
7642 !! wikitext
7643 {{DEFAULTSORT:Foo}}
7644 !! html/parsoid+integrated
7645 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DEFAULTSORT:Foo","function":"defaultsort"},"params":{},"i":0}}]}'></span>
7646 !! end
7647
7648 !! test
7649 Parsoid: Defaultsort variations (T236846)
7650 !! wikitext
7651 {{DEFAULTSORT}}
7652
7653 {{DEFAULTSORT:}}
7654 {{DEFAULTSORT:DOGGIE}}
7655 !! html/php
7656 <p><a href="/index.php?title=Template:DEFAULTSORT&amp;action=edit&amp;redlink=1" class="new" title="Template:DEFAULTSORT (page does not exist)">Template:DEFAULTSORT</a>
7657 </p><p><br />
7658 </p>
7659 !! html/parsoid+integrated
7660 <p><a rel="mw:WikiLink" href="./Template:DEFAULTSORT?action=edit&amp;redlink=1" title="Template:DEFAULTSORT" about="#mwt1" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./Template:DEFAULTSORT"},"sa":{"href":"Template:DEFAULTSORT"},"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"DEFAULTSORT","href":"./Template:DEFAULTSORT"},"params":{},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Template:DEFAULTSORT"]}}'>Template:DEFAULTSORT</a></p>
7661
7662 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DEFAULTSORT:","function":"defaultsort"},"params":{},"i":0}}]}'></span>
7663 <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DEFAULTSORT:DOGGIE","function":"defaultsort"},"params":{},"i":0}}]}'></span>
7664 !! end
7665
7666 # Can be removed when T335843 is addressed
7667 !! test
7668 Parsoid html2wt b/c check: Defaultsort with key content being added (T236846)
7669 !! options
7670 parsoid=html2wt
7671 !! html/parsoid
7672 <meta property="mw:PageProp/categorydefaultsort" content="BIRD" data-parsoid='{"src":"{{DEFAULTSORT}}"}'/>
7673 !! wikitext
7674 {{DEFAULTSORT:BIRD}}
7675 !! end
7676
7677 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
7678 # But, this is a limitation of our representation and is documented in
7679 # TemplateHandler.php in processSpecialMagicWord
7680 !! test
7681 Parsoid: Defaultsort (template-generated)
7682 !! wikitext
7683 {{{{1x|DEFAULTSORT}}:Foo}}
7684 !! html/parsoid+integrated
7685 <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{1x|DEFAULTSORT}}:Foo","function":"defaultsort"},"params":{},"i":0}}]}'></span>
7686 !! end
7687
7688 !! test
7689 {{defaultsort}} should be location-independent (T353530)
7690 !! options
7691 cat
7692 !! wikitext
7693 [[Category:Foo]]
7694 {{DEFAULTSORT:Bar}}
7695 [[Category:Bat]]
7696 !! metadata
7697 cat=Foo sort=Bar
7698 cat=Bat sort=Bar
7699 !! end
7700
7701 ###
7702 ### Inter-language links
7703 ###
7704 !! test
7705 Interlanguage links
7706 !! options
7707 ill
7708 !! wikitext
7709 [[es:Alimento]]
7710 [[fr:Nourriture]]
7711 [[zh:食品]]
7712 !! metadata
7713 ill=es:Alimento
7714 ill=fr:Nourriture
7715 ill=zh:食品
7716 !! html/php
7717 !! html/parsoid
7718 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
7719 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
7720 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
7721 !! end
7722
7723 # Integrated-mode parsoid behavior will match other modes after
7724 # I82a05a51d94782ebb9fa87ff889ca0f633b3e15c is merged in core.
7725 !! test
7726 Duplicate interlanguage links (T26502)
7727 !! options
7728 ill
7729 !! wikitext
7730 [[es:1]]
7731 [[es:2]]
7732 [[fr:1]]
7733 [[fr:2]]
7734 !! metadata
7735 ill=es:1
7736 ill=fr:1
7737 !! html/php
7738 !! html/parsoid
7739 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
7740 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
7741 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
7742 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
7743 !! end
7744
7745 !! test
7746 Single-line or multiline-comments can follow headings
7747 !! options
7748 parsoid=wt2html,wt2wt
7749 !! config
7750 wgParserEnableLegacyHeadingDOM=false
7751 !! wikitext
7752 ==foo==<!---->
7753 ==bar==<!--c1-->
7754 ==baz==<!--
7755 c2
7756 c3-->
7757 !! html/php
7758 <div class="mw-heading mw-heading2"><h2 id="foo">foo</h2><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></div>
7759 <div class="mw-heading mw-heading2"><h2 id="bar">bar</h2><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: bar">edit</a><span class="mw-editsection-bracket">]</span></span></div>
7760 <div class="mw-heading mw-heading2"><h2 id="baz">baz</h2><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: baz">edit</a><span class="mw-editsection-bracket">]</span></span></div>
7761 !! html/parsoid
7762 <h2 id="foo">foo</h2><!---->
7763 <h2 id="bar">bar</h2><!--c1-->
7764 <h2 id="baz">baz</h2><!--
7765 c2
7766 c3-->
7767 !! end
7768
7769 !! test
7770 T3186 news: in the middle of text
7771 !! wikitext
7772 http://en.wikinews.org/wiki/Wikinews:Workplace
7773 !! html
7774 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7775 </p>
7776 !!end
7777
7778
7779 !! test
7780 Namespaced link must have a title
7781 !! wikitext
7782 [[Project:]]
7783 !! html
7784 <p>[[Project:]]
7785 </p>
7786 !!end
7787
7788 !! test
7789 Namespaced link must have a title (bad fragment version)
7790 !! wikitext
7791 [[Project:#fragment]]
7792 !! html
7793 <p>[[Project:#fragment]]
7794 </p>
7795 !!end
7796
7797
7798 ###
7799 ### HTML tags and HTML attributes
7800 ###
7801
7802 !! test
7803 div with no attributes
7804 !! wikitext
7805 <div>HTML rocks</div>
7806 !! html
7807 <div>HTML rocks</div>
7808 !! end
7809
7810 !! test
7811 div with double-quoted attribute
7812 !! wikitext
7813 <div id="rock">HTML rocks</div>
7814 !! html
7815 <div id="rock">HTML rocks</div>
7816 !! end
7817
7818 !! test
7819 div with single-quoted attribute
7820 !! wikitext
7821 <div id='rock'>HTML rocks</div>
7822 !! html
7823 <div id="rock">HTML rocks</div>
7824 !! end
7825
7826 !! test
7827 div with unquoted attribute
7828 !! wikitext
7829 <div id=rock>HTML rocks</div>
7830 !! html
7831 <div id="rock">HTML rocks</div>
7832 !! end
7833
7834 !! test
7835 div with illegal double attributes
7836 !! wikitext
7837 <div id="a" id="b">HTML rocks</div>
7838 !! html
7839 <div id="b">HTML rocks</div>
7840 !! end
7841
7842 !! test
7843 div with empty attribute value, space before equals
7844 !! options
7845 parsoid=wt2html,html2html
7846 !! wikitext
7847 <div class =>HTML rocks</div>
7848 !! html/php
7849 <div class="">HTML rocks</div>
7850 !! html/parsoid
7851 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
7852 !! end
7853
7854 !! test
7855 div with multiple empty attribute values
7856 !! config
7857 wgFragmentMode=[ "html5", "legacy" ]
7858 !! options
7859 parsoid=wt2html,html2html
7860 !! wikitext
7861 <div id= title=>HTML rocks</div>
7862 !! html/php
7863 <div id="title=">HTML rocks</div>
7864 !! html/parsoid
7865 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
7866 !! end
7867
7868 # FIXME Parsoid doesn't actually match PHP here.
7869 !! test
7870 Extension tag in attribute value
7871 !! options
7872 wgRawHtml=1
7873 !! wikitext
7874 <span title="<html><div>123</div></html>">ok</span>
7875 !! html/php
7876 <p><span title="&lt;div&gt;123&lt;/div&gt;">ok</span>
7877 </p>
7878 !! html/parsoid
7879 <p><span title="123" about="#mwt4" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"123"},"sa":{"title":"&lt;html>&lt;div>123&lt;/div>&lt;/html>"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;div typeof=\"mw:Extension/html\" about=\"#mwt3\" data-parsoid=&apos;{\"dsr\":[13,40,2,2]}&apos; data-mw=&apos;{\"name\":\"html\",\"attrs\":{},\"body\":{\"extsrc\":\"&amp;lt;div>123&amp;lt;/div>\"}}&apos;>123&lt;/div>"}]]}'>ok</span></p>
7880 !! end
7881
7882 !! test
7883 table with multiple empty attribute values
7884 !! options
7885 parsoid=wt2html,html2html
7886 !! wikitext
7887 {| title= id=
7888 |hi
7889 |}
7890 !! html/php
7891 <table title="id=">
7892 <tbody><tr>
7893 <td>hi
7894 </td></tr></tbody></table>
7895 !! html/parsoid
7896 <table title="id=">
7897 <tbody><tr><td>hi</td></tr>
7898 </tbody></table>
7899 !! end
7900
7901 !! test
7902 div with braces in attribute value
7903 !! wikitext
7904 <div title="{}">Foo</div>
7905 !! html/php
7906 <div title="&#123;&#125;">Foo</div>
7907 !! html/parsoid
7908 <div title="{}">Foo</div>
7909 !! end
7910
7911 !! test
7912 div with empty attribute value, no space before equals
7913 !! options
7914 parsoid=wt2html,html2html
7915 !! wikitext
7916 <div class=>HTML rocks</div>
7917 !! html/php
7918 <div class="">HTML rocks</div>
7919 !! html/parsoid
7920 <div class="">HTML rocks</div>
7921 !! end
7922
7923 !! test
7924 HTML multiple attributes correction
7925 !! wikitext
7926 <p class="error" class="awesome">Awesome!</p>
7927 !! html
7928 <p class="awesome">Awesome!</p>
7929 !! end
7930
7931 !! test
7932 Table multiple attributes correction
7933 !! wikitext
7934 {|
7935 !+ class="error" class="awesome"|status
7936 |}
7937 !! html
7938 <table>
7939 <tbody><tr>
7940 <th class="awesome">status
7941 </th></tr></tbody></table>
7942 !! end
7943
7944 !! test
7945 DIV IN UPPERCASE
7946 !! wikitext
7947 <DIV ID="x">HTML ROCKS</DIV>
7948 !! html
7949 <div id="x">HTML ROCKS</div>
7950 !! end
7951
7952 !! test
7953 Non-ASCII pseudo-tags are rendered as text
7954 !! wikitext
7955 <khyô>
7956 !! html
7957 <p>&lt;khyô&gt;
7958 </p>
7959 !! end
7960
7961 !! test
7962 Pseudo-tag with URL 'name' renders as url link
7963 !! wikitext
7964 <http://example.com/>
7965 !! html
7966 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
7967 </p>
7968 !! end
7969
7970 !! test
7971 text with amp in the middle of nowhere
7972 !! wikitext
7973 Remember AT&T?
7974 !! html
7975 <p>Remember AT&amp;T?
7976 </p>
7977 !! end
7978
7979 !! test
7980 text with character entity: eacute
7981 !! wikitext
7982 I always thought &eacute; was a cute letter.
7983 !! html
7984 <p>I always thought &#233; was a cute letter.
7985 </p>
7986 !! end
7987
7988 !! test
7989 text with entity-escaped character entity-like string: eacute
7990 !! wikitext
7991 I always thought &amp;eacute; was a cute letter.
7992 !! html
7993 <p>I always thought &amp;eacute; was a cute letter.
7994 </p>
7995 !! end
7996
7997 !! test
7998 text with undefined character entity: xacute
7999 !! wikitext
8000 I always thought &xacute; was a cute letter.
8001 !! html
8002 <p>I always thought &amp;xacute; was a cute letter.
8003 </p>
8004 !! end
8005
8006 !! test
8007 Text with HTML5 semicolon-less entity (should not decode)
8008 !! wikitext
8009 &ampamp;
8010 !! html/php
8011 <p>&amp;ampamp;
8012 </p>
8013 !! html/parsoid
8014 <p>&amp;ampamp;</p>
8015 !! end
8016
8017 !! test
8018 HTML5 tags
8019 !! wikitext
8020 <data value="5">five</data>
8021 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
8022 <mark>This highlighted text</mark>
8023 !! html
8024 <p><data value="5">five</data>
8025 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
8026 <mark>This highlighted text</mark>
8027 </p>
8028 !! end
8029
8030 !! test
8031 HTML tag with leading space is parsed as text
8032 !! wikitext
8033 < div>foo< /div>
8034 !! html
8035 <p>&lt; div&gt;foo&lt; /div&gt;
8036 </p>
8037 !! end
8038
8039 ## FIXME: The untrimmed attribute in Parsoid is T205737
8040 !! test
8041 Element with broken attribute syntax
8042 !! options
8043 parsoid=wt2html
8044 !! wikitext
8045 <div style=" style="123">hi</div>
8046 <div =>ho</div>
8047 !! html/php
8048 <div style="style=">hi</div>
8049 <div>ho</div>
8050 !! html/parsoid
8051 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
8052 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
8053 !! end
8054
8055 ###
8056 ### Nesting tests (see T43545, T52604, T53081)
8057 ###
8058
8059 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
8060 # Note that html2wt is considerably more difficult if we use <b> in
8061 # the test case, instead of <small>
8062 !! test
8063 Ensure that HTML adoption agency algorithm is properly implemented.
8064 !! wikitext
8065 <small>X<small>Y</small>Z</small>
8066 !! html
8067 <p><small>X<small>Y</small>Z</small>
8068 </p>
8069 !! end
8070
8071 # This was T43545 in the PHP parser.
8072 !! test
8073 Nesting of <kbd>
8074 !! wikitext
8075 <kbd>X<kbd>Y</kbd>Z</kbd>
8076 !! html
8077 <p><kbd>X<kbd>Y</kbd>Z</kbd>
8078 </p>
8079 !! end
8080
8081 # The following cases were T53081 in the PHP parser.
8082 # Note that there are some other nestable tags (b, i, etc) which are
8083 # not covered; see T53081 for discussion.
8084
8085 !! test
8086 Nesting of <em>
8087 !! wikitext
8088 <em>X<em>Y</em>Z</em>
8089 !! html
8090 <p><em>X<em>Y</em>Z</em>
8091 </p>
8092 !! end
8093
8094 !! test
8095 Nesting of <strong>
8096 !! wikitext
8097 <strong>X<strong>Y</strong>Z</strong>
8098 !! html
8099 <p><strong>X<strong>Y</strong>Z</strong>
8100 </p>
8101 !! end
8102
8103 !! test
8104 Nesting of <q>
8105 !! wikitext
8106 <q>X<q>Y</q>Z</q>
8107 !! html
8108 <p><q>X<q>Y</q>Z</q>
8109 </p>
8110 !! end
8111
8112 !! test
8113 Nesting of <ruby>
8114 !! wikitext
8115 <ruby>X<ruby>Y</ruby>Z</ruby>
8116 !! html
8117 <p><ruby>X<ruby>Y</ruby>Z</ruby>
8118 </p>
8119 !! end
8120
8121 !! test
8122 Nesting of <bdo>
8123 !! wikitext
8124 <bdo>X<bdo>Y</bdo>Z</bdo>
8125 !! html
8126 <p><bdo>X<bdo>Y</bdo>Z</bdo>
8127 </p>
8128 !! end
8129
8130
8131 ###
8132 ### Media links
8133 ###
8134
8135 !! test
8136 Media link
8137 !! wikitext
8138 [[Media:Foobar.jpg]]
8139 [[Media:Video.ogv]]
8140 [[:Media:Video.ogv]]
8141 !! html/php
8142 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8143 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
8144 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
8145 </p>
8146 !! html/parsoid
8147 <p><a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
8148 <a rel="mw:MediaLink" href="http://example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv">Media:Video.ogv</a>
8149 <a rel="mw:MediaLink" href="http://example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv" data-parsoid='{"a":{"resource":"./Media:Video.ogv"},"sa":{"resource":":Media:Video.ogv"}}'>Media:Video.ogv</a></p>
8150 !! end
8151
8152 !! test
8153 Media link with text
8154 !! wikitext
8155 [[Media:Foobar.jpg|A neat file to look at]]
8156 !! html/php
8157 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8158 </p>
8159 !! html/parsoid
8160 <p><a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
8161 !! end
8162
8163 # This won't pass in standalone mode because we don't have redirect handling in our mock data access.
8164 # Not sure if it is worth dealing with it.
8165 !! test
8166 Media link redirect
8167 !! wikitext
8168 [[Media:Redirect to foobar.jpg]]
8169 !! html/php
8170 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Redirect to foobar.jpg</a>
8171 </p>
8172 !! html/parsoid+integrated
8173 <p><a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Redirect to foobar.jpg</a></p>
8174 !! end
8175
8176 !! test
8177 Localized media link
8178 !! options
8179 language=is
8180 !! wikitext
8181 [[Miðill:Foobar.jpg]]
8182
8183 [[Miðill:Foobar.jpg|Icelandic]]
8184 !! html/php
8185 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Miðill:Foobar.jpg</a>
8186 </p><p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Icelandic</a>
8187 </p>
8188 !! html/parsoid
8189 <p><a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Miðill:Foobar.jpg</a></p>
8190 <p><a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Icelandic</a></p>
8191 !! end
8192
8193 # FIXME: this is still bad HTML tag nesting
8194 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
8195 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
8196 !! test
8197 Media link with nasty text
8198 !! options
8199 parsoid=wt2html,html2html
8200 !! wikitext
8201 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8202 !! html/php
8203 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg"><div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div></a>
8204 !! html/parsoid
8205 <p><a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Safe Link</a></p><a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg"><div style="display:none" data-parsoid='{"stx":"html"}'>" onmouseover="alert(document.cookie)" onfoo="</div></a>
8206 !! end
8207
8208 !! test
8209 Media link from missing resource (parsoid-only)
8210 !! options
8211 parsoid=html2wt
8212 !! html/parsoid
8213 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
8214 !! wikitext
8215 [[Media:Foobar.jpg|Bat!]]
8216 !! end
8217
8218 !! test
8219 Media link from missing resource, localized (parsoid-only)
8220 !! options
8221 parsoid=html2wt
8222 language=is
8223 !! html/parsoid
8224 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
8225 !! wikitext
8226 [[Miðill:Foobar.jpg|Bat!]]
8227 !! end
8228
8229 # This is a test to ensure we don't crash or choke when given
8230 # old cached 1.7.0 HTML for media links; we don't require that the
8231 # result be "valid" because wt2wt was completely broken in 1.7.0
8232 !! test
8233 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
8234 !! options
8235 parsoid=html2wt
8236 !! html/parsoid
8237 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
8238 <p><a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
8239 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
8240 <p><a rel="mw:ExtLink" href="http://example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
8241 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
8242 !! wikitext
8243 This is what Parsoid would emit (and we still handle this HTML fine):
8244
8245 [[Media:Foobar.jpg|A neat file to look at]]
8246
8247 But VisualEditor would mangle the rel attribute, and give us back this:
8248
8249 [http://example.com/images/3/3a/Foobar.jpg A neat file to look at]
8250
8251 But at least we don't crash when trying to handle the mangled HTML!
8252 !! end
8253
8254 !! test
8255 Media link to nonexistent file (T3702)
8256 !! wikitext
8257 [[Media:No such.jpg]]
8258 [[Media:No_such file.jpg]]
8259 !! html/php
8260 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8261 <a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such_file.jpg" class="new" title="No such file.jpg">Media:No_such file.jpg</a>
8262 </p>
8263 !! html/parsoid
8264 <p><a rel="mw:MediaLink" href="./Special:FilePath/No_such.jpg" resource="./Media:No_such.jpg" title="No such.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"resource":"./Media:No_such.jpg"},"sa":{"resource":"Media:No such.jpg"}}'>Media:No such.jpg</a>
8265 <a rel="mw:MediaLink" href="./Special:FilePath/No_such_file.jpg" resource="./Media:No_such_file.jpg" title="No such file.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"resource":"./Media:No_such_file.jpg"},"sa":{"resource":"Media:No_such file.jpg"}}'>Media:No_such file.jpg</a></p>
8266 !! end
8267
8268 !! test
8269 Media link with nested wikilinks
8270 !! config
8271 wgParserEnableLegacyMediaDOM=false
8272 !! wikitext
8273 [[Media:Foobar.jpg|[[Test]]]]
8274 [[Media:Foobar.jpg|[[File:Foobar.jpg]]]]
8275 !! html/php
8276 <p>[[Media:Foobar.jpg|<a href="/wiki/Test" title="Test">Test</a>]]
8277 [[Media:Foobar.jpg|<span class="mw-default-size" typeof="mw:File"><a href="/wiki/File:Foobar.jpg" class="mw-file-description"><img src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" /></a></span>]]
8278 </p>
8279 !! html/parsoid
8280 <p>[[Media:Foobar.jpg|<a rel="mw:WikiLink" href="./Test" title="Test" data-parsoid='{"stx":"simple","a":{"href":"./Test"},"sa":{"href":"Test"}}'>Test</a>]]
8281 [[Media:Foobar.jpg|<span class="mw-default-size" typeof="mw:File" data-parsoid='{"optList":[]}'><a href="./File:Foobar.jpg" class="mw-file-description"><img resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}' class="mw-file-element"/></a></span>]]</p>
8282 !! end
8283
8284 !! test
8285 Media link with multiple options
8286 !! wikitext
8287 [[Media:Foobar.jpg|123|345]]
8288 !! html/php
8289 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">123|345</a>
8290 </p>
8291 !! html/parsoid
8292 <p><a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">123|345</a></p>
8293 !! end
8294
8295 !! test
8296 Character reference normalization in link text (T3938)
8297 !! wikitext
8298 [[Main Page|this&that]]
8299 !! html
8300 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8301 </p>
8302 !! end
8303
8304 !! article
8305 אַ
8306 !! text
8307 Test for unicode normalization
8308
8309 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8310 !! endarticle
8311
8312 # Parsoid has a regression here (T258858) note the incorrect redlink as well
8313 !! test
8314 (T21451) Links should refer to the normalized form.
8315 !! wikitext
8316 [[&#xFB2E;]]
8317 [[&#x5d0;&#x5b7;]]
8318 [[&#x5d0;ַ]]
8319 [[א&#x5b7;]]
8320 [[אַ]]
8321 !! html/php
8322 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8323 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8324 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8325 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8326 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8327 </p>
8328 !! html/parsoid
8329 <p><a rel="mw:WikiLink" href="./אַ?action=edit&amp;redlink=1" title="אַ" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./אַ"},"sa":{"href":"&amp;#xFB2E;"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["אַ"]}}'>אַ</a>
8330 <a rel="mw:WikiLink" href="./אַ" title="אַ" data-parsoid='{"stx":"simple","a":{"href":"./אַ"},"sa":{"href":"&amp;#x5d0;&amp;#x5b7;"}}'>אַ</a>
8331 <a rel="mw:WikiLink" href="./אַ" title="אַ" data-parsoid='{"stx":"simple","a":{"href":"./אַ"},"sa":{"href":"&amp;#x5d0;ַ"}}'>אַ</a>
8332 <a rel="mw:WikiLink" href="./אַ" title="אַ" data-parsoid='{"stx":"simple","a":{"href":"./אַ"},"sa":{"href":"א&amp;#x5b7;"}}'>אַ</a>
8333 <a rel="mw:WikiLink" href="./אַ" title="אַ" data-parsoid='{"stx":"simple","a":{"href":"./אַ"},"sa":{"href":"אַ"}}'>אַ</a></p>
8334 !! end
8335
8336 !! test
8337 Empty attribute crash test (T4067)
8338 !! wikitext
8339 <font color="">foo</font>
8340 !! html
8341 <p><font color="">foo</font>
8342 </p>
8343 !! end
8344
8345 !! test
8346 Empty attribute crash test single-quotes (T4067)
8347 !! wikitext
8348 <font color=''>foo</font>
8349 !! html
8350 <p><font color="">foo</font>
8351 </p>
8352 !! end
8353
8354 !! test
8355 Attribute test: equals, then nothing
8356 !! options
8357 parsoid=wt2html,html2html
8358 !! wikitext
8359 <font color=>foo</font>
8360 !! html/php
8361 <p><font color="">foo</font>
8362 </p>
8363 !! html/parsoid
8364 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
8365 !! end
8366
8367 !! test
8368 Attribute test: unquoted value
8369 !! options
8370 parsoid=wt2html,html2html
8371 !! wikitext
8372 <font color=x>foo</font>
8373 !! html/php
8374 <p><font color="x">foo</font>
8375 </p>
8376 !! html/parsoid
8377 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
8378 !! end
8379
8380 !! test
8381 Attribute test: unquoted but illegal value (hash)
8382 !! wikitext
8383 <font color=#x>foo</font>
8384 !! html
8385 <p><font color="#x">foo</font>
8386 </p>
8387 !! end
8388
8389 # Parsoid does not serialize to empty attribute syntax,
8390 # so wt2wt and html2wt cases are skipped
8391 !! test
8392 Attribute test: no value (T54330)
8393 !! options
8394 parsoid=wt2html,html2html
8395 !! wikitext
8396 <font color>foo</font>
8397 !! html/php
8398 <p><font color="">foo</font>
8399 </p>
8400 !! html/parsoid
8401 <p><font color="">foo</font></p>
8402 !! end
8403
8404 !! test
8405 T4095: link with three closing brackets
8406 !! wikitext
8407 [[Main Page]]]
8408 !! html/php
8409 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8410 </p>
8411 !! html/parsoid
8412 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
8413 !! end
8414
8415 !! test
8416 T4095: link with pipe and three closing brackets
8417 !! wikitext
8418 [[Main Page|link]]]
8419 !! html/php
8420 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8421 </p>
8422 !! html/parsoid
8423 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
8424 !! end
8425
8426 !! test
8427 T4095: link with pipe and three closing brackets, version 2
8428 !! wikitext
8429 [[Main Page|[http://example.com/]]]
8430 !! html/php
8431 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8432 </p>
8433 !! html/parsoid
8434 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
8435 !! end
8436
8437
8438 ###
8439 ### Safety
8440 ###
8441
8442 !! article
8443 Template:Dangerous attribute
8444 !! text
8445 " onmouseover="alert(document.cookie)
8446 !! endarticle
8447
8448 !! article
8449 Template:Dangerous style attribute
8450 !! text
8451 border-size: expression(alert(document.cookie))
8452 !! endarticle
8453
8454 !! article
8455 Template:Div style
8456 !! text
8457 <div style="float: right; {{{1}}}">Magic div</div>
8458 !! endarticle
8459
8460 !! test
8461 T4304: HTML attribute safety (safe template; regression T4309)
8462 !! wikitext
8463 <div title="{{test}}"></div>
8464 !! html/php
8465 <div title="This is a test template"></div>
8466 !! html/parsoid
8467 <div title="This is a test template" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"This is a test template"},"sa":{"title":"{{test}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,20,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"test\",\"href\":\"./Template:Test\"},\"params\":{},\"i\":0}}]}&#39;>This is a test template&lt;/span>"}]]}'></div>
8468 !! end
8469
8470 # Parsoid has enough context to handle this case
8471 !! test
8472 T4304: HTML attribute safety (dangerous template; 2309)
8473 !! wikitext
8474 <div title="{{dangerous attribute}}"></div>
8475 !! html/php
8476 <div title=""></div>
8477 !! html/parsoid
8478 <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=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
8479 !! end
8480
8481 !! test
8482 T4304: HTML attribute safety (dangerous style template; 2309)
8483 !! wikitext
8484 <div style="{{dangerous style attribute}}"></div>
8485 !! html/php
8486 <div style="/* insecure input */"></div>
8487 !! html/parsoid
8488 <div style="/* insecure input */" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"{{dangerous style attribute}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,41,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous style attribute\",\"href\":\"./Template:Dangerous_style_attribute\"},\"params\":{},\"i\":0}}]}&#39;>border-size: expression(alert(document.cookie))&lt;/span>"}]]}'></div>
8489 !! end
8490
8491 !! test
8492 T4304: HTML attribute safety (safe parameter; 2309)
8493 !! wikitext
8494 {{div style|width: 200px}}
8495 !! html/php
8496 <div style="float: right; width: 200px">Magic div</div>
8497 !! html/parsoid
8498 <div style="float: right; width: 200px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"float: right; width: 200px"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: 200px"}},"i":0}}]}'>Magic div</div>
8499 !! end
8500
8501 !! test
8502 T4304: HTML attribute safety (unsafe parameter; 2309)
8503 !! wikitext
8504 {{div style|width: expression(alert(document.cookie))}}
8505 !! html/php
8506 <div style="/* insecure input */">Magic div</div>
8507 !! html/parsoid
8508 <div style="/* insecure input */" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: expression(alert(document.cookie))"}},"i":0}}]}'>Magic div</div>
8509 !! end
8510
8511 !! test
8512 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
8513 !! wikitext
8514 {{div style|"><script>alert(document.cookie)</script>}}
8515 !! html/php
8516 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8517 !! html/parsoid+integrated
8518 <div style="float: right; " about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"\">&lt;script>alert(document.cookie)&lt;/script>"}},"i":0}}]}'>&lt;script>alert(document.cookie)&lt;/script>">Magic div</div>
8519 !! end
8520
8521 !! test
8522 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8523 !! wikitext
8524 {{div style|" ><script>alert(document.cookie)</script>}}
8525 !! html/php
8526 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8527 !! html/parsoid+integrated
8528 <div style="float: right; " about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"\" >&lt;script>alert(document.cookie)&lt;/script>"}},"i":0}}]}'>&lt;script>alert(document.cookie)&lt;/script>">Magic div</div>
8529 !! end
8530
8531 !! test
8532 T4304: HTML attribute safety (link)
8533 !! wikitext
8534 <div title="[[Main Page]]"></div>
8535 !! html/php
8536 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
8537 !! html/parsoid
8538 <div title="[[Main Page]]"></div>
8539 !! end
8540
8541 !! test
8542 T4304: HTML attribute safety (italics)
8543 !! wikitext
8544 <div title="''foobar''"></div>
8545 !! html
8546 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8547 !! end
8548
8549 !! test
8550 T4304: HTML attribute safety (bold)
8551 !! wikitext
8552 <div title="'''foobar'''"></div>
8553 !! html
8554 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8555 !! end
8556
8557 !! test
8558 T4304: HTML attribute safety (web link)
8559 !! wikitext
8560 <div title="http://example.com/"></div>
8561 !! html
8562 <div title="http&#58;//example.com/"></div>
8563 !! end
8564
8565 !! test
8566 T4304: HTML attribute safety (named web link)
8567 !! wikitext
8568 <div title="[http://example.com/ link]"></div>
8569 !! html/php
8570 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
8571 !! html/parsoid
8572 <div title="[http://example.com/ link]"></div>
8573 !! end
8574
8575 !! test
8576 T5244: HTML attribute safety (extension; safe)
8577 !! wikitext
8578 <div style="<nowiki>background:blue</nowiki>"></div>
8579 !! html/php
8580 <div style="background:blue"></div>
8581 !! html/parsoid
8582 <div style="background:blue" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[12,44,8,9]}&apos;>background:blue&lt;/span>"}]]}'></div>
8583 !! end
8584
8585 !! test
8586 T5244: HTML attribute safety (extension; unsafe)
8587 !! wikitext
8588 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8589 !! html/php
8590 <div style="/* insecure input */"></div>
8591 !! html/parsoid
8592 <div style="/* insecure input */" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"&lt;nowiki>border-left:expression(alert(document.cookie))&lt;/nowiki>"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[12,75,8,9]}&apos;>border-left:expression(alert(document.cookie))&lt;/span>"}]]}'></div>
8593 !! end
8594
8595 # More MSIE fun discovered by Tom Gilder
8596
8597 !! test
8598 MSIE CSS safety test: spurious slash
8599 !! wikitext
8600 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8601 !! html/php
8602 <div style="/* insecure input */">evil</div>
8603 !! html/parsoid
8604 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
8605 !! end
8606
8607 !! test
8608 MSIE CSS safety test: hex code
8609 !! wikitext
8610 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8611 !! html/php
8612 <div style="/* insecure input */">evil</div>
8613 !! html/parsoid
8614 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\72l(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
8615 !! end
8616
8617 !! test
8618 MSIE CSS safety test: comment in url
8619 !! wikitext
8620 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8621 !! html/php
8622 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8623 !! html/parsoid
8624 <div style="background-image:u rl(javascript:alert('boo'))" data-parsoid='{"stx":"html","a":{"style":"background-image:u rl(javascript:alert(&#39;boo&#39;))"},"sa":{"style":"background-image:u/**/rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
8625 !! end
8626
8627 !! test
8628 MSIE CSS safety test: comment in expression
8629 !! wikitext
8630 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8631 !! html/php
8632 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8633 !! html/parsoid
8634 <div style="background-image:expres sion(alert('boo4'))" data-parsoid='{"stx":"html","a":{"style":"background-image:expres sion(alert(&#39;boo4&#39;))"},"sa":{"style":"background-image:expres/**/sion(alert(&#39;boo4&#39;))"}}'>evil4</div>
8635 !! end
8636
8637 !! test
8638 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
8639 !! wikitext
8640 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
8641 !! html/php
8642 <p style="/* invalid control char */">A</p>
8643 !! html/parsoid
8644 <p style="/* invalid control char */" data-parsoid='{"stx":"html","a":{"style":"/* invalid control char */"},"sa":{"style":"font-size: 100px; background-image:url\\b(https://www.google.com/images/srpr/logo6w.png)"}}'>A</p>
8645 !! end
8646
8647 !! test
8648 Opera -o-link CSS
8649 !! options
8650 parsoid=wt2html,html2html
8651 !! wikitext
8652 <div
8653 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;"
8654 style="-o-link:attr(title);-o-link-source:current">X</div>
8655 !! html/php
8656 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
8657 !! html/parsoid
8658 <div title="data:text/html,&lt;img src=1 onerror=alert(1)>" style="/* insecure input */" data-parsoid='{"stx":"html","a":{"title":"data:text/html,&lt;img src=1 onerror=alert(1)>","style":"/* insecure input */"},"sa":{"title":"&amp;#100;&amp;#97;&amp;#116;&amp;#97;&amp;#58;&amp;#116;&amp;#101;&amp;#120;&amp;#116;&amp;#47;&amp;#104;&amp;#116;&amp;#109;&amp;#108;&amp;#44;&amp;#60;&amp;#105;&amp;#109;&amp;#103;&amp;#32;&amp;#115;&amp;#114;&amp;#99;&amp;#61;&amp;#49;&amp;#32;&amp;#111;&amp;#110;&amp;#101;&amp;#114;&amp;#114;&amp;#111;&amp;#114;&amp;#61;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#49;&amp;#41;&amp;#62;","style":"-o-link:attr(title);-o-link-source:current"}}'>X</div>
8659 !! end
8660
8661 !! test
8662 Table attribute legitimate extension
8663 !! wikitext
8664 {|
8665 !+ style="<nowiki>color:blue</nowiki>"|status
8666 |}
8667 !! html
8668 <table>
8669 <tbody><tr>
8670 <th style="color:blue">status
8671 </th></tr></tbody></table>
8672 !! end
8673
8674 !! test
8675 Table attribute safety
8676 !! wikitext
8677 {|
8678 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
8679 |}
8680 !! html
8681 <table>
8682 <tbody><tr>
8683 <th style="/* insecure input */">status
8684 </th></tr></tbody></table>
8685 !! end
8686
8687 !! test
8688 CSS line continuation 1
8689 !! wikitext
8690 <div style="background-image: u\&#10;rl(test.jpg);"></div>
8691 !! html
8692 <div style="/* insecure input */"></div>
8693 !! end
8694
8695 !! test
8696 CSS line continuation 2
8697 !! wikitext
8698 <div style="background-image: u\&#13;rl(test.jpg); "></div>
8699 !! html
8700 <div style="/* invalid control char */"></div>
8701 !! end
8702
8703 !! test
8704 Allow aria attributes
8705 !! config
8706 wgFragmentMode=[ "legacy" ]
8707 !! wikitext
8708 <span aria-describedby="id1" aria-flowto="id2" aria-hidden="true" aria-label="id3" aria-labelledby="id4" aria-level="3" aria-owns="id5">foo</span>
8709 <span aria-bogus="stripped">bar</span>
8710 !! html/php
8711 <p><span aria-describedby="id1" aria-flowto="id2" aria-hidden="true" aria-label="id3" aria-labelledby="id4" aria-level="3" aria-owns="id5">foo</span>
8712 <span>bar</span>
8713 </p>
8714 !! html/parsoid
8715 <p><span aria-describedby="id1" aria-flowto="id2" aria-hidden="true" aria-label="id3" aria-labelledby="id4" aria-level="3" aria-owns="id5">foo</span>
8716 <span data-parsoid='{"stx":"html","a":{"aria-bogus":null},"sa":{"aria-bogus":"stripped"}}'>bar</span></p>
8717 !! end
8718
8719 !! test
8720 Expansion of multi-line templates in attribute values (T8255)
8721 !! wikitext
8722 <div style="background: {{1x|#00FF00}}">-</div>
8723 !! html/php
8724 <div style="background: #00FF00">-</div>
8725 !! html/parsoid+integrated
8726 <div style="background:
8727 #00FF00" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"background: \n#00FF00"},"sa":{"style":"background: {{1x|#00FF00}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"background: &lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"#00FF00\"}},\"i\":0}}]}&apos;>\n#00FF00&lt;/span>"}]]}'>-</div>
8728 !! end
8729
8730 ### FIXME ptsync 2024-02-21: "multi-line" part of these tests appears to
8731 ### have been lost at some point.
8732
8733 ### FIXME ptsync 2024-02-21: {{#if}} is not defined for core tests, so
8734 ### this test should use a different parser function (maybe {{lc}}); marked
8735 ### html/php+disabled for now.
8736
8737 !! test
8738 Expansion of multi-line parser-functions in attribute values (T8255)
8739 !! wikitext
8740 <div style="background: {{#if:1|#00FF00|#FF00FF}}">-</div>
8741 !! html/php+disabled
8742 <div style="background: #00FF00">-</div>
8743 !! html/parsoid+integrated
8744 <div style="background:
8745 #00FF00" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"background: \n#00FF00"},"sa":{"style":"background: {{#if:1|#00FF00|#FF00FF}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"background: &lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"},{\"k\":\"2\"}]],\"dsr\":[24,49,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#if:1\",\"function\":\"if\"},\"params\":{\"1\":{\"wt\":\"#00FF00\"},\"2\":{\"wt\":\"#FF00FF\"}},\"i\":0}}]}&apos;>\n#00FF00&lt;/span>"}]]}'>-</div>
8746 !! end
8747
8748 !! test
8749 Expansion of multi-line templates in attribute values (T8255 check)
8750 !! wikitext
8751 <div style="background:
8752 #00FF00">-</div>
8753 !! html/php
8754 <div style="background: #00FF00">-</div>
8755 !! html/parsoid
8756 <div style="background:
8757 #00FF00">-</div>
8758 !! end
8759
8760 !! test
8761 Expansion of multi-line templates in attribute values (T8255 check 2)
8762 !! wikitext
8763 <div style="background: &#10;#00FF00">-</div>
8764 !! html
8765 <div style="background: &#10;#00FF00">-</div>
8766 !! end
8767
8768 # BlockLevelPass suppresses P-wrapping for tags whose names begin with
8769 # `mw:`. We'll somewhat arbitrarily chose `mw:editsection` to
8770 # represent this class of tags for testing purposes.
8771 !! test
8772 Tags which are hidden from tidiers cannot pass through the Sanitizer
8773 !! options
8774 parsoid=wt2html,html2html
8775 !! wikitext
8776 <mw:editsection><script>alert();</script></mw:editsection>
8777
8778 <meta property="mw:PageProp/toc" />
8779 !! html/php
8780 <p>&lt;mw:editsection&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:editsection&gt;
8781 </p><p>&lt;meta property="mw:PageProp/toc" /&gt;
8782 </p>
8783 !! html/parsoid
8784 <p>&lt;mw:editsection>&lt;script>alert();&lt;/script>&lt;/mw:editsection></p>
8785
8786 <p>&lt;meta property="mw:PageProp/toc" /></p>
8787 !! end
8788
8789 ###
8790 ### Parser hooks (see tests/parser/ParserTestParserHook.php for the <tag> extension)
8791 ###
8792
8793 !! test
8794 Parser hook: empty input
8795 !! wikitext
8796 <tag></tag>
8797 !! html/php
8798 <pre>''
8799 array (
8800 )
8801 </pre>
8802 !! html/parsoid
8803 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' about="#mwt2">''
8804 array (
8805 )</pre>
8806 !! end
8807
8808 ## Don't expect parsoid to rt this form.
8809 !! test
8810 Parser hook: empty input using terminated empty elements
8811 !! options
8812 parsoid=wt2html,html2html
8813 !! wikitext
8814 <tag/>
8815 !! html/php
8816 <pre>NULL
8817 array (
8818 )
8819 </pre>
8820 !! html/parsoid
8821 <pre typeof="mw:Extension/tag" about="#mwt3" data-mw='{"name":"tag","attrs":{}}'>NULL
8822 array (
8823 )
8824 </pre>
8825 !! end
8826
8827 !! test
8828 Parser hook: empty input using terminated empty elements (space before)
8829 !! wikitext
8830 <tag />
8831 !! html/php
8832 <pre>NULL
8833 array (
8834 )
8835 </pre>
8836 !! html/parsoid
8837 <pre typeof="mw:Extension/tag" about="#mwt3" data-mw='{"name":"tag","attrs":{}}'>NULL
8838 array (
8839 )
8840 </pre>
8841 !! end
8842
8843 !! test
8844 Parser hook: basic input
8845 !! wikitext
8846 <tag>input</tag>
8847 !! html/php
8848 <pre>'input'
8849 array (
8850 )
8851 </pre>
8852 !! html/parsoid
8853 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' about="#mwt2">'input'
8854 array (
8855 )</pre>
8856 !! end
8857
8858 ## Don't expect parsoid to rt this form.
8859 !! test
8860 Parser hook: case insensitive
8861 !! options
8862 parsoid=wt2html,html2html
8863 !! wikitext
8864 <TAG>input</TAG>
8865 !! html/php
8866 <pre>'input'
8867 array (
8868 )
8869 </pre>
8870 !! html/parsoid
8871 <pre typeof="mw:Extension/tag" about="#mwt3" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}'>'input'
8872 array (
8873 )
8874 </pre>
8875 !! end
8876
8877 ## Don't expect parsoid to rt this form.
8878 !! test
8879 Parser hook: case insensitive, redux
8880 !! options
8881 parsoid=wt2html,html2html
8882 !! wikitext
8883 <TaG>input</TAg>
8884 !! html/php
8885 <pre>'input'
8886 array (
8887 )
8888 </pre>
8889 !! html/parsoid
8890 <pre typeof="mw:Extension/tag" about="#mwt3" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}'>'input'
8891 array (
8892 )
8893 </pre>
8894 !! end
8895
8896 !! test
8897 Parser hook: nested tags
8898 !! options
8899 parsoid=wt2html
8900 !! wikitext
8901 <tag><tag></tag></tag>
8902 !! html/php
8903 <pre>'<tag>'
8904 array (
8905 )
8906 </tag></pre><p>&lt;/tag&gt;</p>
8907 !! html/parsoid
8908 <pre typeof="mw:Extension/tag" about="#mwt3" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'>'<tag>'
8909 array (
8910 )
8911 </tag></pre><p>&lt;/tag></p>
8912 !! end
8913
8914 !! test
8915 Parser hook: basic arguments
8916 !! wikitext
8917 <tag width="200" height="100" depth="50" square=""></tag>
8918 !! html/php
8919 <pre>''
8920 array (
8921 'width' =&gt; '200',
8922 'height' =&gt; '100',
8923 'depth' =&gt; '50',
8924 'square' =&gt; '',
8925 )
8926 </pre>
8927 !! html/parsoid
8928 <pre typeof="mw:Extension/tag" about="#mwt3" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}'>''
8929 array (
8930 'width' => '200',
8931 'height' => '100',
8932 'depth' => '50',
8933 'square' => '',
8934 )
8935 </pre>
8936 !! end
8937
8938 ## Don't expect parsoid to rt this form.
8939 !! test
8940 Parser hook: basic arguments, variations
8941 !! options
8942 parsoid=wt2html,html2html
8943 !! wikitext
8944 <tag width=200 height = "100" depth = '50' square></tag>
8945 !! html/php
8946 <pre>''
8947 array (
8948 'width' =&gt; '200',
8949 'height' =&gt; '100',
8950 'depth' =&gt; '50',
8951 'square' =&gt; '',
8952 )
8953 </pre>
8954 !! html/parsoid
8955 <pre typeof="mw:Extension/tag" about="#mwt3" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}'>''
8956 array (
8957 'width' => '200',
8958 'height' => '100',
8959 'depth' => '50',
8960 'square' => '',
8961 )
8962 </pre>
8963 !! end
8964
8965 !! test
8966 Parser hook: argument containing a forward slash (T7344)
8967 !! wikitext
8968 <tag filename="/tmp/bla"></tag>
8969 !! html/php
8970 <pre>''
8971 array (
8972 'filename' =&gt; '/tmp/bla',
8973 )
8974 </pre>
8975 !! html/parsoid
8976 <pre typeof="mw:Extension/tag" about="#mwt3" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}'>''
8977 array (
8978 'filename' => '/tmp/bla',
8979 )
8980 </pre>
8981 !! end
8982
8983 ## Don't expect parsoid to rt this form.
8984 !! test
8985 Parser hook: empty input using terminated empty elements (T4374)
8986 !! options
8987 parsoid=wt2html,html2html
8988 !! wikitext
8989 <tag foo=bar/>text
8990 !! html/php
8991 <pre>NULL
8992 array (
8993 'foo' =&gt; 'bar',
8994 )
8995 </pre><p>text</p>
8996 !! html/parsoid
8997 <pre typeof="mw:Extension/tag" about="#mwt3" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'>NULL
8998 array (
8999 'foo' => 'bar',
9000 )
9001 </pre><p>text</p>
9002 !! end
9003
9004 ## </tag> should be output literally since there is no matching tag that begins it
9005 ## Don't expect parsoid to rt this form.
9006 !! test
9007 Parser hook: basic arguments using terminated empty elements (T4374)
9008 !! options
9009 parsoid=wt2html
9010 !! wikitext
9011 <tag width=200 height = "100" depth = '50' square/>
9012 other stuff
9013 </tag>
9014 !! html/php
9015 <pre>NULL
9016 array (
9017 'width' =&gt; '200',
9018 'height' =&gt; '100',
9019 'depth' =&gt; '50',
9020 'square' =&gt; '',
9021 )
9022 </pre>
9023 <p>other stuff
9024 &lt;/tag&gt;
9025 </p>
9026 !! html/parsoid
9027 <pre typeof="mw:Extension/tag" about="#mwt3" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}'>NULL
9028 array (
9029 'width' => '200',
9030 'height' => '100',
9031 'depth' => '50',
9032 'square' => '',
9033 )
9034 </pre>
9035 <p>other stuff
9036 &lt;/tag></p>
9037 !! end
9038
9039 ## Don't expect parsoid to rt this form.
9040 !! test
9041 Parser hook: Don't allow unclosed extension tags
9042 !! options
9043 parsoid=wt2html
9044 !! wikitext
9045 test <tag>123
9046
9047 this is a '''test'''
9048 !! html/php
9049 <p>test &lt;tag&gt;123
9050 </p><p>this is a <b>test</b>
9051 </p>
9052 !! html/parsoid
9053 <p>test &lt;tag>123</p>
9054
9055 <p>this is a <b>test</b></p>
9056 !! end
9057
9058 !! test
9059 Parser hook: horizontal rule inside extension tag that outputs <pre>
9060 !! wikitext
9061 <tag>
9062 Hello
9063 <hr/>
9064 Goodbye
9065 </tag>
9066 !! html/php
9067 <pre>'
9068 Hello
9069 <hr />
9070 Goodbye
9071 '
9072 array (
9073 )
9074 </pre>
9075 !! end
9076
9077 ###
9078 ### (see tests/parser/ParserTestParserHook.php for the <statictag> extension)
9079 ###
9080
9081 !! test
9082 Parser hook: static parser hook not inside a comment
9083 !! wikitext
9084 <statictag>hello, world</statictag>
9085
9086 <statictag action="flush" />
9087 !! html/php
9088 <p><br />
9089 hello, world
9090 </p>
9091 !! html/parsoid
9092 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' about="#mwt2"></span></p>
9093 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' about="#mwt4">hello, world</span></p>
9094 !! end
9095
9096 !! test
9097 Parser hook: static parser hook inside a comment
9098 !! wikitext
9099 <!-- <statictag>hello, world</statictag> -->
9100 <statictag action="flush" />
9101 !! html/php
9102 <p><br />
9103 </p>
9104 !! html/parsoid
9105 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
9106 <p><span typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></span></p>
9107 !! end
9108
9109 # Nested template calls; this case was broken by Parser.php rev 1.506,
9110 # since reverted.
9111
9112 !! article
9113 Template:One-parameter
9114 !! text
9115 (My parameter is: {{{1}}})
9116 !! endarticle
9117
9118 !! article
9119 Template:Map-one-parameter
9120 !! text
9121 {{{{{1}}}|{{{2}}}}}
9122 !! endarticle
9123
9124 !! test
9125 Nested template calls
9126 !! wikitext
9127 {{Map-one-parameter|One-parameter|param}}
9128 !! html
9129 <p>(My parameter is: param)
9130 </p>
9131 !! end
9132
9133
9134 ###
9135 ### Sanitizer
9136 ###
9137
9138 !! test
9139 Sanitizer: Closing of open tags
9140 !! wikitext
9141 <s></s><table></table>
9142 !! html/php
9143 <p><s></s></p><table></table>
9144 !! html/parsoid
9145 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
9146 !! end
9147
9148 # Legacy parser adds an extra newline (seen as a space) which Parsoid does not
9149 !! test
9150 Sanitizer: Closing of open but not closed tags
9151 !! wikitext
9152 <s>foo
9153 !! html/php
9154 <p><s>foo
9155 </s></p>
9156 !! html/parsoid
9157 <p><s data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo</s></p>
9158 !! end
9159
9160 !! test
9161 Sanitizer: Closing of closed but not open tags
9162 !! options
9163 parsoid=wt2html
9164 !! wikitext
9165 </s>
9166 !! html
9167 <p class="mw-empty-elt">
9168 </p>
9169 !! end
9170
9171 !! test
9172 Sanitizer: Closing of closed but not open table tags
9173 !! options
9174 parsoid=wt2html
9175 !! wikitext
9176 Table not started</td></tr></table>
9177 !! html
9178 <p>Table not started</p>
9179 !! end
9180
9181 !! test
9182 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9183 !! options
9184 title=[[Main Page]]
9185 !! config
9186 wgFragmentMode=[ "html5", "legacy" ]
9187 !! wikitext
9188 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9189 !! html/php
9190 <p><span id="æ:&#95;v">byte</span><a href="#æ:_v">backlink</a>
9191 </p>
9192 !! html/parsoid
9193 <p><span id="æ:_v" data-parsoid='{"stx":"html","a":{"id":"æ:_v"},"sa":{"id":"æ: v"}}'>byte</span><a rel="mw:WikiLink" href="./Main_Page#æ:_v" class="mw-selflink-fragment" data-parsoid='{"stx":"piped","a":{"href":"./Main_Page#æ:_v"},"sa":{"href":"#æ: v"}}'>backlink</a></p>
9194 !! end
9195
9196 !! test
9197 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
9198 !! config
9199 wgFragmentMode=[ "legacy" ]
9200 !! wikitext
9201 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9202 !! html/php
9203 <p><span id=".C3.A6:&#95;v">byte</span><a href="#.C3.A6:_v">backlink</a>
9204 </p>
9205 !! end
9206
9207 # In HTML5, the restrictions are that id must contain at least one character,
9208 # and must not contain any space characters.
9209 !! test
9210 Sanitizer: Validating the contents of the id attribute (T6515)
9211 !! wikitext
9212 <br id="" /><br id="a space" />
9213 !! html/php
9214 <p><br /><br id="a&#95;space" />
9215 </p>
9216 !! html/parsoid
9217 <p><br data-parsoid='{"stx":"html","selfClose":true,"a":{"id":null},"sa":{"id":""}}'/><br id="a_space" data-parsoid='{"stx":"html","selfClose":true,"a":{"id":"a_space"},"sa":{"id":"a space"}}'/></p>
9218 !! end
9219
9220 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
9221 !! test
9222 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
9223 !! options
9224 disabled
9225 !! wikitext
9226 <br id="foo" /><br id="foo" />
9227 !! html
9228 Something need to be done. foo-2 ?
9229 !! end
9230
9231 !! test
9232 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9233 !! wikitext
9234 <div itemscope>
9235 <meta itemprop="hello" content="world">
9236 <meta http-equiv="refresh" content="5">
9237 <meta itemprop="hello" http-equiv="refresh" content="5">
9238 <link itemprop="hello" href="{{SERVER}}">
9239 <link rel="stylesheet" href="{{SERVER}}">
9240 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9241 </div>
9242 !! html
9243 <div itemscope="">
9244 <p> <meta itemprop="hello" content="world" />
9245 &lt;meta http-equiv="refresh" content="5"&gt;
9246 <meta itemprop="hello" content="5" />
9247 <link itemprop="hello" href="http&#58;//example.org" />
9248 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9249 <link itemprop="hello" href="http&#58;//example.org" />
9250 </p>
9251 </div>
9252 !! end
9253
9254 !! test
9255 Sanitizer: Strip comments from CSS attributes
9256 !! options
9257 parsoid=wt2html,wt2wt
9258 !! wikitext
9259 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
9260 !! html/php
9261 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
9262 </p>
9263 !! html/parsoid
9264 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
9265 !! end
9266
9267 !! test
9268 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
9269 !! wikitext
9270 [[meatball:Soft"Security]]
9271 !! html/php
9272 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
9273 </p>
9274 !! html/parsoid
9275 <p><a rel="mw:WikiLink/Interwiki" href='http://www.usemod.com/cgi-bin/mb.pl?Soft"Security' title='meatball:Soft"Security' class="extiw">meatball:Soft"Security</a></p>
9276 !! end
9277
9278 !! test
9279 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
9280 !! wikitext
9281 [[meatball:Foo<Bar]]
9282 [[meatball:Foo>Bar]]
9283 [[meatball:Foo&lt;bar]]
9284 [[meatball:Foo&gt;bar]]
9285 !! html/php
9286 <p>[[meatball:Foo&lt;Bar]]
9287 [[meatball:Foo&gt;Bar]]
9288 [[meatball:Foo&lt;bar]]
9289 [[meatball:Foo&gt;bar]]
9290 </p>
9291 !! html/parsoid
9292 <p>[[meatball:Foo&lt;Bar]]
9293 [[meatball:Foo>Bar]]
9294 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
9295 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
9296 !! end
9297
9298 !! test
9299 Self closed html pairs (T7487)
9300 !! wikitext
9301 <center><font id="bug" />Centered text</center>
9302 <div><font id="bug2" />In div text</div>
9303 !! html
9304 <center><font id="bug">Centered text</font></center><font id="bug"><div><font id="bug2">In div text</font></div></font>
9305 !! end
9306
9307 !! test
9308 Punctuation: nbsp before exclamation
9309 !! wikitext
9310 C'est grave !
9311 !! html/php
9312 <p>C'est grave&#160;!
9313 </p>
9314 !! html/parsoid
9315 <p>C'est grave<span typeof="mw:DisplaySpace"> </span>!</p>
9316 !! end
9317
9318 !! test
9319 Punctuation: CSS !important (T13874)
9320 !! wikitext
9321 <div style="width:50% !important">important</div>
9322 !! html
9323 <div style="width:50% !important">important</div>
9324 !! end
9325
9326 !! test
9327 Punctuation: CSS ! important (T13874; with space after)
9328 !! wikitext
9329 <div style="width:50% ! important">important</div>
9330 !! html
9331 <div style="width:50% ! important">important</div>
9332 !! end
9333
9334 !! test
9335 HTML bullet list, closed tags (T7497)
9336 !! wikitext
9337 <ul>
9338 <li>One</li>
9339 <li>Two</li>
9340 </ul>
9341 !! html/php
9342 <ul>
9343 <li>One</li>
9344 <li>Two</li>
9345 </ul>
9346 !! html/parsoid
9347 <ul data-parsoid='{"stx":"html"}'>
9348 <li data-parsoid='{"stx":"html"}'>One</li>
9349 <li data-parsoid='{"stx":"html"}'>Two</li>
9350 </ul>
9351 !! end
9352
9353 !! test
9354 HTML bullet list, unclosed tags (T7497)
9355 !! wikitext
9356 <ul>
9357 <li>One
9358 <li>Two
9359 </ul>
9360 !! html/php
9361 <ul>
9362 <li>One
9363 </li><li>Two
9364 </li></ul>
9365 !! html/parsoid
9366 <ul data-parsoid='{"stx":"html"}'>
9367 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
9368 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
9369 </ul>
9370 !! end
9371
9372 !! test
9373 HTML ordered list, closed tags (T7497)
9374 !! wikitext
9375 <ol>
9376 <li>One</li>
9377 <li>Two</li>
9378 </ol>
9379 !! html/php
9380 <ol>
9381 <li>One</li>
9382 <li>Two</li>
9383 </ol>
9384 !! html/parsoid
9385 <ol data-parsoid='{"stx":"html"}'>
9386 <li data-parsoid='{"stx":"html"}'>One</li>
9387 <li data-parsoid='{"stx":"html"}'>Two</li>
9388 </ol>
9389 !! end
9390
9391 !! test
9392 HTML ordered list, unclosed tags (T7497)
9393 !! options
9394 !! wikitext
9395 <ol>
9396 <li>One
9397 <li>Two
9398 </ol>
9399 !! html/php
9400 <ol>
9401 <li>One
9402 </li><li>Two
9403 </li></ol>
9404 !! html/parsoid
9405 <ol data-parsoid='{"stx":"html"}'>
9406 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
9407 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
9408 </ol>
9409 !! end
9410
9411 !! test
9412 HTML nested bullet list, closed tags (T7497)
9413 !! wikitext
9414 <ul>
9415 <li>One</li>
9416 <li>Two:
9417 <ul>
9418 <li>Sub-one</li>
9419 <li>Sub-two</li>
9420 </ul>
9421 </li>
9422 </ul>
9423 !! html/php
9424 <ul>
9425 <li>One</li>
9426 <li>Two:
9427 <ul>
9428 <li>Sub-one</li>
9429 <li>Sub-two</li>
9430 </ul>
9431 </li>
9432 </ul>
9433 !! html/parsoid
9434 <ul data-parsoid='{"stx":"html"}'>
9435 <li data-parsoid='{"stx":"html"}'>One</li>
9436 <li data-parsoid='{"stx":"html"}'>Two:
9437 <ul data-parsoid='{"stx":"html"}'>
9438 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
9439 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
9440 </ul>
9441 </li>
9442 </ul>
9443 !! end
9444
9445 !! test
9446 HTML nested bullet list, open tags (T7497)
9447 !! wikitext
9448 <ul>
9449 <li>One
9450 <li>Two:
9451 <ul>
9452 <li>Sub-one
9453 <li>Sub-two
9454 </ul>
9455 </ul>
9456 !! html
9457 <ul>
9458 <li>One
9459 </li><li>Two:
9460 <ul>
9461 <li>Sub-one
9462 </li><li>Sub-two
9463 </li></ul>
9464 </li></ul>
9465 !! end
9466
9467 !! test
9468 HTML nested ordered list, closed tags (T7497)
9469 !! wikitext
9470 <ol>
9471 <li>One</li>
9472 <li>Two:
9473 <ol>
9474 <li>Sub-one</li>
9475 <li>Sub-two</li>
9476 </ol>
9477 </li>
9478 </ol>
9479 !! html
9480 <ol>
9481 <li>One</li>
9482 <li>Two:
9483 <ol>
9484 <li>Sub-one</li>
9485 <li>Sub-two</li>
9486 </ol>
9487 </li>
9488 </ol>
9489 !! end
9490
9491 !! test
9492 HTML nested ordered list, open tags (T7497)
9493 !! wikitext
9494 <ol>
9495 <li>One
9496 <li>Two:
9497 <ol>
9498 <li>Sub-one
9499 <li>Sub-two
9500 </ol>
9501 </ol>
9502 !! html/php
9503 <ol>
9504 <li>One
9505 </li><li>Two:
9506 <ol>
9507 <li>Sub-one
9508 </li><li>Sub-two
9509 </li></ol>
9510 </li></ol>
9511 !! html/parsoid
9512 <ol>
9513 <li>One
9514 </li>
9515 <li>Two:
9516 <ol>
9517 <li>Sub-one
9518 </li>
9519 <li>Sub-two
9520 </li>
9521 </ol>
9522 </li>
9523 </ol>
9524 !! end
9525
9526 !! test
9527 HTML ordered list item with parameters oddity
9528 !! wikitext
9529 <ol><li id="fragment">One</li>
9530 </ol>
9531 !! html
9532 <ol><li id="fragment">One</li>
9533 </ol>
9534 !! end
9535
9536 # parsoid doesn't explicitly mark autonumbered links, see T55505
9537 !!test
9538 T7918: autonumbering
9539 !! wikitext
9540 [http://first/] [http://second] [ftp://ftp]
9541
9542 ftp://inlineftp
9543
9544 [mailto:[email protected] With target]
9545
9546 [mailto:[email protected]]
9547
9548 mailto:[email protected]
9549 !! html/php
9550 <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>
9551 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9552 </p><p><a rel="nofollow" class="external text" href="mailto:[email protected]">With target</a>
9553 </p><p><a rel="nofollow" class="external autonumber" href="mailto:[email protected]">[4]</a>
9554 </p><p><a rel="nofollow" class="external free" href="mailto:[email protected]">mailto:[email protected]</a>
9555 </p>
9556 !! html/parsoid
9557 <p><a rel="mw:ExtLink" href="http://first/" class="external autonumber"></a> <a rel="mw:ExtLink" href="http://second" class="external autonumber"></a> <a rel="mw:ExtLink" href="ftp://ftp" class="external autonumber"></a></p>
9558 <p><a rel="mw:ExtLink" href="ftp://inlineftp" class="external free">ftp://inlineftp</a></p>
9559 <p><a rel="mw:ExtLink" href="mailto:[email protected]" class="external text">With target</a></p>
9560 <p><a rel="mw:ExtLink" href="mailto:[email protected]" class="external autonumber"></a></p>
9561 <p><a rel="mw:ExtLink" href="mailto:[email protected]" class="external free">mailto:[email protected]</a></p>
9562 !! end
9563
9564
9565 #
9566 # Security and HTML correctness
9567 # From Nick Jenkins' fuzz testing
9568 #
9569
9570 !! test
9571 Fuzz testing: Parser13
9572 !! wikitext
9573 {|
9574 | http://a|
9575 !! html
9576 <table>
9577 <tbody><tr>
9578 <td>
9579 </td>
9580 </tr>
9581 </tbody></table>
9582 !! end
9583
9584 # Known to produce bogus xml (extra </td>)
9585 # Don't add the html/php section since it generates broken HTML
9586 !! test
9587 Fuzz testing: Parser16
9588 !! wikitext
9589 {|
9590 !https://||||||
9591 !! html
9592 <table>
9593 <tbody><tr>
9594 <th>https://</th>
9595 <th></th>
9596 <th></th>
9597 <th>
9598
9599 </th></tr>
9600 </tbody></table>
9601 !! end
9602
9603 !! test
9604 Fuzz testing: Parser21
9605 !! wikitext
9606 {|
9607 !irc://{{ftp://a" onmouseover="alert('hello world');"
9608 |
9609 !! html
9610 <table>
9611 <tbody><tr>
9612 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9613 </th>
9614 <td>
9615 </td>
9616 </tr>
9617 </tbody></table>
9618 !! end
9619
9620 !! test
9621 Fuzz testing: Parser22
9622 !! wikitext
9623 http://===r:::https://b
9624
9625 {|
9626 !! html/php
9627 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9628 </p>
9629 <table>
9630 <tbody><tr><td></td></tr>
9631 </tbody></table>
9632 !! html/parsoid
9633 <p><a rel="mw:ExtLink" href="http://===r:::https://b" class="external free" data-parsoid='{"stx":"url"}'>http://===r:::https://b</a></p>
9634
9635 <table data-parsoid='{"autoInsertedEnd":true}'></table>
9636 !! end
9637
9638 # The above 'Parser24' fuzz test exposed a tokenizer bug (T221384);
9639 # this is a minimized version of the above test to catch regressions.
9640 !! test
9641 Fuzz testing: Parser24 (minimized)
9642 !! options
9643 parsoid=wt2html
9644 !! wikitext
9645 {{<u {{{{[[Sx-->}}
9646 !! html/php
9647 <p>{{<u>}}
9648 </u></p>
9649 !! html/parsoid
9650 <p>{{<u data-parsoid='{"stx":"html","a":{"{{{{[[Sx--":null},"sa":{"{{{{[[Sx--":""},"autoInsertedEnd":true}'>}}</u></p>
9651 !! end
9652
9653 ## Remex doesn't account for fostered content.
9654 ## Known to produce bad XML for now
9655 !! test
9656 Fuzz testing: Parser24
9657 !! options
9658 parsoid=wt2html
9659 !! wikitext
9660 {|
9661 {{{|
9662 <u CLASS=
9663 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9664 <br style="onmouseover='alert(document.cookie);' " />
9665
9666 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9667 |
9668 !! html/php
9669
9670 {{{|
9671 <u class="&#124;">}}}} &gt;
9672 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9673
9674 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9675 </u><table><tbody><tr>
9676 <td>
9677 </td>
9678 </tr>
9679 </tbody></table>
9680 !! html/parsoid
9681 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
9682 {{{|
9683 <u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true}'><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>}}}} >
9684 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
9685
9686 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
9687 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
9688 !! end
9689
9690 # Note: the current result listed for this is not what the original one was,
9691 # but the original bug was JavaScript injection, which is fixed in any case.
9692 # It's not clear that the original result listed was any more correct than the
9693 # current one. Original result:
9694 # <p>{{{|
9695 # </p>
9696 # <li class="&#124;&#124;">
9697 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9698 !!test
9699 Fuzz testing: Parser25 (T8055)
9700 !! wikitext
9701 {{{
9702 |
9703 <LI CLASS=||
9704 >
9705 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9706 !! html/php
9707 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9708 </p>
9709 !! html/parsoid
9710 <span about="#mwt1" typeof="mw:Param" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"}]]}' data-mw='{"parts":[{"templatearg":{"target":{"wt":"\n"},"params":{"1":{"wt":" \n&lt;LI CLASS="},"2":{"wt":""},"3":{"wt":"\n >\n"}},"i":0}},"blah\" onmouseover=\"alert(&#39;hello world&#39;);\" align=\"left\"&#39;&#39;&#39;MOVE MOUSE CURSOR OVER HERE"]}'>
9711 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
9712 !! end
9713
9714 !!test
9715 Fuzz testing: URL adjacent extension (with space, clean)
9716 !! wikitext
9717 http://example.com <nowiki>junk</nowiki>
9718 !! html/php
9719 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9720 </p>
9721 !! html/parsoid
9722 <p><a rel="mw:ExtLink" href="http://example.com" class="external free" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
9723 !! end
9724
9725 !!test
9726 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9727 !! wikitext
9728 http://example.com<nowiki>junk</nowiki>
9729 !! html/php
9730 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9731 </p>
9732 !! html/parsoid
9733 <p><a rel="mw:ExtLink" href="http://example.com" class="external free" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
9734 !! end
9735
9736 !! test
9737 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9738 !! wikitext
9739 http://example.com<pre>junk</pre>
9740 !! html/php
9741 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
9742 !! html/parsoid
9743 <p><a rel="mw:ExtLink" href="http://example.com" class="external free" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"junk"}}'>junk</pre>
9744 !! end
9745
9746 # Parsoid will emit the newline literally in wt2wt; see next test case.
9747 !! test
9748 Fuzz testing: encoded newline in generated HTML replacements (T8577)
9749 !! options
9750 parsoid=wt2html
9751 !! wikitext
9752 <pre dir="&#10;"></pre>
9753 !! html/php
9754 <pre dir="&#10;"></pre>
9755 !! html/parsoid
9756 <pre dir="
9757 " typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"dir":""},"body":{"extsrc":""}}'></pre>
9758 !! end
9759
9760 !! test
9761 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
9762 !! options
9763 parsoid=html2wt
9764 !! html/parsoid
9765 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
9766 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
9767 !! wikitext
9768 <pre dir="
9769 "></pre>
9770 !! html/php
9771 <pre dir=""></pre>
9772 !! end
9773
9774 !! test
9775 Templates in extension attributes are not expanded
9776 !! wikitext
9777 <pre dir="{{1x|ltr}}"></pre>
9778 !! html/php
9779 <pre dir="{{1x|ltr}}"></pre>
9780 !! html/parsoid
9781 <pre dir="{{1x|ltr}}" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"dir":"{{1x|ltr}}"},"body":{"extsrc":""}}'></pre>
9782 !! end
9783
9784 !! test
9785 Parsing optional HTML elements (T8171)
9786 !! options
9787 !! wikitext
9788 <table>
9789 <tr>
9790 <td> Some tabular data</td>
9791 <td> More tabular data ...
9792 <td> And yet som tabular data</td>
9793 </tr>
9794 </table>
9795 !! html
9796 <table>
9797 <tbody><tr>
9798 <td> Some tabular data</td>
9799 <td> More tabular data ...
9800 </td><td> And yet som tabular data</td>
9801 </tr>
9802 </tbody></table>
9803 !! end
9804
9805 !! test
9806 Correct handling of <td>, <tr> (T8171)
9807 !! options
9808 !! wikitext
9809 <table>
9810 <tr>
9811 <td> Some tabular data</td>
9812 <td> More tabular data ...</td>
9813 <td> And yet som tabular data</td>
9814 </tr>
9815 </table>
9816 !! html
9817 <table>
9818 <tbody><tr>
9819 <td> Some tabular data</td>
9820 <td> More tabular data ...</td>
9821 <td> And yet som tabular data</td>
9822 </tr>
9823 </tbody></table>
9824 !! end
9825
9826
9827 !! test
9828 Parsing crashing regression (fr:JavaScript)
9829 !! wikitext
9830 </body></x>
9831 !! html
9832 <p>&lt;/body&gt;&lt;/x&gt;
9833 </p>
9834 !! end
9835
9836 !! test
9837 Inline wiki vs wiki block nesting
9838 !! wikitext
9839 '''Bold paragraph
9840
9841 New wiki paragraph
9842 !! html
9843 <p><b>Bold paragraph</b>
9844 </p><p>New wiki paragraph
9845 </p>
9846 !! end
9847
9848 # FIXME: The current php output is documented
9849 # and desired output is the parsoid target.
9850 !! test
9851 Inline HTML vs wiki block nesting
9852 !! wikitext
9853 <b>Bold paragraph
9854
9855 New wiki paragraph
9856 !! html/php
9857 <p><b>Bold paragraph
9858 </b></p><p><b>New wiki paragraph
9859 </b></p>
9860 !! html/parsoid
9861 <p><b>Bold paragraph</b>
9862 </p><p>New wiki paragraph
9863 </p>
9864 !! end
9865
9866 # Original result was this:
9867 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9868 # </p>
9869 # While that might be marginally more intuitive, maybe, the six-apostrophe
9870 # construct is clearly pathological and the result stated here (which is what
9871 # the parser actually does) is about as reasonable as anything.
9872 !!test
9873 Mixing markup for italics and bold
9874 !! options
9875 !! wikitext
9876 '''bold''''''bold''bolditalics'''''
9877 !! html
9878 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9879 </p>
9880 !! end
9881
9882
9883 !! article
9884 Xyzzyx
9885 !! text
9886 Article for special page transclusion test
9887 !! endarticle
9888
9889 !! test
9890 Special page transclusion
9891 !! wikitext
9892 {{Special:Prefixindex/Xyzzyx}}
9893 !! html/php
9894 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
9895 </ul>
9896 !! html/parsoid+integrated
9897 <ul class="mw-prefixindex-list" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Special:Prefixindex/Xyzzyx","href":"./Special:PrefixIndex/Xyzzyx"},"params":{},"i":0}}]}'>
9898 <li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
9899 </ul>
9900 !! end
9901
9902 !! test
9903 Special page transclusion twice (T7021)
9904 !! wikitext
9905 {{Special:Prefixindex/Xyzzyx}}
9906 {{Special:Prefixindex/Xyzzyx}}
9907 !! html/php
9908 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
9909 </ul>
9910 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
9911 </ul>
9912 !! html/parsoid+integrated
9913 <ul class="mw-prefixindex-list" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Special:Prefixindex/Xyzzyx","href":"./Special:PrefixIndex/Xyzzyx"},"params":{},"i":0}}]}'>
9914 <li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
9915 </ul>
9916 <ul class="mw-prefixindex-list" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Special:Prefixindex/Xyzzyx","href":"./Special:PrefixIndex/Xyzzyx"},"params":{},"i":0}}]}'>
9917 <li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
9918 </ul>
9919 !! end
9920
9921 !! test
9922 Transclusion of default MediaWiki message
9923 !! wikitext
9924 {{MediaWiki:Mainpage}}
9925 !! html/php
9926 <p>Main Page
9927 </p>
9928 !! html/parsoid+integrated
9929 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"MediaWiki:Mainpage","href":"./MediaWiki:Mainpage"},"params":{},"i":0}}]}'>Main Page</span></p>
9930 !! end
9931
9932 !! test
9933 Transclusion of nonexistent MediaWiki message
9934 !! wikitext
9935 {{MediaWiki:Mainpagexxx}}
9936 !! html/php
9937 <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>
9938 </p>
9939 !! html/parsoid
9940 <p><a rel="mw:WikiLink" href="./MediaWiki:Mainpagexxx?action=edit&amp;redlink=1" title="MediaWiki:Mainpagexxx" about="#mwt1" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./MediaWiki:Mainpagexxx"},"sa":{"href":"MediaWiki:Mainpagexxx"},"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"MediaWiki:Mainpagexxx","href":"./MediaWiki:Mainpagexxx"},"params":{},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["MediaWiki:Mainpagexxx"]}}'>MediaWiki:Mainpagexxx</a></p>
9941 !! end
9942
9943 !! test
9944 Transclusion of MediaWiki message with underscore
9945 !! wikitext
9946 {{MediaWiki:history_short}}
9947 !! html/php
9948 <p>History
9949 </p>
9950 !! html/parsoid+integrated
9951 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"MediaWiki:history_short","href":"./MediaWiki:History_short"},"params":{},"i":0}}]}'>History</span></p>
9952 !! end
9953
9954 !! test
9955 Transclusion of MediaWiki message with space
9956 !! wikitext
9957 {{MediaWiki:history short}}
9958 !! html/php
9959 <p>History
9960 </p>
9961 !! html/parsoid+integrated
9962 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"MediaWiki:history short","href":"./MediaWiki:History_short"},"params":{},"i":0}}]}'>History</span></p>
9963 !! end
9964
9965 !! test
9966 Invalid header with following text
9967 !! wikitext
9968 = x = y
9969 !! html
9970 <p>= x = y
9971 </p>
9972 !! end
9973
9974
9975 !! test
9976 Section extraction test (section 0)
9977 !! options
9978 section=0
9979 !! wikitext
9980 start
9981 ==a==
9982 ===aa===
9983 ====aaa====
9984 ==b==
9985 ===ba===
9986 ===bb===
9987 ====bba====
9988 ===bc===
9989 ==c==
9990 ===ca===
9991 !! html/php
9992 start
9993 !! end
9994
9995 !! test
9996 Section extraction test (section 1)
9997 !! options
9998 section=1
9999 !! wikitext
10000 start
10001 ==a==
10002 ===aa===
10003 ====aaa====
10004 ==b==
10005 ===ba===
10006 ===bb===
10007 ====bba====
10008 ===bc===
10009 ==c==
10010 ===ca===
10011 !! html/php
10012 ==a==
10013 ===aa===
10014 ====aaa====
10015 !! end
10016
10017 !! test
10018 Section extraction test (section 2)
10019 !! options
10020 section=2
10021 !! wikitext
10022 start
10023 ==a==
10024 ===aa===
10025 ====aaa====
10026 ==b==
10027 ===ba===
10028 ===bb===
10029 ====bba====
10030 ===bc===
10031 ==c==
10032 ===ca===
10033 !! html/php
10034 ===aa===
10035 ====aaa====
10036 !! end
10037
10038 !! test
10039 Section extraction test (section 3)
10040 !! options
10041 section=3
10042 !! wikitext
10043 start
10044 ==a==
10045 ===aa===
10046 ====aaa====
10047 ==b==
10048 ===ba===
10049 ===bb===
10050 ====bba====
10051 ===bc===
10052 ==c==
10053 ===ca===
10054 !! html/php
10055 ====aaa====
10056 !! end
10057
10058 !! test
10059 Section extraction test (section 4)
10060 !! options
10061 section=4
10062 !! wikitext
10063 start
10064 ==a==
10065 ===aa===
10066 ====aaa====
10067 ==b==
10068 ===ba===
10069 ===bb===
10070 ====bba====
10071 ===bc===
10072 ==c==
10073 ===ca===
10074 !! html/php
10075 ==b==
10076 ===ba===
10077 ===bb===
10078 ====bba====
10079 ===bc===
10080 !! end
10081
10082 !! test
10083 Section extraction test (section 5)
10084 !! options
10085 section=5
10086 !! wikitext
10087 start
10088 ==a==
10089 ===aa===
10090 ====aaa====
10091 ==b==
10092 ===ba===
10093 ===bb===
10094 ====bba====
10095 ===bc===
10096 ==c==
10097 ===ca===
10098 !! html/php
10099 ===ba===
10100 !! end
10101
10102 !! test
10103 Section extraction test (section 6)
10104 !! options
10105 section=6
10106 !! wikitext
10107 start
10108 ==a==
10109 ===aa===
10110 ====aaa====
10111 ==b==
10112 ===ba===
10113 ===bb===
10114 ====bba====
10115 ===bc===
10116 ==c==
10117 ===ca===
10118 !! html/php
10119 ===bb===
10120 ====bba====
10121 !! end
10122
10123 !! test
10124 Section extraction test (section 7)
10125 !! options
10126 section=7
10127 !! wikitext
10128 start
10129 ==a==
10130 ===aa===
10131 ====aaa====
10132 ==b==
10133 ===ba===
10134 ===bb===
10135 ====bba====
10136 ===bc===
10137 ==c==
10138 ===ca===
10139 !! html/php
10140 ====bba====
10141 !! end
10142
10143 !! test
10144 Section extraction test (section 8)
10145 !! options
10146 section=8
10147 !! wikitext
10148 start
10149 ==a==
10150 ===aa===
10151 ====aaa====
10152 ==b==
10153 ===ba===
10154 ===bb===
10155 ====bba====
10156 ===bc===
10157 ==c==
10158 ===ca===
10159 !! html/php
10160 ===bc===
10161 !! end
10162
10163 !! test
10164 Section extraction test (section 9)
10165 !! options
10166 section=9
10167 !! wikitext
10168 start
10169 ==a==
10170 ===aa===
10171 ====aaa====
10172 ==b==
10173 ===ba===
10174 ===bb===
10175 ====bba====
10176 ===bc===
10177 ==c==
10178 ===ca===
10179 !! html/php
10180 ==c==
10181 ===ca===
10182 !! end
10183
10184 !! test
10185 Section extraction test (section 10)
10186 !! options
10187 section=10
10188 !! wikitext
10189 start
10190 ==a==
10191 ===aa===
10192 ====aaa====
10193 ==b==
10194 ===ba===
10195 ===bb===
10196 ====bba====
10197 ===bc===
10198 ==c==
10199 ===ca===
10200 !! html/php
10201 ===ca===
10202 !! end
10203
10204 !! test
10205 Section extraction test (nonexistent section 11)
10206 !! options
10207 section=11
10208 !! wikitext
10209 start
10210 ==a==
10211 ===aa===
10212 ====aaa====
10213 ==b==
10214 ===ba===
10215 ===bb===
10216 ====bba====
10217 ===bc===
10218 ==c==
10219 ===ca===
10220 !! html/php
10221 !! end
10222
10223 !! test
10224 Section extraction test with bogus heading (section 1)
10225 !! options
10226 section=1
10227 !! wikitext
10228 ==a==
10229 ==bogus== not a legal section
10230 ==b==
10231 !! html/php
10232 ==a==
10233 ==bogus== not a legal section
10234 !! end
10235
10236 !! test
10237 Section extraction test with bogus heading (section 2)
10238 !! options
10239 section=2
10240 !! wikitext
10241 ==a==
10242 ==bogus== not a legal section
10243 ==b==
10244 !! html/php
10245 ==b==
10246 !! end
10247
10248 !! test
10249 Section extraction test with comment after heading (section 1)
10250 !! options
10251 section=1
10252 !! wikitext
10253 ==a==
10254 ==b== <!-- -->
10255 ==c==
10256 !! html/php
10257 ==a==
10258 !! end
10259
10260 !! test
10261 Section extraction test with comment after heading (section 2)
10262 !! options
10263 section=2
10264 !! wikitext
10265 ==a==
10266 ==b== <!-- -->
10267 ==c==
10268 !! html/php
10269 ==b== <!-- -->
10270 !! end
10271
10272 !! test
10273 Section extraction test with bogus <nowiki> heading (section 1)
10274 !! options
10275 section=1
10276 !! wikitext
10277 ==a==
10278 ==bogus== <nowiki>not a legal section</nowiki>
10279 ==b==
10280 !! html/php
10281 ==a==
10282 ==bogus== <nowiki>not a legal section</nowiki>
10283 !! end
10284
10285 !! test
10286 Section extraction test with bogus <nowiki> heading (section 2)
10287 !! options
10288 section=2
10289 !! wikitext
10290 ==a==
10291 ==bogus== <nowiki>not a legal section</nowiki>
10292 ==b==
10293 !! html/php
10294 ==b==
10295 !! end
10296
10297 # Formerly testing for T4587, now resolved by the use of unmarked sections
10298 # instead of respecting commented sections
10299 !! test
10300 Section extraction prefixed by comment (section 1)
10301 !! options
10302 section=1
10303 !! wikitext
10304 <!-- -->==sec1==
10305 ==sec2==
10306 !! html/php
10307 ==sec2==
10308 !!end
10309
10310 !! test
10311 Section extraction prefixed by comment (section 2)
10312 !! options
10313 section=2
10314 !! wikitext
10315 <!-- -->==sec1==
10316 ==sec2==
10317 !! html/php
10318 !! end
10319
10320 # Formerly testing for T4607, now resolved by the use of unmarked sections
10321 # instead of respecting HTML-style headings
10322 !! test
10323 Section extraction, mixed wiki and html (section 1)
10324 !! options
10325 section=1
10326 !! wikitext
10327 <h2>unmarked</h2>
10328 unmarked
10329 ==1==
10330 one
10331 ==2==
10332 two
10333 !! html/php
10334 ==1==
10335 one
10336 !! end
10337
10338 !! test
10339 Section extraction, mixed wiki and html (section 2)
10340 !! options
10341 section=2
10342 !! wikitext
10343 <h2>unmarked</h2>
10344 unmarked
10345 ==1==
10346 one
10347 ==2==
10348 two
10349 !! html/php
10350 ==2==
10351 two
10352 !! end
10353
10354
10355 # Formerly testing for T5342
10356 !! test
10357 Section extraction, heading surrounded by <noinclude>
10358 !! options
10359 section=1
10360 !! wikitext
10361 <noinclude>==unmarked==</noinclude>
10362 ==marked==
10363 !! html/php
10364 ==marked==
10365 !!end
10366
10367 # Test behavior of T21910
10368 !! test
10369 Sectiion with all-equals
10370 !! options
10371 section=2
10372 !! wikitext
10373 ===
10374 The line above must have a trailing space
10375 === <!--
10376 --> <!-- -->
10377 But just in case it doesn't...
10378 !! html/php
10379 === <!--
10380 --> <!-- -->
10381 But just in case it doesn't...
10382 !! end
10383
10384 !! test
10385 Section replacement test (section 0)
10386 !! options
10387 replace=0,"xxx"
10388 !! wikitext
10389 start
10390 ==a==
10391 ===aa===
10392 ====aaa====
10393 ==b==
10394 ===ba===
10395 ===bb===
10396 ====bba====
10397 ===bc===
10398 ==c==
10399 ===ca===
10400 !! html/php
10401 xxx
10402
10403 ==a==
10404 ===aa===
10405 ====aaa====
10406 ==b==
10407 ===ba===
10408 ===bb===
10409 ====bba====
10410 ===bc===
10411 ==c==
10412 ===ca===
10413 !! end
10414
10415 !! test
10416 Section replacement test (section 1)
10417 !! options
10418 replace=1,"xxx"
10419 !! wikitext
10420 start
10421 ==a==
10422 ===aa===
10423 ====aaa====
10424 ==b==
10425 ===ba===
10426 ===bb===
10427 ====bba====
10428 ===bc===
10429 ==c==
10430 ===ca===
10431 !! html/php
10432 start
10433 xxx
10434
10435 ==b==
10436 ===ba===
10437 ===bb===
10438 ====bba====
10439 ===bc===
10440 ==c==
10441 ===ca===
10442 !! end
10443
10444 !! test
10445 Section replacement test (section 2)
10446 !! options
10447 replace=2,"xxx"
10448 !! wikitext
10449 start
10450 ==a==
10451 ===aa===
10452 ====aaa====
10453 ==b==
10454 ===ba===
10455 ===bb===
10456 ====bba====
10457 ===bc===
10458 ==c==
10459 ===ca===
10460 !! html/php
10461 start
10462 ==a==
10463 xxx
10464
10465 ==b==
10466 ===ba===
10467 ===bb===
10468 ====bba====
10469 ===bc===
10470 ==c==
10471 ===ca===
10472 !! end
10473
10474 !! test
10475 Section replacement test (section 3)
10476 !! options
10477 replace=3,"xxx"
10478 !! wikitext
10479 start
10480 ==a==
10481 ===aa===
10482 ====aaa====
10483 ==b==
10484 ===ba===
10485 ===bb===
10486 ====bba====
10487 ===bc===
10488 ==c==
10489 ===ca===
10490 !! html/php
10491 start
10492 ==a==
10493 ===aa===
10494 xxx
10495
10496 ==b==
10497 ===ba===
10498 ===bb===
10499 ====bba====
10500 ===bc===
10501 ==c==
10502 ===ca===
10503 !! end
10504
10505 !! test
10506 Section replacement test (section 4)
10507 !! options
10508 replace=4,"xxx"
10509 !! wikitext
10510 start
10511 ==a==
10512 ===aa===
10513 ====aaa====
10514 ==b==
10515 ===ba===
10516 ===bb===
10517 ====bba====
10518 ===bc===
10519 ==c==
10520 ===ca===
10521 !! html/php
10522 start
10523 ==a==
10524 ===aa===
10525 ====aaa====
10526 xxx
10527
10528 ==c==
10529 ===ca===
10530 !! end
10531
10532 !! test
10533 Section replacement test (section 5)
10534 !! options
10535 replace=5,"xxx"
10536 !! wikitext
10537 start
10538 ==a==
10539 ===aa===
10540 ====aaa====
10541 ==b==
10542 ===ba===
10543 ===bb===
10544 ====bba====
10545 ===bc===
10546 ==c==
10547 ===ca===
10548 !! html/php
10549 start
10550 ==a==
10551 ===aa===
10552 ====aaa====
10553 ==b==
10554 xxx
10555
10556 ===bb===
10557 ====bba====
10558 ===bc===
10559 ==c==
10560 ===ca===
10561 !! end
10562
10563 !! test
10564 Section replacement test (section 6)
10565 !! options
10566 replace=6,"xxx"
10567 !! wikitext
10568 start
10569 ==a==
10570 ===aa===
10571 ====aaa====
10572 ==b==
10573 ===ba===
10574 ===bb===
10575 ====bba====
10576 ===bc===
10577 ==c==
10578 ===ca===
10579 !! html/php
10580 start
10581 ==a==
10582 ===aa===
10583 ====aaa====
10584 ==b==
10585 ===ba===
10586 xxx
10587
10588 ===bc===
10589 ==c==
10590 ===ca===
10591 !! end
10592
10593 !! test
10594 Section replacement test (section 7)
10595 !! options
10596 replace=7,"xxx"
10597 !! wikitext
10598 start
10599 ==a==
10600 ===aa===
10601 ====aaa====
10602 ==b==
10603 ===ba===
10604 ===bb===
10605 ====bba====
10606 ===bc===
10607 ==c==
10608 ===ca===
10609 !! html/php
10610 start
10611 ==a==
10612 ===aa===
10613 ====aaa====
10614 ==b==
10615 ===ba===
10616 ===bb===
10617 xxx
10618
10619 ===bc===
10620 ==c==
10621 ===ca===
10622 !! end
10623
10624 !! test
10625 Section replacement test (section 8)
10626 !! options
10627 replace=8,"xxx"
10628 !! wikitext
10629 start
10630 ==a==
10631 ===aa===
10632 ====aaa====
10633 ==b==
10634 ===ba===
10635 ===bb===
10636 ====bba====
10637 ===bc===
10638 ==c==
10639 ===ca===
10640 !! html/php
10641 start
10642 ==a==
10643 ===aa===
10644 ====aaa====
10645 ==b==
10646 ===ba===
10647 ===bb===
10648 ====bba====
10649 xxx
10650
10651 ==c==
10652 ===ca===
10653 !!end
10654
10655 !! test
10656 Section replacement test (section 9)
10657 !! options
10658 replace=9,"xxx"
10659 !! wikitext
10660 start
10661 ==a==
10662 ===aa===
10663 ====aaa====
10664 ==b==
10665 ===ba===
10666 ===bb===
10667 ====bba====
10668 ===bc===
10669 ==c==
10670 ===ca===
10671 !! html/php
10672 start
10673 ==a==
10674 ===aa===
10675 ====aaa====
10676 ==b==
10677 ===ba===
10678 ===bb===
10679 ====bba====
10680 ===bc===
10681 xxx
10682 !! end
10683
10684 !! test
10685 Section replacement test (section 10)
10686 !! options
10687 replace=10,"xxx"
10688 !! wikitext
10689 start
10690 ==a==
10691 ===aa===
10692 ====aaa====
10693 ==b==
10694 ===ba===
10695 ===bb===
10696 ====bba====
10697 ===bc===
10698 ==c==
10699 ===ca===
10700 !! html/php
10701 start
10702 ==a==
10703 ===aa===
10704 ====aaa====
10705 ==b==
10706 ===ba===
10707 ===bb===
10708 ====bba====
10709 ===bc===
10710 ==c==
10711 xxx
10712 !! end
10713
10714 !! test
10715 Section replacement test with initial whitespace (T15728)
10716 !! options
10717 replace=2,"xxx"
10718 !! wikitext
10719 Preformatted initial line
10720 ==a==
10721 ===a===
10722 !! html/php
10723 Preformatted initial line
10724 ==a==
10725 xxx
10726 !! end
10727
10728
10729 !! test
10730 Section extraction, heading followed by pre with 20 spaces (T8398)
10731 !! options
10732 section=1
10733 !! wikitext
10734 ==a==
10735 a
10736 !! html/php
10737 ==a==
10738 a
10739 !! end
10740
10741 !! test
10742 Section extraction, heading followed by pre with 19 spaces (T8398 check)
10743 !! options
10744 section=1
10745 !! wikitext
10746 ==a==
10747 a
10748 !! html/php
10749 ==a==
10750 a
10751 !! end
10752
10753
10754 !! test
10755 Section extraction, <pre> around bogus header (T12309)
10756 !! options
10757 section=2
10758 !! wikitext
10759 == Section One ==
10760 <pre>
10761 =======
10762 </pre>
10763
10764 == Section Two ==
10765 stuff
10766 !! html/php
10767 == Section Two ==
10768 stuff
10769 !! end
10770
10771 !! test
10772 Section replacement, <pre> around bogus header (T12309)
10773 !! options
10774 replace=2,"xxx"
10775 !! wikitext
10776 == Section One ==
10777 <pre>
10778 =======
10779 </pre>
10780
10781 == Section Two ==
10782 stuff
10783 !! html/php
10784 == Section One ==
10785 <pre>
10786 =======
10787 </pre>
10788
10789 xxx
10790 !! end
10791
10792 !! test
10793 Handling of &#x0A; in URLs
10794 !! wikitext
10795 *irc://&#x0A;a
10796 !! html/php
10797 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
10798 !! html/parsoid
10799 <ul><li><a rel="mw:ExtLink" href="irc://%0Aa" class="external free" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul>
10800 !! end
10801
10802 !! test
10803 Handling of %0A in URLs
10804 !! wikitext
10805 *irc://%0Aa
10806 !! html/php
10807 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
10808 !! html/parsoid
10809 <ul><li><a rel="mw:ExtLink" href="irc://%0Aa" class="external free">irc://%0Aa</a></li></ul>
10810 !! end
10811
10812 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
10813 !! test
10814 5 quotes, code coverage +1 line
10815 !! options
10816 parsoid=wt2html
10817 !! wikitext
10818 '''''
10819 !! html/php
10820 !! html/parsoid
10821 <p><b><i></i></b></p>
10822 !! end
10823
10824 # same html as previous, but wikitext adjusted to match parsoid html2wt
10825 # note that wt2html will put the <i> before the <b>
10826 !! test
10827 5 quotes, code coverage +1 line (1)
10828 !! options
10829 parsoid=html2wt
10830 !! html/parsoid
10831 <p><b><i></i></b></p>
10832 !! wikitext
10833 !! end
10834
10835 # same as previous, just swapping the <i> and <b>
10836 !! test
10837 5 quotes, code coverage +1 line (2)
10838 !! options
10839 parsoid=html2wt
10840 !! html/parsoid
10841 <p><i><b></b></i></p>
10842 !! wikitext
10843 !! end
10844
10845 !! test
10846 Special:Search page linking.
10847 !! wikitext
10848 {{Special:search}}
10849 !! html/php
10850 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10851 </p>
10852 !! html/parsoid+integrated
10853 <p><a href="/wiki/Special:Search" title="Special:Search" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Special:search","href":"./Special:Search"},"params":{},"i":0}}]}'>Special:Search</a></p>
10854 !! end
10855
10856 !! test
10857 {{!}} is a magic word
10858 !! wikitext
10859 {{!}} is a magic word there and {{!}} is still a magic word here
10860 | is not a magic word here but {{!}} is still a magic word here
10861 !! html/php
10862 <p>| is a magic word there and | is still a magic word here
10863 | is not a magic word here but | is still a magic word here
10864 </p>
10865 !! html/parsoid
10866 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
10867 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
10868 !! end
10869
10870 !! test
10871 Single {{!}} in table cell
10872 !! wikitext
10873 {|
10874 | colspan="1" |foo {{!}} bar
10875 |}
10876 !! html/php
10877 <table>
10878 <tbody><tr>
10879 <td colspan="1">foo | bar
10880 </td></tr></tbody></table>
10881 !! html/parsoid
10882 <table>
10883 <tbody><tr><td colspan="1">foo <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> bar</td></tr>
10884 </tbody></table>
10885 !! end
10886
10887 !! article
10888 Template:T290526
10889 !! text
10890 Main Page{{!}}Something else
10891 !! endarticle
10892
10893 !! test
10894 Using {{!}} in wikilinks (T290526)
10895 !! wikitext
10896 [[Main Page{{!}}Something else]]
10897
10898 [[{{T290526}}]]
10899 !! html
10900 <p><a href="/wiki/Main_Page" title="Main Page">Something else</a>
10901 </p><p><a href="/wiki/Main_Page" title="Main Page">Something else</a>
10902 </p>
10903 !! end
10904
10905 !! test
10906 Using {{!}} in template arguments (T290526)
10907 !! wikitext
10908 {{1x|Main Page{{!}}Something else}}
10909
10910 {{1x|{{T290526}}}}
10911 !! html/php
10912 <p>Main Page|Something else
10913 </p><p>Main Page|Something else
10914 </p>
10915 !! html/parsoid
10916 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"Main Page{{!}}Something else"}},"i":0}}]}'>Main Page|Something else</span></p>
10917
10918 <p><span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"{{T290526}}"}},"i":0}}]}'>Main Page|Something else</span></p>
10919 !! end
10920
10921 # wt2wt,html2wt,html2html modes will add <nowiki> around the {{ }} in
10922 # the last line
10923 !! test
10924 Using {{!}} in template arguments, part 2 (T290526)
10925 !! options
10926 parsoid=wt2html
10927 !! wikitext
10928 {{ Main Page|Something else }}
10929
10930 {{ {{T290526}} }}
10931 !! html/php
10932 <p><a href="/index.php?title=Template:Main_Page&amp;action=edit&amp;redlink=1" class="new" title="Template:Main Page (page does not exist)">Template:Main Page</a>
10933 </p><p>{{ Main Page|Something else }}
10934 </p>
10935 !! html/parsoid
10936 <p><a rel="mw:WikiLink" href="./Template:Main_Page?action=edit&amp;redlink=1" title="Template:Main Page" about="#mwt1" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./Template:Main_Page"},"sa":{"href":"Template:Main_Page"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"Main Page","href":"./Template:Main_Page"},"params":{"1":{"wt":"Something else "}},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Template:Main Page"]}}'>Template:Main_Page</a></p>
10937
10938 <p>{{ <span about="#mwt5" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"T290526","href":"./Template:T290526"},"params":{},"i":0}}]}'>Main Page|Something else</span> }}</p>
10939 !! end
10940
10941 !! test
10942 Say the magic word
10943 !! options
10944 title=[[Parser test]]
10945 !! wikitext
10946 *{{PAGENAME}}
10947 *{{PAGENAMEE}}
10948 *{{FULLPAGENAME}}
10949 *{{FULLPAGENAMEE}}
10950 *{{BASEPAGENAME}}
10951 *{{BASEPAGENAMEE}}
10952 *{{SUBPAGENAME}}
10953 *{{SUBPAGENAMEE}}
10954 *{{ROOTPAGENAME}}
10955 *{{ROOTPAGENAMEE}}
10956 *{{TALKPAGENAME}}
10957 *{{TALKPAGENAMEE}}
10958 *{{SUBJECTPAGENAME}}
10959 *{{SUBJECTPAGENAMEE}}
10960 *{{NAMESPACEE}}
10961 *{{NAMESPACE}}
10962 *{{NAMESPACENUMBER}}
10963 *{{TALKSPACE}}
10964 *{{TALKSPACEE}}
10965 *{{SUBJECTSPACE}}
10966 *{{SUBJECTSPACEE}}
10967 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10968 !! html/php
10969 <ul><li>Parser test</li>
10970 <li>Parser_test</li>
10971 <li>Parser test</li>
10972 <li>Parser_test</li>
10973 <li>Parser test</li>
10974 <li>Parser_test</li>
10975 <li>Parser test</li>
10976 <li>Parser_test</li>
10977 <li>Parser test</li>
10978 <li>Parser_test</li>
10979 <li>Talk:Parser test</li>
10980 <li>Talk:Parser_test</li>
10981 <li>Parser test</li>
10982 <li>Parser_test</li>
10983 <li class="mw-empty-elt"></li>
10984 <li class="mw-empty-elt"></li>
10985 <li>0</li>
10986 <li>Talk</li>
10987 <li>Talk</li>
10988 <li class="mw-empty-elt"></li>
10989 <li class="mw-empty-elt"></li>
10990 <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>
10991 !! html/parsoid
10992 <ul><li><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"PAGENAME","function":"pagename"},"params":{},"i":0}}]}'>Parser test</span></li>
10993 <li><span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"PAGENAMEE","function":"pagenamee"},"params":{},"i":0}}]}'></span></li>
10994 <li><span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"FULLPAGENAME","function":"fullpagename"},"params":{},"i":0}}]}'>Parser test</span></li>
10995 <li><span about="#mwt4" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"FULLPAGENAMEE","function":"fullpagenamee"},"params":{},"i":0}}]}'>Parser test</span></li>
10996 <li><span about="#mwt5" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"BASEPAGENAME","function":"basepagename"},"params":{},"i":0}}]}'>Parser function implementation for pf_basepagename missing in Parsoid.</span></li>
10997 <li><span about="#mwt6" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"BASEPAGENAMEE","function":"basepagenamee"},"params":{},"i":0}}]}'>Parser function implementation for pf_basepagenamee missing in Parsoid.</span></li>
10998 <li><span about="#mwt7" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"SUBPAGENAME","function":"subpagename"},"params":{},"i":0}}]}'>Parser function implementation for pf_subpagename missing in Parsoid.</span></li>
10999 <li><span about="#mwt8" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"SUBPAGENAMEE","function":"subpagenamee"},"params":{},"i":0}}]}'>Parser function implementation for pf_subpagenamee missing in Parsoid.</span></li>
11000 <li><span about="#mwt9" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"ROOTPAGENAME","function":"rootpagename"},"params":{},"i":0}}]}'>Parser function implementation for pf_rootpagename missing in Parsoid.</span></li>
11001 <li><span about="#mwt10" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"ROOTPAGENAMEE","function":"rootpagenamee"},"params":{},"i":0}}]}'>Parser function implementation for pf_rootpagenamee missing in Parsoid.</span></li>
11002 <li><span about="#mwt11" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"TALKPAGENAME","function":"talkpagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11003 <li><span about="#mwt12" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"TALKPAGENAMEE","function":"talkpagenamee"},"params":{},"i":0}}]}'>Parser function implementation for pf_talkpagenamee missing in Parsoid.</span></li>
11004 <li><span about="#mwt13" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"SUBJECTPAGENAME","function":"subjectpagename"},"params":{},"i":0}}]}'>Parser function implementation for pf_subjectpagename missing in Parsoid.</span></li>
11005 <li><span about="#mwt14" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"SUBJECTPAGENAMEE","function":"subjectpagenamee"},"params":{},"i":0}}]}'>Parser function implementation for pf_subjectpagenamee missing in Parsoid.</span></li>
11006 <li><span about="#mwt15" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"NAMESPACEE","function":"namespacee"},"params":{},"i":0}}]}'>Main</span></li>
11007 <li><span about="#mwt16" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"NAMESPACE","function":"namespace"},"params":{},"i":0}}]}'>Main</span></li>
11008 <li><span about="#mwt17" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"NAMESPACENUMBER","function":"namespacenumber"},"params":{},"i":0}}]}'>0</span></li>
11009 <li><span about="#mwt18" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"TALKSPACE","function":"talkspace"},"params":{},"i":0}}]}'>Talk</span></li>
11010 <li><span about="#mwt19" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"TALKSPACEE","function":"talkspacee"},"params":{},"i":0}}]}'>Parser function implementation for pf_talkspacee missing in Parsoid.</span></li>
11011 <li><span about="#mwt20" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"SUBJECTSPACE","function":"subjectspace"},"params":{},"i":0}}]}'>Main</span></li>
11012 <li><span about="#mwt21" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"SUBJECTSPACEE","function":"subjectspacee"},"params":{},"i":0}}]}'>Parser function implementation for pf_subjectspacee missing in Parsoid.</span></li>
11013 <li><a rel="mw:WikiLink" href="./Template:Dynamic?action=edit&amp;redlink=1" title="Template:Dynamic" about="#mwt22" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./Template:Dynamic"},"sa":{"href":"Template:Dynamic"},"pi":[[{"k":"1"},{"k":"2"},{"k":"3"},{"k":"4"},{"k":"5"},{"k":"6"},{"k":"7"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"Dynamic","href":"./Template:Dynamic"},"params":{"1":{"wt":"{{NUMBEROFUSERS}}"},"2":{"wt":"{{NUMBEROFPAGES}}"},"3":{"wt":"{{CURRENTVERSION}}"},"4":{"wt":"{{CONTENTLANGUAGE}}"},"5":{"wt":"{{DIRECTIONMARK}}"},"6":{"wt":"{{CURRENTTIMESTAMP}}"},"7":{"wt":"{{NUMBEROFARTICLES}}"}},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Template:Dynamic"]}}'>Template:Dynamic</a></li></ul>
11014 !! html/parsoid+integrated
11015 <ul><li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"PAGENAME","function":"pagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11016 <li><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"PAGENAMEE","function":"pagenamee"},"params":{},"i":0}}]}'>Parser_test</span></li>
11017 <li><span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"FULLPAGENAME","function":"fullpagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11018 <li><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"FULLPAGENAMEE","function":"fullpagenamee"},"params":{},"i":0}}]}'>Parser_test</span></li>
11019 <li><span about="#mwt5" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"BASEPAGENAME","function":"basepagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11020 <li><span about="#mwt6" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"BASEPAGENAMEE","function":"basepagenamee"},"params":{},"i":0}}]}'>Parser_test</span></li>
11021 <li><span about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SUBPAGENAME","function":"subpagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11022 <li><span about="#mwt8" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SUBPAGENAMEE","function":"subpagenamee"},"params":{},"i":0}}]}'>Parser_test</span></li>
11023 <li><span about="#mwt9" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ROOTPAGENAME","function":"rootpagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11024 <li><span about="#mwt10" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ROOTPAGENAMEE","function":"rootpagenamee"},"params":{},"i":0}}]}'>Parser_test</span></li>
11025 <li><span about="#mwt11" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"TALKPAGENAME","function":"talkpagename"},"params":{},"i":0}}]}'>Talk:Parser test</span></li>
11026 <li><span about="#mwt12" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"TALKPAGENAMEE","function":"talkpagenamee"},"params":{},"i":0}}]}'>Talk:Parser_test</span></li>
11027 <li><span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SUBJECTPAGENAME","function":"subjectpagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11028 <li><span about="#mwt14" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SUBJECTPAGENAMEE","function":"subjectpagenamee"},"params":{},"i":0}}]}'>Parser_test</span></li>
11029 <li><span about="#mwt15" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"NAMESPACEE","function":"namespacee"},"params":{},"i":0}}]}'></span></li>
11030 <li><span about="#mwt16" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"NAMESPACE","function":"namespace"},"params":{},"i":0}}]}'></span></li>
11031 <li><span about="#mwt17" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"NAMESPACENUMBER","function":"namespacenumber"},"params":{},"i":0}}]}'>0</span></li>
11032 <li><span about="#mwt18" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"TALKSPACE","function":"talkspace"},"params":{},"i":0}}]}'>Talk</span></li>
11033 <li><span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"TALKSPACEE","function":"talkspacee"},"params":{},"i":0}}]}'>Talk</span></li>
11034 <li><span about="#mwt20" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SUBJECTSPACE","function":"subjectspace"},"params":{},"i":0}}]}'></span></li>
11035 <li><span about="#mwt21" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SUBJECTSPACEE","function":"subjectspacee"},"params":{},"i":0}}]}'></span></li>
11036 <li><a rel="mw:WikiLink" href="./Template:Dynamic?action=edit&amp;redlink=1" title="Template:Dynamic" about="#mwt22" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./Template:Dynamic"},"sa":{"href":":Template:Dynamic"},"pi":[[{"k":"1"},{"k":"2"},{"k":"3"},{"k":"4"},{"k":"5"},{"k":"6"},{"k":"7"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"Dynamic","href":"./Template:Dynamic"},"params":{"1":{"wt":"{{NUMBEROFUSERS}}"},"2":{"wt":"{{NUMBEROFPAGES}}"},"3":{"wt":"{{CURRENTVERSION}}"},"4":{"wt":"{{CONTENTLANGUAGE}}"},"5":{"wt":"{{DIRECTIONMARK}}"},"6":{"wt":"{{CURRENTTIMESTAMP}}"},"7":{"wt":"{{NUMBEROFARTICLES}}"}},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Template:Dynamic"]}}'>Template:Dynamic</a></li></ul>
11037 !! end
11038 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11039
11040 !! test
11041 HTML Hex character encoding (spells the word "JavaScript")
11042 !! options
11043 parsoid=wt2html,wt2wt,html2html
11044 !! wikitext
11045 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11046 !! html/php
11047 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11048 </p>
11049 !! html/parsoid
11050 <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>
11051 !! end
11052
11053 !! test
11054 HTML Hex character encoding bogus encoding (T28437 regression check)
11055 !! wikitext
11056 &#xsee;&#XSEE;
11057 !! html
11058 <p>&amp;#xsee;&amp;#XSEE;
11059 </p>
11060 !! end
11061
11062 !! test
11063 HTML Hex character encoding mixed case
11064 !! options
11065 parsoid=wt2html,wt2wt,html2html
11066 !! wikitext
11067 &#xEE;&#Xee;
11068 !! html/php
11069 <p>&#xee;&#xee;
11070 </p>
11071 !! html/parsoid
11072 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
11073 !! end
11074
11075 # See: https://www.w3.org/TR/html5/syntax.html#character-references
11076 # Note that U+000C (form feed) is not a valid XML character, so
11077 # it is banned even though allowed in HTML5.
11078 # Note there are also weird legacy numeric entities which are mapped
11079 # elsewhere; see T113194
11080 !! test
11081 Illegal character references (T106578, T113194)
11082 !! options
11083 parsoid={ "modes": ["wt2html","html2html"], "normalizePhp": true }
11084 !! wikitext
11085 ; Null: &#00;
11086 ; FF: &#xC;
11087 ; CR: &#xD;
11088 ; Control (low): &#8;
11089 ; Control (high): &#x7F; &#x9F;
11090 ; Unsupported legacy: &#128; &#130; &#131; &#150; &#159;
11091 ; Surrogate: &#xD83D;&#xDCA9;
11092 ; Invalid characters: &#xfffe; &#xffff;
11093 ; This is an okay astral character: &#x1F4A9;
11094 ; This is an okay multi-codepoint HTML5 entity: &acE;
11095 ; This are valid wikitext-specific entities: &רלמ; &رلم;
11096 ; Highest valid characters: &#x10fffd; &#x10fffe; &#x10ffff;
11097 !! html
11098 <dl><dt>Null</dt>
11099 <dd>&amp;#00;</dd>
11100 <dt>FF</dt>
11101 <dd>&amp;#xC;</dd>
11102 <dt>CR</dt>
11103 <dd>&amp;#xD;</dd>
11104 <dt>Control (low)</dt>
11105 <dd>&amp;#8;</dd>
11106 <dt>Control (high)</dt>
11107 <dd>&amp;#x7F; &amp;#x9F;</dd>
11108 <dt>Unsupported legacy</dt>
11109 <dd>&amp;#128; &amp;#130; &amp;#131; &amp;#150; &amp;#159;</dd>
11110 <dt>Surrogate</dt>
11111 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
11112 <dt>Invalid characters</dt>
11113 <dd>&amp;#xfffe; &amp;#xffff;</dd>
11114 <dt>This is an okay astral character</dt>
11115 <dd>&#x1f4a9;</dd>
11116 <dt>This is an okay multi-codepoint HTML5 entity</dt>
11117 <dd>&#8766;&#819;</dd>
11118 <dt>This are valid wikitext-specific entities</dt>
11119 <dd>&#8207; &#8207;</dd>
11120 <dt>Highest valid characters</dt>
11121 <dd>&#x10fffd; &#x10fffe; &#x10ffff;</dd></dl>
11122 !! end
11123
11124 !! test
11125 Another italics / bold test
11126 !! options
11127 parsoid=wt2html
11128 !! wikitext
11129 ''' ''x'
11130 !! html/*
11131 <pre>'<i> </i>x'
11132 </pre>
11133 !! end
11134
11135 !! test
11136 dt/dd/dl test
11137 !! wikitext
11138 :;;;::
11139 !! html
11140 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
11141 !! end
11142
11143 !! test
11144 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11145 !! wikitext
11146 <html><script>alert(1);</script></html>
11147 !! html
11148 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11149 </p>
11150 !! end
11151
11152 !! test
11153 HTML with raw HTML ($wgRawHtml==true)
11154 !! options
11155 wgRawHtml=1
11156 !! wikitext
11157 <html><script>alert(1);</script></html>
11158 !! html/php
11159 <p><script>alert(1);</script>
11160 </p>
11161 !! html/parsoid
11162 <p><script typeof="mw:Extension/html" about="#mwt3" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;script>alert(1);&lt;/script>"}}'>alert(1);</script></p>
11163 !! end
11164
11165 !! test
11166 Empty tag w/ raw HTML ($wgRawHtml==true)
11167 !! options
11168 wgRawHtml=1
11169 !! wikitext
11170 <html />
11171 !! html/php
11172 <p class="mw-empty-elt">
11173 </p>
11174 !! html/parsoid
11175 <p><link typeof="mw:Extension/html" about="#mwt2" data-mw='{"name":"html","attrs":{}}'/></p>
11176 !! end
11177
11178
11179 !! article
11180 Subpage test
11181 !! text
11182 subpage
11183 !! end
11184
11185 !! article
11186 Subpage test/L1
11187 !! text
11188 subpage l1
11189 !! end
11190
11191 !! article
11192 Subpage test/L1/L2
11193 !! text
11194 subpage l2
11195 !! end
11196
11197 !! test
11198 Parents of subpages, one level up
11199 !! options
11200 subpage title=[[Subpage test/L1/L2/L3]]
11201 !! wikitext
11202 [[../|L2]]
11203 !! html/php
11204 <p><a href="/wiki/Subpage_test/L1/L2" title="Subpage test/L1/L2">L2</a>
11205 </p>
11206 !! html/parsoid
11207 <p><a rel="mw:WikiLink" href="./Subpage_test/L1/L2" title="Subpage test/L1/L2" data-parsoid='{"stx":"piped","a":{"href":"./Subpage_test/L1/L2"},"sa":{"href":"../"}}'>L2</a></p>
11208 !! end
11209
11210 !! test
11211 Parents of subpages, one level up, not named
11212 !! options
11213 subpage title=[[Subpage test/L1/L2/L3]]
11214 !! wikitext
11215 [[../]]
11216 !! html/php
11217 <p><a href="/wiki/Subpage_test/L1/L2" title="Subpage test/L1/L2">Subpage test/L1/L2</a>
11218 </p>
11219 !! html/parsoid
11220 <p><a rel="mw:WikiLink" href="./Subpage_test/L1/L2" title="Subpage test/L1/L2" data-parsoid='{"stx":"simple","a":{"href":"./Subpage_test/L1/L2"},"sa":{"href":"../"}}'>Subpage test/L1/L2</a></p>
11221 !! end
11222
11223 !! test
11224 Parents of subpages, two levels up
11225 !! options
11226 subpage title=[[Subpage test/L1/L2/L3]]
11227 !! wikitext
11228 [[../../|L1]]2
11229
11230 [[../../|L1]]l
11231 !! html/php
11232 <p><a href="/wiki/Subpage_test/L1" title="Subpage test/L1">L1</a>2
11233 </p><p><a href="/wiki/Subpage_test/L1" title="Subpage test/L1">L1l</a>
11234 </p>
11235 !! html/parsoid
11236 <p><a rel="mw:WikiLink" href="./Subpage_test/L1" title="Subpage test/L1" data-parsoid='{"stx":"piped","a":{"href":"./Subpage_test/L1"},"sa":{"href":"../../"}}'>L1</a>2</p>
11237
11238 <p><a rel="mw:WikiLink" href="./Subpage_test/L1" title="Subpage test/L1" data-parsoid='{"stx":"piped","a":{"href":"./Subpage_test/L1"},"sa":{"href":"../../"},"tail":"l"}'>L1l</a></p>
11239 !! end
11240
11241 !! test
11242 Parents of subpages, two levels up, without trailing slash or name.
11243 !! options
11244 subpage title=[[Subpage test/L1/L2/L3]]
11245 !! wikitext
11246 [[../..]]
11247 !! html
11248 <p>[[../..]]
11249 </p>
11250 !! end
11251
11252 !! test
11253 Parents of subpages, two levels up, with lots of extra trailing slashes.
11254 !! options
11255 subpage title=[[Subpage test/L1/L2/L3]]
11256 !! wikitext
11257 [[../../////]]
11258 !! html/php
11259 <p><a href="/wiki/Subpage_test/L1" title="Subpage test/L1">Subpage test/L1</a>
11260 </p>
11261 !! html/parsoid
11262 <p><a rel="mw:WikiLink" href="./Subpage_test/L1" title="Subpage test/L1" data-parsoid='{"stx":"simple","a":{"href":"./Subpage_test/L1"},"sa":{"href":"../../////"}}'>Subpage test/L1</a></p>
11263 !! end
11264
11265 !! article
11266 Subpage test/L1/L2/L3Sibling
11267 !! text
11268 Sibling article
11269 !! endarticle
11270
11271 !! test
11272 Transclusion of a sibling page (one level up)
11273 !! options
11274 subpage title=[[Subpage test/L1/L2/L3]]
11275 !! wikitext
11276 {{../L3Sibling}}
11277 !! html
11278 <p>Sibling article
11279 </p>
11280 !! end
11281
11282 !! test
11283 Transclusion of a child page
11284 !! options
11285 subpage title=[[Subpage test/L1/L2]]
11286 !! wikitext
11287 {{/L3Sibling}}
11288 !! html
11289 <p>Sibling article
11290 </p>
11291 !! end
11292
11293 # This is wt2html only in Parsoid because we add <nowiki>
11294 # because of {{..}} and we don't expect to fix that to
11295 # eliminate the nowikis selective for {{..}} markup.
11296 !! test
11297 Non-transclusion because of too many up levels
11298 !! options
11299 subpage title=[[Subpage test/L1/L2/L3]]
11300 parsoid=wt2html
11301 !! wikitext
11302 {{../../../../More than parent}}
11303 !! html/php
11304 <p>{{../../../../More than parent}}
11305 </p>
11306 !! html/parsoid
11307 <p>{{../../../../More than parent}}</p>
11308 !! end
11309
11310 !! test
11311 Definition list code coverage
11312 !! options
11313 parsoid=wt2html,html2html
11314 !! wikitext
11315 ;title :def
11316 ;title :def
11317 ;title:def
11318 !! html/php
11319 <dl><dt>title</dt>
11320 <dd>def</dd>
11321 <dt>title</dt>
11322 <dd>def</dd>
11323 <dt>title</dt>
11324 <dd>def</dd></dl>
11325 !! html/parsoid
11326 <dl><dt>title </dt><dd>def</dd>
11327 <dt>title </dt><dd>def</dd>
11328 <dt>title</dt><dd>def</dd></dl>
11329 !! end
11330
11331 !! test
11332 Don't fall for the self-closing div
11333 !! wikitext
11334 <div>hello world</div/>
11335 !! html
11336 <div>hello world</div>
11337 !! end
11338
11339 !! test
11340 MSGNW magic word
11341 !! wikitext
11342 {{MSGNW:msg}}
11343 !! html/php
11344 <p>&#91;&#91;:Template:Msg&#93;&#93;
11345 </p>
11346 !! end
11347
11348 !! test
11349 RAW magic word
11350 !! wikitext
11351 {{RAW:QUERTY}}
11352 !! html/php
11353 <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>
11354 </p>
11355 !! html/parsoid+integrated
11356 <p><a rel="mw:WikiLink" href="./Template:QUERTY?action=edit&amp;redlink=1" title="Template:QUERTY" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-mw='{"parts":[{"template":{"target":{"wt":"RAW:QUERTY","href":"./Template:RAW:QUERTY"},"params":{},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Template:QUERTY"]}}'>Template:QUERTY</a></p>
11357 !! end
11358
11359 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11360 !! test
11361 Always escape literal '>' in output, not just after '<'
11362 !! wikitext
11363 ><>
11364 !! html
11365 <p>&gt;&lt;&gt;
11366 </p>
11367 !! end
11368
11369 !! test
11370 Template caching
11371 !! wikitext
11372 {{Test}}
11373 {{Test}}
11374 !! html
11375 <p>This is a test template
11376 This is a test template
11377 </p>
11378 !! end
11379
11380 !! test
11381 anchorencode
11382 !! config
11383 wgFragmentMode=[ "html5", "legacy" ]
11384 !! wikitext
11385 {{anchorencode:foo bar©#%n}}
11386 !! html/php
11387 <p>foo_bar©#%n
11388 </p>
11389 !! html/parsoid
11390 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:foo bar©#%n","function":"anchorencode"},"params":{},"i":0}}]}'>foo_bar©#%n</span></p>
11391 !! end
11392
11393 !! test
11394 anchorencode (legacy)
11395 !! config
11396 wgFragmentMode=[ "legacy" ]
11397 !! wikitext
11398 {{anchorencode:foo bar©#%n}}
11399 !! html/php
11400 <p>foo_bar.C2.A9.23.25n
11401 </p>
11402 !! end
11403
11404 !! test
11405 anchorencode trims spaces
11406 !! config
11407 wgFragmentMode=[ "html5", "legacy" ]
11408 !! wikitext
11409 {{anchorencode: __pretty__please__}}
11410 !! html/php
11411 <p>pretty_please
11412 </p>
11413 !! html/parsoid
11414 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</span></p>
11415 !! end
11416
11417 !! test
11418 anchorencode deals with links
11419 !! config
11420 wgFragmentMode=[ "html5", "legacy" ]
11421 !! wikitext
11422 {{anchorencode: [[hello|world]] [[hi]]}}
11423 !! html/php
11424 <p>world_hi
11425 </p>
11426 !! html/parsoid
11427 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</span></p>
11428 !! end
11429
11430 !! test
11431 anchorencode deals with templates
11432 !! config
11433 wgFragmentMode=[ "html5", "legacy" ]
11434 !! wikitext
11435 {{anchorencode: {{Foo}} x}}
11436 !! html/php
11437 <p>FOO_x
11438 </p>
11439 !! html/parsoid
11440 <p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</span></p>
11441 !! end
11442
11443 !! test
11444 anchorencode encodes like the TOC generator: (T20431)
11445 !! config
11446 wgFragmentMode=[ "html5", "legacy" ]
11447 wgParserEnableLegacyHeadingDOM=false
11448 !! wikitext
11449 ===_ +:.3A%3A _ &&amp;]] x===
11450 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
11451
11452 __NOEDITSECTION__
11453 !! html/php
11454 <div class="mw-heading mw-heading3"><h3 id="+:.3A%3A_&amp;&amp;]]_x"><span id=".2B:.3A.253A_.26.26.5D.5D_x"></span>_ +:.3A%3A _ &amp;&amp;]] x</h3></div>
11455 <p>+:.3A%253A_&amp;&amp;&#93;&#93;_x
11456 </p><p><br />
11457 </p>
11458 !! html/parsoid+standalone
11459 <h3 id="+:.3A%3A_&amp;&amp;]]_x"><span id=".2B:.3A.253A_.26.26.5D.5D_x" typeof="mw:FallbackId"></span>_ +:.3A%3A _ &amp;<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>]] x</h3>
11460 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: _ +:.3A%3A _ &amp;&amp;amp;]] x","function":"anchorencode"},"params":{},"i":0}}]}'>+:.3A%253A_&amp;&amp;</span><span typeof="mw:Entity" about="#mwt1">]</span><span typeof="mw:Entity" about="#mwt1">]</span><span about="#mwt1">_x</span></p>
11461 <meta property="mw:PageProp/noeditsection"/>
11462 !! html/parsoid+integrated
11463 <h3 id="+:.3A%3A_&amp;&amp;]]_x"><span id=".2B:.3A.253A_.26.26.5D.5D_x" typeof="mw:FallbackId"></span>_ +:.3A%3A _ &amp;<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>]] x</h3>
11464 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: _ +:.3A%3A _ &amp;&amp;amp;]] x","function":"anchorencode"},"params":{},"i":0}}]}'>+:.3A%253A_</span><span typeof="mw:Entity" about="#mwt1">&amp;</span><span typeof="mw:Entity" about="#mwt1">&amp;</span><span typeof="mw:Entity" about="#mwt1">]</span><span typeof="mw:Entity" about="#mwt1">]</span><span about="#mwt1">_x</span></p>
11465 <meta property="mw:PageProp/noeditsection"/>
11466 !! end
11467
11468 !! test
11469 anchorencode encodes like the TOC generator: (T20431) (legacy)
11470 !! config
11471 wgFragmentMode=[ "legacy" ]
11472 wgParserEnableLegacyHeadingDOM=false
11473 !! wikitext
11474 ===_ +:.3A%3A&&amp;]]===
11475 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11476 __NOEDITSECTION__
11477 !! html/php
11478 <div class="mw-heading mw-heading3"><h3 id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</h3></div>
11479 <p>.2B:.3A.253A.26.26.5D.5D
11480 </p>
11481 !! end
11482
11483 !! test
11484 T8200: blockquotes and paragraph formatting
11485 !! wikitext
11486 <blockquote>
11487 foo
11488 </blockquote>
11489
11490 bar
11491
11492 baz
11493 !! html
11494 <blockquote>
11495 <p>foo
11496 </p>
11497 </blockquote>
11498 <p>bar
11499 </p>
11500 <pre>baz
11501 </pre>
11502 !! end
11503
11504 !! test
11505 T10293: Use of center tag ruins paragraph formatting
11506 !! wikitext
11507 <center>
11508 foo
11509 </center>
11510
11511 bar
11512
11513 baz
11514 !! html
11515 <center>
11516 <p>foo
11517 </p>
11518 </center>
11519 <p>bar
11520 </p>
11521 <pre>baz
11522 </pre>
11523 !! end
11524
11525 !!test
11526 Parsing of overlapping (improperly nested) inline html tags
11527 !! wikitext
11528 <span><s>x</span></s>
11529 !! html
11530 <p><span><s>x</s></span>
11531 </p>
11532 !!end
11533
11534 !! test
11535 T2529: Uncovered bullet
11536 !! wikitext
11537 *Foo {{bullet}}
11538 !! html/php
11539 <ul><li>Foo</li>
11540 <li>Bar</li></ul>
11541 !! html/parsoid
11542 <ul><li>Foo</li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'>
11543 </span><li about="#mwt1">Bar</li></ul>
11544 !! end
11545
11546 !! test
11547 T2529: Uncovered bullet in a deeply nested list
11548 !! wikitext
11549 *******Foo {{bullet}}
11550 !! html/php
11551 <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>
11552 <li>Bar</li></ul>
11553 !! html/parsoid
11554 <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><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'>
11555 </span><li about="#mwt1">Bar</li></ul>
11556 !! end
11557
11558 !! test
11559 T2529: Uncovered table already at line-start
11560 !! wikitext
11561 x
11562
11563 {{table}}
11564 y
11565 !! html/php
11566 <p>x
11567 </p>
11568 <table>
11569 <tbody><tr>
11570 <td>1</td>
11571 <td>2
11572 </td></tr>
11573 <tr>
11574 <td>3</td>
11575 <td>4
11576 </td></tr></tbody></table>
11577 <p>y
11578 </p>
11579 !! html/parsoid
11580 <p>x</p>
11581
11582 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"table","href":"./Template:Table"},"params":{},"i":0}}]}'>
11583 <tbody><tr><td>1</td><td>2</td></tr>
11584 <tr>
11585 <td>3</td><td>4</td></tr>
11586 </tbody></table>
11587 <p>y</p>
11588 !! end
11589
11590 !! test
11591 T2529: Uncovered bullet in parser function result
11592 !! wikitext
11593 *Foo{{lc:{{bullet}} }}
11594 !! html/php
11595 <ul><li>Foo</li>
11596 <li>bar</li></ul>
11597 !! html/parsoid+integrated
11598 <ul><li>Foo</li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"lc:{{bullet}} ","function":"lc"},"params":{},"i":0}}]}'>
11599 </span><li about="#mwt1">bar</li></ul>
11600 !! end
11601
11602 !! test
11603 T7678: Double-parsed template argument
11604 !! wikitext
11605 {{lc:{{{1}}}|hello}}
11606 !! html
11607 <p>{{{1}}}
11608 </p>
11609 !! end
11610
11611 ## wt2html only, since the bare {{ will get escaped when serializing
11612 !! test
11613 T7678: Double-parsed template invocation
11614 !! options
11615 parsoid=wt2html
11616 !! wikitext
11617 {{lc:{{paramtest {{!}} param = hello }} }}
11618 !! html/php
11619 <p>{{paramtest | param = hello }}
11620 </p>
11621 !! html/parsoid+integrated
11622 <p><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"lc:{{paramtest {{!}} param = hello }} ","function":"lc"},"params":{},"i":0}}]}'>{{paramtest | param = hello }}</span></p>
11623 !! end
11624
11625 !! test
11626 Case insensitivity of parser functions for non-ASCII characters (T10143)
11627 !! options
11628 language=cs
11629 title=[[Main Page]]
11630 !! wikitext
11631 {{PRVNÍVELKÉ:ěščř}}
11632 {{prvnívelké:ěščř}}
11633 {{PRVNÍMALÉ:ěščř}}
11634 {{prvnímalé:ěščř}}
11635 {{MALÁ:ěščř}}
11636 {{malá:ěščř}}
11637 {{VELKÁ:ěščř}}
11638 {{velká:ěščř}}
11639 !! html
11640 <p>Ěščř
11641 Ěščř
11642 ěščř
11643 ěščř
11644 ěščř
11645 ěščř
11646 ĚŠČŘ
11647 ĚŠČŘ
11648 </p>
11649 !! end
11650
11651 !! test
11652 Paragraphs inside divs (no extra line breaks)
11653 !! wikitext
11654 <div>Line one
11655
11656 Line two</div>
11657 !! html
11658 <div>Line one
11659 Line two</div>
11660 !! end
11661
11662 !! test
11663 Paragraphs inside divs (extra line break on open)
11664 !! wikitext
11665 <div>
11666 Line one
11667
11668 Line two</div>
11669 !! html
11670 <div>
11671 <p>Line one
11672 </p>
11673 Line two</div>
11674 !! end
11675
11676 !! test
11677 Paragraphs inside divs (extra line break on close)
11678 !! wikitext
11679 <div>Line one
11680
11681 Line two
11682 </div>
11683 !! html
11684 <div>Line one
11685 <p>Line two
11686 </p>
11687 </div>
11688 !! end
11689
11690 !! test
11691 Paragraphs inside divs (extra line break on open and close)
11692 !! wikitext
11693 <div>
11694 Line one
11695
11696 Line two
11697 </div>
11698 !! html
11699 <div>
11700 <p>Line one
11701 </p><p>Line two
11702 </p>
11703 </div>
11704 !! end
11705
11706 # doBlockLevels screws up this output and Remex cleans up as much as it can.
11707 !! test
11708 Nesting tags, paragraphs on lines which begin with <div>
11709 !! wikitext
11710 <div></div><strong>A
11711 B</strong>
11712 !! html/php
11713 <div></div><p><strong>A
11714 </strong></p><strong></strong><p><strong>B</strong>
11715 </p>
11716 !! html/parsoid
11717 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
11718 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
11719 !! end
11720
11721 # T8200: <blockquote> should behave like <div> with respect to line breaks
11722 !! test
11723 T8200: paragraphs inside blockquotes (no extra line breaks)
11724 !! wikitext
11725 <blockquote>Line one
11726
11727 Line two</blockquote>
11728 !! html
11729 <blockquote><p>Line one
11730 Line two</p></blockquote>
11731 !! end
11732
11733 !! test
11734 T8200: paragraphs inside blockquotes (extra line break on open)
11735 !! wikitext
11736 <blockquote>
11737 Line one
11738
11739 Line two</blockquote>
11740 !! html
11741 <blockquote>
11742 <p>Line one
11743 </p><p>
11744 Line two</p></blockquote>
11745 !! end
11746
11747 !! test
11748 T8200: paragraphs inside blockquotes (extra line break on close)
11749 !! wikitext
11750 <blockquote>Line one
11751
11752 Line two
11753 </blockquote>
11754 !! html
11755 <blockquote><p>Line one
11756 </p><p>Line two
11757 </p>
11758 </blockquote>
11759 !! end
11760
11761 !! test
11762 T8200: paragraphs inside blockquotes (extra line break on open and close)
11763 !! wikitext
11764 <blockquote>
11765 Line one
11766
11767 Line two
11768 </blockquote>
11769 !! html
11770 <blockquote>
11771 <p>Line one
11772 </p><p>Line two
11773 </p>
11774 </blockquote>
11775 !! end
11776
11777 ## This is a corner case interaction between the paragraph wrapping in the
11778 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
11779 ## some tags which close paragraphs (and thus prevent wrapping on their line),
11780 ## of which "div" is one, but do p-wrapping inside them. These are referred
11781 ## to as "never suppressing". Remex, for its part, doesn't traverse into
11782 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
11783 !! test
11784 Paragraphs inside blockquotes/divs (no extra line breaks)
11785 !! wikitext
11786 <blockquote><div>Line one
11787
11788 Line two</div></blockquote>
11789 !! html
11790 <blockquote><div>Line one
11791 Line two</div></blockquote>
11792 !! end
11793
11794 !! test
11795 Paragraphs inside blockquotes/divs (extra line break on open)
11796 !! wikitext
11797 <blockquote><div>
11798 Line one
11799
11800 Line two</div></blockquote>
11801 !! html
11802 <blockquote><div>
11803 <p>Line one
11804 </p>
11805 Line two</div></blockquote>
11806 !! end
11807
11808 !! test
11809 Paragraphs inside blockquotes/divs (extra line break on close)
11810 !! wikitext
11811 <blockquote><div>Line one
11812
11813 Line two
11814 </div></blockquote>
11815 !! html
11816 <blockquote><div>Line one
11817 <p>Line two
11818 </p>
11819 </div></blockquote>
11820 !! end
11821
11822 !! test
11823 Paragraphs inside blockquotes/divs (extra line break on open and close)
11824 !! wikitext
11825 <blockquote><div>
11826 Line one
11827
11828 Line two
11829 </div></blockquote>
11830 !! html
11831 <blockquote><div>
11832 <p>Line one
11833 </p><p>Line two
11834 </p>
11835 </div></blockquote>
11836 !! end
11837
11838 !! test
11839 Interwiki links trounced by handleExternalLinks after early LinkHolderArray expansion
11840 !! options
11841 wgLinkHolderBatchSize=0
11842 !! wikitext
11843 [[meatball:1]]
11844 [[meatball:2]]
11845 [[meatball:3]]
11846 !! html
11847 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
11848 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
11849 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
11850 </p>
11851 !! end
11852
11853 !! test
11854 T17196: localised external link numbers
11855 !! options
11856 language=fa
11857 !! wikitext
11858 [http://en.wikipedia.org/]
11859 !! html/php
11860 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
11861 </p>
11862 !! html/parsoid
11863 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/" class="external autonumber"></a></p>
11864 !! end
11865
11866 !! test
11867 Multibyte character in padleft
11868 !! wikitext
11869 {{padleft:-Hello|7|Æ}}
11870 !! html/php
11871 <p>Æ-Hello
11872 </p>
11873 !! html/parsoid
11874 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</span></p>
11875 !! end
11876
11877 !! test
11878 Multibyte character in padright
11879 !! wikitext
11880 {{padright:Hello-|7|Æ}}
11881 !! html/php
11882 <p>Hello-Æ
11883 </p>
11884 !! html/parsoid
11885 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</span></p>
11886 !! end
11887
11888 !!test
11889 formatdate parser function
11890 !! wikitext
11891 {{#formatdate:2009-03-24}}
11892 !! html/php
11893 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
11894 </p>
11895 !! html/parsoid+integrated
11896 <p><span class="mw-formatted-date" title="2009-03-24" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#formatdate:2009-03-24","function":"formatdate"},"params":{},"i":0}}]}'>2009-03-24</span></p>
11897 !! end
11898
11899 !!test
11900 formatdate parser function, with default format
11901 !! wikitext
11902 {{#formatdate:2009-03-24|mdy}}
11903 !! html/php
11904 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
11905 </p>
11906 !! html/parsoid+integrated
11907 <p><span class="mw-formatted-date" title="2009-03-24" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#formatdate:2009-03-24","function":"formatdate"},"params":{"1":{"wt":"mdy"}},"i":0}}]}'>March 24, 2009</span></p>
11908 !! end
11909
11910 !! test
11911 Spacing of numbers in formatted dates
11912 !! wikitext
11913 {{#formatdate:January 15}}
11914 !! html/php
11915 <p><span class="mw-formatted-date" title="01-15">January 15</span>
11916 </p>
11917 !! html/parsoid+integrated
11918 <p><span class="mw-formatted-date" title="01-15" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"#formatdate:January 15","function":"formatdate"},"params":{},"i":0}}]}'>January 15</span></p>
11919 !! end
11920
11921 !! test
11922 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
11923 !! options
11924 language=nl title=[[MediaWiki:Common.css]]
11925 !! wikitext
11926 {{#formatdate:2009-03-24|dmy}}
11927 !! html/php
11928 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
11929 </p>
11930 !! html/parsoid+integrated
11931 <p><span class="mw-formatted-date" title="2009-03-24" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#formatdate:2009-03-24","function":"formatdate"},"params":{"1":{"wt":"dmy"}},"i":0}}]}'>24 March 2009</span></p>
11932 !! end
11933
11934 !! test
11935 formatdate with invalid month
11936 !! wikitext
11937 {{#formatdate:2019-22-22|dmy}}
11938 !! html/php
11939 <p>2019-22-22
11940 </p>
11941 !! html/parsoid+integrated
11942 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#formatdate:2019-22-22","function":"formatdate"},"params":{"1":{"wt":"dmy"}},"i":0}}]}'>2019-22-22</span></p>
11943 !! end
11944
11945 !! test
11946 formatdate: dots in month name do not match any char (T220563)
11947 !! options
11948 language=de
11949 !! wikitext
11950 {{#formatdate:jun. 3|dmy}}
11951 {{#formatdate:junx 3|dmy}}
11952 !! html/php
11953 <p><span class="mw-formatted-date" title="06-03">3 Juni</span>
11954 junx 3
11955 </p>
11956 !! html/parsoid+integrated
11957 <p><span class="mw-formatted-date" title="06-03" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#formatdate:jun. 3","function":"formatdate"},"params":{"1":{"wt":"dmy"}},"i":0}}]}'>3 Juni</span>
11958 <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#formatdate:junx 3","function":"formatdate"},"params":{"1":{"wt":"dmy"}},"i":0}}]}'>junx 3</span></p>
11959 !! end
11960
11961 !! test
11962 formatdate uses correct capitalisation in French
11963 !! options
11964 language=fr
11965 !! wikitext
11966 {{#formatdate:Juin 3|dmy}}
11967 !! html/php
11968 <p><span class="mw-formatted-date" title="06-03">3 juin</span>
11969 </p>
11970 !! html/parsoid+integrated
11971 <p><span class="mw-formatted-date" title="06-03" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#formatdate:Juin 3","function":"formatdate"},"params":{"1":{"wt":"dmy"}},"i":0}}]}'>3 juin</span></p>
11972 !! end
11973
11974 !! test
11975 formatdate uses correct capitalisation in English
11976 !! wikitext
11977 {{#formatdate:june 3|dmy}}
11978 !! html/php
11979 <p><span class="mw-formatted-date" title="06-03">3 June</span>
11980 </p>
11981 !! html/parsoid+integrated
11982 <p><span class="mw-formatted-date" title="06-03" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#formatdate:june 3","function":"formatdate"},"params":{"1":{"wt":"dmy"}},"i":0}}]}'>3 June</span></p>
11983 !! end
11984
11985 !! test
11986 formatdate formats ISO year 0 as 1 BC
11987 !! wikitext
11988 {{#formatdate:-0001-12-31|mdy}}
11989 {{#formatdate:0000-12-31|mdy}}
11990 {{#formatdate:0001-12-31|mdy}}
11991 !! html/php
11992 <p><span class="mw-formatted-date" title="-0001-12-31">December 31, 2 BC</span>
11993 <span class="mw-formatted-date" title="0000-12-31">December 31, 1 BC</span>
11994 <span class="mw-formatted-date" title="0001-12-31">December 31, 1</span>
11995 </p>
11996 !! html/parsoid+integrated
11997 <p><span class="mw-formatted-date" title="-0001-12-31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#formatdate:-0001-12-31","function":"formatdate"},"params":{"1":{"wt":"mdy"}},"i":0}}]}'>December 31, 2 BC</span> <span class="mw-formatted-date" title="0000-12-31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#formatdate:0000-12-31","function":"formatdate"},"params":{"1":{"wt":"mdy"}},"i":0}}]}'>December 31, 1 BC</span> <span class="mw-formatted-date" title="0001-12-31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#formatdate:0001-12-31","function":"formatdate"},"params":{"1":{"wt":"mdy"}},"i":0}}]}'>December 31, 1</span></p>
11998 !! end
11999
12000 #
12001 #
12002 #
12003
12004 #
12005 # Edit comments
12006 #
12007
12008 !! test
12009 Edit comment with link
12010 !! options
12011 comment
12012 !! wikitext
12013 I like the [[Main Page]] a lot
12014 !! html/php
12015 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12016 !!end
12017
12018 !! test
12019 Edit comment with link and link text
12020 !! options
12021 comment
12022 !! wikitext
12023 I like the [[Main Page|best pages]] a lot
12024 !! html/php
12025 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12026 !!end
12027
12028 !! test
12029 Edit comment with link and link text with suffix
12030 !! options
12031 comment
12032 !! wikitext
12033 I like the [[Main Page|best page]]s a lot
12034 !! html/php
12035 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12036 !!end
12037
12038 !! test
12039 Edit comment with section link (non-local, eg in history list)
12040 !! options
12041 comment title=[[Main Page]]
12042 !! wikitext
12043 /* External links */ removed bogus entries
12044 !! html/php
12045 <span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→<bdi dir="ltr">External links</bdi></a>: </span> removed bogus entries
12046 !!end
12047
12048 !! test
12049 Edit comment with section link and text before it (non-local, eg in history list)
12050 !! options
12051 comment title=[[Main Page]]
12052 !! wikitext
12053 pre-comment text /* External links */ removed bogus entries
12054 !! html/php
12055 pre-comment text <span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→<bdi dir="ltr">External links</bdi></a>: </span> removed bogus entries
12056 !!end
12057
12058 !! test
12059 Edit comment with section link (local, eg in diff view)
12060 !! options
12061 comment local title=[[Main Page]]
12062 !! wikitext
12063 /* External links */ removed bogus entries
12064 !! html/php
12065 <span class="autocomment"><a href="#External_links">→<bdi dir="ltr">External links</bdi></a>: </span> removed bogus entries
12066 !!end
12067
12068 !! test
12069 Edit comment with section link that has a link in it
12070 !! options
12071 comment local title=[[Main Page]]
12072 !! wikitext
12073 /* [[A link]] */
12074 !! html/php
12075 <span class="autocomment"><a href="#A_link">→<bdi dir="ltr">&#91;&#91;A link&#93;&#93;</bdi></a></span>
12076 !! end
12077
12078 !! test
12079 Edit comment with section link that has a template in it
12080 !! options
12081 comment local title=[[Main Page]]
12082 !! wikitext
12083 /* {{foobar|param}} */
12084 !! html/php
12085 <span class="autocomment"><a href="#.7B.7Bfoobar.7Cparam.7D.7D">→<bdi dir="ltr">{{foobar|param}}</bdi></a></span>
12086 !! end
12087
12088 !! test
12089 Edit comment with subpage link (T16080)
12090 !! options
12091 comment
12092 subpage
12093 title=[[Subpage test]]
12094 !! wikitext
12095 Poked at a [[/subpage]] here...
12096 !! html/php
12097 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12098 !!end
12099
12100 !! test
12101 Edit comment with subpage link and link text (T16080)
12102 !! options
12103 comment
12104 subpage
12105 title=[[Subpage test]]
12106 !! wikitext
12107 Poked at a [[/subpage|neat little page]] here...
12108 !! html/php
12109 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12110 !!end
12111
12112 !! test
12113 Edit comment with bogus subpage link in non-subpage NS (T16080)
12114 !! options
12115 comment
12116 title=[[Subpage test]]
12117 !! wikitext
12118 Poked at a [[/subpage]] here...
12119 !! html/php
12120 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...
12121 !!end
12122
12123 !! test
12124 Edit comment with bare anchor link (local, as on diff)
12125 !! options
12126 comment
12127 local
12128 title=[[Main Page]]
12129 !! wikitext
12130 [[#section]]
12131 !! html/php
12132 <a href="#section">#section</a>
12133 !! end
12134
12135 !! test
12136 Edit comment with bare anchor link (non-local, as on history)
12137 !! options
12138 comment
12139 title=[[Main Page]]
12140 !! wikitext
12141 [[#section]]
12142 !! html/php
12143 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12144 !! end
12145
12146 !! test
12147 Anchor starting with underscore
12148 !! options
12149 title=[[Foo]]
12150 !! wikitext
12151 [[#_ref|One]]
12152 !! html/php
12153 <p><a href="#_ref">One</a>
12154 </p>
12155 !! html/parsoid
12156 <p><a rel="mw:WikiLink" href="./Foo#_ref" class="mw-selflink-fragment" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
12157 !! end
12158
12159 !! test
12160 Id starting with underscore
12161 !! wikitext
12162 <div id="_ref"></div>
12163 !! html/*
12164 <div id="&#95;ref"></div>
12165 !! end
12166
12167 !! test
12168 Edit comment with link with more than one pipe (T99346)
12169 !! options
12170 comment
12171 !! wikitext
12172 [[Main Page|Many|pipes]]
12173 !! html/php
12174 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
12175 !! end
12176
12177 !! test
12178 Complex edit comment with link with more than one pipe (T99346)
12179 !! options
12180 comment
12181 !! wikitext
12182 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
12183 !! html/php
12184 Created page with &quot;&lt;noinclude&gt;<a href="/index.php?title=Category:Requests_for_permissions/Bot&amp;action=edit&amp;redlink=1" class="new" title="Category:Requests for permissions/Bot (page does not exist)">{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}</a>&lt;/noinclude&gt; === <a href="/index.php?title=User:MineoBot&amp;action=edit&amp;redlink=1" class="new" title="User:MineoBot (page does not exist)">User:MineoBot</a> 8=== {{Request for permissions/links|Mineo...&quot;
12185 !! end
12186
12187 !! test
12188 Space normalisation on autocomment (T24784)
12189 !! options
12190 comment
12191 title=[[Main Page]]
12192 !! wikitext
12193 /* __hello__world__ */
12194 !! html/php
12195 <span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→<bdi dir="ltr">__hello__world__</bdi></a></span>
12196 !! end
12197
12198 !! test
12199 percent-encoding and + signs in comments (T28410)
12200 !! options
12201 comment
12202 !! wikitext
12203 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12204 !! html/php
12205 <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>
12206 !! end
12207
12208 !! test
12209 Verify that displaytitle works (T24501) no displaytitle
12210 !! options
12211 showtitle
12212 !! config
12213 wgAllowDisplayTitle=true
12214 wgRestrictDisplayTitle=false
12215 !! wikitext
12216 this is not the title
12217 !! metadata
12218 <span class="mw-page-title-main">Parser test</span>
12219 !! html
12220 <p>this is not the title
12221 </p>
12222 !! end
12223
12224 !! test
12225 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
12226 !! options
12227 showtitle
12228 title=[[Screen]]
12229 !! config
12230 wgAllowDisplayTitle=true
12231 wgRestrictDisplayTitle=false
12232 !! wikitext
12233 this is not the title
12234 {{DISPLAYTITLE:whatever}}
12235 !! metadata
12236 whatever
12237 !! html/php
12238 <p>this is not the title
12239 </p>
12240 !! html/parsoid+integrated
12241 <p>this is not the title</p>
12242 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:whatever","function":"displaytitle"},"params":{},"i":0}}]}'></span>
12243 !! end
12244
12245 !! test
12246 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
12247 !! options
12248 showtitle
12249 title=[[Screen]]
12250 !! config
12251 wgAllowDisplayTitle=true
12252 wgRestrictDisplayTitle=true
12253 !! wikitext
12254 this is not the title
12255 {{DISPLAYTITLE:whatever}}
12256 !! metadata
12257 <span class="mw-page-title-main">Screen</span>
12258 !! html/php
12259 <p>this is not the title
12260 </p>
12261 !! html/parsoid+integrated
12262 <p>this is not the title</p>
12263 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:whatever","function":"displaytitle"},"params":{},"i":0}}]}'></span>
12264 !! end
12265
12266 !! test
12267 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
12268 !! options
12269 showtitle
12270 title=[[Screen]]
12271 !! config
12272 wgAllowDisplayTitle=true
12273 wgRestrictDisplayTitle=true
12274 !! wikitext
12275 this is not the title
12276 {{DISPLAYTITLE:screen}}
12277 !! metadata
12278 screen
12279 !! html/php
12280 <p>this is not the title
12281 </p>
12282 !! html/parsoid+integrated
12283 <p>this is not the title</p>
12284 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:screen","function":"displaytitle"},"params":{},"i":0}}]}'></span>
12285 !! end
12286
12287 !! test
12288 Verify that displaytitle works (T24501) AllowDisplayTitle=false
12289 !! options
12290 showtitle
12291 title=[[Screen]]
12292 !! config
12293 wgAllowDisplayTitle=false
12294 !! wikitext
12295 this is not the title
12296 {{DISPLAYTITLE:screen}}
12297 !! metadata
12298 <span class="mw-page-title-main">Screen</span>
12299 !! html/php
12300 <p>this is not the title
12301 <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>
12302 </p>
12303 !! html/parsoid+integrated
12304 <p>this is not the title <a rel="mw:WikiLink" href="./Template:DISPLAYTITLE:screen?action=edit&amp;redlink=1" title="Template:DISPLAYTITLE:screen" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:screen","href":"./Template:DISPLAYTITLE:screen"},"params":{},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Template:DISPLAYTITLE:screen"]}}'>Template:DISPLAYTITLE:screen</a></p>
12305 !! end
12306
12307 !! test
12308 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
12309 !! options
12310 showtitle
12311 title=[[Screen]]
12312 !! config
12313 wgAllowDisplayTitle=false
12314 !! wikitext
12315 this is not the title
12316 !! metadata
12317 <span class="mw-page-title-main">Screen</span>
12318 !! html/php
12319 <p>this is not the title
12320 </p>
12321 !! html/parsoid+integrated
12322 <p>this is not the title</p>
12323 !! end
12324
12325 !! test
12326 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
12327 !! options
12328 showtitle
12329 title=[[Screen]]
12330 !! config
12331 wgAllowDisplayTitle=true
12332 wgRestrictDisplayTitle=true
12333 !! wikitext
12334 this is not the title
12335 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
12336 !! metadata
12337 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
12338 !! html/php
12339 <p>this is not the title
12340 </p>
12341 !! html/parsoid+integrated
12342 <p>this is not the title</p>
12343 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:&lt;span style=\"display: none;\">s&lt;/span>creen","function":"displaytitle"},"params":{},"i":0}}]}'></span>
12344 !! end
12345
12346 !! test
12347 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
12348 !! options
12349 showtitle
12350 title=[[Screen]]
12351 !! config
12352 wgAllowDisplayTitle=true
12353 wgRestrictDisplayTitle=true
12354 !! wikitext
12355 this is not the title
12356 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
12357 !! metadata
12358 <span style="color: red;">s</span>creen
12359 !! html/php
12360 <p>this is not the title
12361 </p>
12362 !! html/parsoid+integrated
12363 <p>this is not the title</p>
12364 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:&lt;span style=\"color: red;\">s&lt;/span>creen","function":"displaytitle"},"params":{},"i":0}}]}'></span>
12365 !! end
12366
12367 !! test
12368 Verify that displaytitle encodes & to &amp; (T291985)
12369 !! options
12370 showtitle
12371 title=[[Art&copy]]
12372 !! config
12373 wgAllowDisplayTitle=true
12374 wgRestrictDisplayTitle=true
12375 !! wikitext
12376 this is not the title
12377 {{DISPLAYTITLE:art&copy}}
12378 !! metadata
12379 art&amp;copy
12380 !! html/php
12381 <p>this is not the title
12382 </p>
12383 !! html/parsoid+integrated
12384 <p>this is not the title</p>
12385 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:art&amp;copy","function":"displaytitle"},"params":{},"i":0}}]}'></span>
12386 !! end
12387
12388 !! test
12389 Verify that displaytitle encodes &amp; to &amp; (T291985)
12390 !! options
12391 showtitle
12392 title=[[Art&copy]]
12393 !! config
12394 wgAllowDisplayTitle=true
12395 wgRestrictDisplayTitle=true
12396 !! wikitext
12397 this is not the title
12398 {{DISPLAYTITLE:art&amp;copy}}
12399 !! metadata
12400 art&amp;copy
12401 !! html/php
12402 <p>this is not the title
12403 </p>
12404 !! html/parsoid+integrated
12405 <p>this is not the title</p>
12406 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:art&amp;amp;copy","function":"displaytitle"},"params":{},"i":0}}]}'></span>
12407 !! end
12408
12409 !! test
12410 Verify that without displaytitle the title encodes & to &amp; (T291985)
12411 !! options
12412 showtitle
12413 title=[[Art&copy]]
12414 !! config
12415 wgAllowDisplayTitle=true
12416 wgRestrictDisplayTitle=true
12417 !! wikitext
12418 this is not the title
12419 !! metadata
12420 <span class="mw-page-title-main">Art&amp;copy</span>
12421 !! html/php
12422 <p>this is not the title
12423 </p>
12424 !! html/parsoid+integrated
12425 <p>this is not the title</p>
12426 !! end
12427
12428 !! test
12429 preload: check <noinclude> and <includeonly>
12430 !! options
12431 preload
12432 !! wikitext
12433 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12434 !! html/php
12435 Hello kind world.
12436 !! end
12437
12438 !! test
12439 preload: check <onlyinclude>
12440 !! options
12441 preload
12442 !! wikitext
12443 Goodbye <onlyinclude>Hello world</onlyinclude>
12444 !! html/php
12445 Hello world
12446 !! end
12447
12448 !! test
12449 preload: can pass tags through if we want to
12450 !! options
12451 preload
12452 !! wikitext
12453 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12454 !! html/php
12455 <includeonly>Hello world</includeonly>
12456 !! end
12457
12458 !! test
12459 preload: check that it doesn't try to do tricks
12460 !! options
12461 preload
12462 !! wikitext
12463 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12464 !! html/php
12465 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12466 !! end
12467
12468 !! test
12469 Play a bit with r67090 and T5158
12470 !! wikitext
12471 <div style="width:50% !important">&nbsp;</div>
12472 <div style="width:50%&nbsp;!important">&nbsp;</div>
12473 <div style="width:50%&#160;!important">&nbsp;</div>
12474 <div style="border : solid;">&nbsp;</div>
12475 !! html/php
12476 <div style="width:50% !important">&#160;</div>
12477 <div style="width:50%&#160;!important">&#160;</div>
12478 <div style="width:50%&#160;!important">&#160;</div>
12479 <div style="border : solid;">&#160;</div>
12480 !! html/parsoid
12481 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
12482 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;nbsp;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
12483 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;#160;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
12484 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
12485 !! end
12486
12487 !! test
12488 French spaces in wikitext
12489 !! wikitext
12490 foo ! bar ? bat 50 % is less than 75 %.
12491
12492 Hello : this ; is « something ‹ else › again »
12493 !! html/php
12494 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
12495 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
12496 </p>
12497 !! html/parsoid
12498 <p>foo<span typeof="mw:DisplaySpace"> </span>! bar<span typeof="mw:DisplaySpace"> </span>? bat 50<span typeof="mw:DisplaySpace"> </span>% is less than 75<span typeof="mw:DisplaySpace"> </span>%.</p>
12499
12500 <p>Hello<span typeof="mw:DisplaySpace"> </span>: this<span typeof="mw:DisplaySpace"> </span>; is «<span typeof="mw:DisplaySpace"> </span>something ‹<span typeof="mw:DisplaySpace"> </span>else<span typeof="mw:DisplaySpace"> </span>› again<span typeof="mw:DisplaySpace"> </span>»</p>
12501 !! end
12502
12503 !! test
12504 Corner case: french spaces in definition list
12505 !! options
12506 parsoid=wt2html,html2html
12507 !! wikitext
12508 ;foo : bar
12509 !! html
12510 <dl><dt>foo</dt>
12511 <dd>bar</dd></dl>
12512 !! end
12513
12514 !! test
12515 T5158: Test for French spaces in attributes
12516 !! wikitext
12517 <br style=" clear : both ; " />
12518 !! html/php
12519 <p><br style="clear : both ;" />
12520 </p>
12521 !! end
12522
12523 # This test relies on the fact that image captions are processed
12524 # as independent document fragments.
12525 !! test
12526 Displayspace processing on embedded fragments
12527 !! options
12528 parsoid=wt2html
12529 !! wikitext
12530 [[File:Foobar.jpg|« test »]]
12531 !! html/parsoid
12532 <p><span class="mw-default-size" typeof="mw:File" data-parsoid='{"optList":[{"ck":"caption","ak":"« test »"}]}' data-mw='{"caption":"«&lt;span typeof=\"mw:DisplaySpace\" data-parsoid=&apos;{\"dsr\":[null,null,null,null]}&apos;> &lt;/span>test&lt;span typeof=\"mw:DisplaySpace\" data-parsoid=&apos;{\"dsr\":[null,null,null,null]}&apos;> &lt;/span>»"}'><a href="./File:Foobar.jpg" class="mw-file-description" title="« test »" data-parsoid="{}"><img alt="« test »" resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12533 !! end
12534
12535 !! test
12536 HTML5 data attributes
12537 !! wikitext
12538 <span data-foo="bar">Baz</span>
12539 <p data-abc-def_hij="">Quuz</p>
12540 !! html/php
12541 <p><span data-foo="bar">Baz</span>
12542 </p>
12543 <p>Quuz</p>
12544 !! html/parsoid
12545 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
12546 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
12547 !! end
12548
12549 !! test
12550 Strip reserved data attributes
12551 !! wikitext
12552 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-object-id="123" data-ooui="xyzzy" data-bad:ns="ns">d</div>
12553 !! html/php
12554 <div data-ok="fred" data-object-id="123">d</div>
12555 !! html/parsoid
12556 <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-x-data-object-id="123" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
12557 !! end
12558
12559 !! test
12560 percent-encoding and + signs in internal links (T28410)
12561 !! config
12562 wgParserEnableLegacyMediaDOM=false
12563 !! wikitext
12564 [[User:+%]] [[Page+title%]]
12565 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12566 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
12567 [[%33%45]] [[%33%45+]]
12568 !! html/php
12569 <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>
12570 <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>
12571 <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> <span class="mw-default-size" typeof="mw:Error mw:File"><a href="/index.php?title=Special:Upload&amp;wpDestFile=%25%2Babc9" class="new" title="File:%+abc9"><span class="mw-file-element mw-broken-media">bar</span></a></span>
12572 <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>
12573 </p>
12574 !! html/parsoid
12575 <p><a rel="mw:WikiLink" href="./User:+%25?action=edit&amp;redlink=1" title="User:+%" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./User:+%25"},"sa":{"href":"User:+%"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["User:+%"]}}'>User:+%</a> <a rel="mw:WikiLink" href="./Page+title%25?action=edit&amp;redlink=1" title="Page+title%" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Page+title%25"},"sa":{"href":"Page+title%"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Page+title%"]}}'>Page+title%</a>
12576 <a rel="mw:WikiLink" href="./%25+?action=edit&amp;redlink=1" title="%+" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["%+"]}}'>%+</a> <a rel="mw:WikiLink" href="./%25+?action=edit&amp;redlink=1" title="%+" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"piped","a":{"href":"./%25+"},"sa":{"href":"%+"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["%+"]}}'>%20</a> <a rel="mw:WikiLink" href="./%25+?action=edit&amp;redlink=1" title="%+" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+ "}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["%+"]}}'>%+ </a> <a rel="mw:WikiLink" href="./%25+r?action=edit&amp;redlink=1" title="%+r" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./%25+r"},"sa":{"href":"%+r"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["%+r"]}}'>%+r</a>
12577 <a rel="mw:WikiLink" href="./%25?action=edit&amp;redlink=1" title="%" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["%"]}}'>%</a> <a rel="mw:WikiLink" href="./+?action=edit&amp;redlink=1" title="+" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["+"]}}'>+</a> <span class="mw-default-size" typeof="mw:Error mw:File" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&apos;>bar&lt;/a>","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/%25+abc9"><span class="mw-file-element mw-broken-media" resource="./File:%25+abc9" data-parsoid='{"a":{"resource":"./File:%25+abc9"},"sa":{"resource":"File:%+abc%39"}}'>bar</span></a></span>
12578 <a rel="mw:WikiLink" href="./3E?action=edit&amp;redlink=1" title="3E" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./3E"},"sa":{"href":"%33%45"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["3E"]}}'>3E</a> <a rel="mw:WikiLink" href="./3E+?action=edit&amp;redlink=1" title="3E+" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./3E+"},"sa":{"href":"%33%45+"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["3E+"]}}'>3E+</a></p>
12579 !! end
12580
12581 !! test
12582 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12583 !! wikitext
12584 Text&apos;s been normalized?
12585 !! html
12586 <p>Text&#39;s been normalized?
12587 </p>
12588 !! end
12589
12590 !! test
12591 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12592 !! wikitext
12593 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12594 !! html
12595 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12596 </p>
12597 !! end
12598
12599 !! test
12600 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12601 !! wikitext
12602 [http://www.example.org/ ideograms]
12603 !! html
12604 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12605 </p>
12606 !! end
12607
12608 !! test
12609 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12610 !! wikitext
12611 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12612 !! html
12613 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12614 </p>
12615 !! end
12616
12617 !! article
12618 MediaWiki:loop1
12619 !! text
12620 {{Identical|A}}
12621 !! endarticle
12622
12623 !! article
12624 MediaWiki:loop2
12625 !! text
12626 {{Identical|B}}
12627 !! endarticle
12628
12629 !! article
12630 Template:Identical
12631 !! text
12632 {{int:loop1}}
12633 {{int:loop2}}
12634 !! endarticle
12635
12636 !! test
12637 T33098 Template which includes system messages which includes the template
12638 !! wikitext
12639 {{Identical}}
12640 !! html/php
12641 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12642 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12643 </p>
12644 !! html/parsoid+integrated
12645 <p><span class="error" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"Identical","href":"./Template:Identical"},"params":{},"i":0}}]}'>Template loop detected: <a rel="mw:WikiLink" href="./Template:Identical" title="Template:Identical">Template:Identical</a></span><span about="#mwt1">
12646 </span><span class="error" about="#mwt1" data-parsoid='{"stx":"html"}'>Template loop detected: <a rel="mw:WikiLink" href="./Template:Identical" title="Template:Identical">Template:Identical</a></span></p>
12647 !! end
12648
12649 !! test
12650 T33490 Turkish: ucfirst 'blah'
12651 !! options
12652 language=tr
12653 !! wikitext
12654 {{ucfirst:blah}}
12655 !! html
12656 <p>Blah
12657 </p>
12658 !! end
12659
12660 !! test
12661 T33490 Turkish: ucfirst 'ix'
12662 !! options
12663 language=tr
12664 !! wikitext
12665 {{ucfirst:ix}}
12666 !! html
12667 <p>İx
12668 </p>
12669 !! end
12670
12671 !! test
12672 T33490 Turkish: lcfirst 'BLAH'
12673 !! options
12674 language=tr
12675 !! wikitext
12676 {{lcfirst:BLAH}}
12677 !! html
12678 <p>bLAH
12679 </p>
12680 !! end
12681
12682 !! test
12683 T33490 Turkish: ucfırst (with a dotless i)
12684 !! options
12685 language=tr
12686 !! wikitext
12687 {{ucfırst:blah}}
12688 !! html/php
12689 <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>
12690 </p>
12691 !! html/parsoid
12692 <p><a rel="mw:WikiLink" href="./Şablon:Ucfırst:blah?action=edit&amp;redlink=1" title="Şablon:Ucfırst:blah" about="#mwt1" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./Şablon:Ucfırst:blah"},"sa":{"href":"Şablon:Ucfırst:blah"},"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"ucfırst:blah","href":"./Şablon:Ucfırst:blah"},"params":{},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Şablon:Ucfırst:blah"]}}'>Şablon:Ucfırst:blah</a></p>
12693 !! end
12694
12695 !! test
12696 T33490 ucfırst (with a dotless i) with English language
12697 !! options
12698 language=en
12699 !! wikitext
12700 {{ucfırst:blah}}
12701 !! html/php
12702 <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>
12703 </p>
12704 !! html/parsoid
12705 <p><a rel="mw:WikiLink" href="./Template:Ucfırst:blah?action=edit&amp;redlink=1" title="Template:Ucfırst:blah" about="#mwt1" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./Template:Ucfırst:blah"},"sa":{"href":"Template:Ucfırst:blah"},"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"ucfırst:blah","href":"./Template:Ucfırst:blah"},"params":{},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Template:Ucfırst:blah"]}}'>Template:Ucfırst:blah</a></p>
12706 !! end
12707
12708 !! article
12709 MediaWiki:T34057
12710 !! text
12711 == {{int:ok}} ==
12712 !! endarticle
12713
12714 !! test
12715 T34057: Title needed when expanding <h> nodes.
12716 !! options
12717 title=[[Main Page]]
12718 !! config
12719 wgParserEnableLegacyHeadingDOM=false
12720 !! wikitext
12721 {{int:T34057}}
12722 !! html/php
12723 <div class="mw-heading mw-heading2"><h2 id="OK">OK</h2><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: OK">edit</a><span class="mw-editsection-bracket">]</span></span></div>
12724 !! html/parsoid+integrated
12725 <h2 about="#mwt1" typeof="mw:Transclusion" id="OK" data-mw='{"parts":[{"template":{"target":{"wt":"int:T34057","function":"int"},"params":{},"i":0}}]}'>OK</h2>
12726 !! end
12727
12728 !! test
12729 Title needed when expanding templates.
12730 !! options
12731 title=[[Main Page]]
12732 !! wikitext
12733 {{Template with pagename}}
12734 !! html/php
12735 <p>This is Main Page.
12736 </p>
12737 !! html/parsoid
12738 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Template with pagename","href":"./Template:Template_with_pagename"},"params":{},"i":0}}]}'>This is Main Page.</span></p>
12739 !! end
12740
12741 !! test
12742 Strip marker in urlencode
12743 !! wikitext
12744 {{urlencode:x<nowiki/>y}}
12745 {{urlencode:x<nowiki/>y|wiki}}
12746 {{urlencode:x<nowiki/>y|path}}
12747 {{urlencode:x<pre id="one">two</pre>y}}
12748 !! html/php
12749 <p>xy
12750 xy
12751 xy
12752 xy
12753 </p>
12754 !! end
12755
12756 !! test
12757 Strip marker in lc
12758 !! wikitext
12759 {{lc:x<nowiki/>y}}
12760 !! html/php
12761 <p>xy
12762 </p>
12763 !! html/parsoid+integrated
12764 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"lc:x&lt;nowiki/>y","function":"lc"},"params":{},"i":0}}]}'>x</span><span>y</span></p>
12765 !! end
12766
12767 !! test
12768 Strip marker in uc
12769 !! wikitext
12770 {{uc:x<nowiki/>y}}
12771 !! html/php
12772 <p>XY
12773 </p>
12774 !! html/parsoid+integrated
12775 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"uc:x&lt;nowiki/>y","function":"uc"},"params":{},"i":0}}]}'>X</span><span>Y</span></p>
12776 !! end
12777
12778 !! test
12779 Strip marker in formatNum
12780 !! wikitext
12781 {{formatnum:1<nowiki/>2}}
12782 {{formatnum:1<nowiki/>2|R}}
12783 !! html/php
12784 <p>12
12785 12
12786 </p>
12787 !! html/parsoid
12788 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"formatnum:1&lt;nowiki/>2","function":"formatnum"},"params":{},"i":0}}]}'>1</span><span about="#mwt1">2</span> <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"formatnum:1&lt;nowiki/>2","function":"formatnum"},"params":{"1":{"wt":"R"}},"i":0}}]}'>1</span><span about="#mwt2">2</span></p>
12789 !! end
12790
12791 !! test
12792 Check noCommafy in formatNum
12793 !! options
12794 language=be-tarask
12795 !! wikitext
12796 {{formatnum:123456.78}}
12797 {{formatnum:123456.78|NOSEP}}
12798 !! html/php
12799 <p>123&#160;456,78
12800 123456.78
12801 </p>
12802 !! html/parsoid+integrated
12803 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"formatnum:123456.78","function":"formatnum"},"params":{},"i":0}}]}'>123 456,78</span>
12804 <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"formatnum:123456.78","function":"formatnum"},"params":{"1":{"wt":"NOSEP"}},"i":0}}]}'>123456.78</span></p>
12805 !! end
12806
12807 !! test
12808 Wrong option for formatNum (T58199)
12809 !! wikitext
12810 {{formatnum:1,234.56|Random}}
12811 {{formatnum:1,234.56|EVERYTHING}}
12812 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
12813 !! html/php
12814 <p>1,234.56
12815 1,234.56
12816 1,234.56
12817 </p>
12818 !! html/parsoid+integrated
12819 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"formatnum:1,234.56","function":"formatnum"},"params":{"1":{"wt":"Random"}},"i":0}}]}'>1,234.56</span>
12820 <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"formatnum:1,234.56","function":"formatnum"},"params":{"1":{"wt":"EVERYTHING"}},"i":0}}]}'>1,234.56</span>
12821 <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"formatnum:1234.56","function":"formatnum"},"params":{"1":{"wt":"any argument that has the string &apos;NOSEP&apos;"}},"i":0}}]}'>1,234.56</span></p>
12822 !! end
12823
12824 !! test
12825 Strip marker in grammar
12826 !! options
12827 language=fi
12828 !! wikitext
12829 {{grammar:elative|foo<nowiki/>bar}}
12830 !! html/php
12831 <p>foobarista
12832 </p>
12833 !! html/parsoid+integrated
12834 <p><span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"grammar:elative","function":"grammar"},"params":{"1":{"wt":"foo&lt;nowiki/>bar"}},"i":0}}]}'>foobarista</span></p>
12835 !! end
12836
12837 !! test
12838 Strip marker in padleft
12839 !! wikitext
12840 {{padleft:|2|x<nowiki/>y}}
12841 !! html
12842 <p>xy
12843 </p>
12844 !! end
12845
12846 !! test
12847 Strip marker in padright
12848 !! wikitext
12849 {{padright:|2|x<nowiki/>y}}
12850 !! html
12851 <p>xy
12852 </p>
12853 !! end
12854
12855 !! test
12856 Strip marker in anchorencode
12857 !! wikitext
12858 {{anchorencode:x<nowiki/>y}}
12859 !! html/php
12860 <p>xy
12861 </p>
12862 !! html/parsoid
12863 <p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:x&lt;nowiki/>y","function":"anchorencode"},"params":{},"i":0}}]}'>xy</span></p>
12864 !! end
12865
12866 !! test
12867 new support for bdi element (T33817)
12868 !! wikitext
12869 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12870 !! html
12871 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12872 !! end
12873
12874 !! test
12875 Ignore pipe between table row attributes
12876 !! wikitext
12877 {|
12878 |quux
12879 |- id=foo | style='color: red'
12880 |bar
12881 |}
12882 !! html
12883 <table>
12884 <tbody><tr>
12885 <td>quux
12886 </td></tr>
12887 <tr id="foo" style="color: red">
12888 <td>bar
12889 </td></tr></tbody></table>
12890 !! end
12891
12892 !! test
12893 Language parser function (autonym)
12894 !! wikitext
12895 {{#language:ar}}
12896 !! html/php
12897 <p>العربية
12898 </p>
12899 !! html/parsoid+integrated
12900 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#language:ar","function":"language"},"params":{},"i":0}}]}'>العربية</span></p>
12901 !! end
12902
12903 !! test
12904 Language parser function (case-insensitive)
12905 !! wikitext
12906 {{#language:AR}}
12907 !! html/php
12908 <p>العربية
12909 </p>
12910 !! html/parsoid+integrated
12911 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#language:AR","function":"language"},"params":{},"i":0}}]}'>العربية</span></p>
12912 !! end
12913
12914 !! test
12915 Language parser function (non-autonym)
12916 !! wikitext
12917 {{#language:aR|En}}
12918 !! html/php
12919 <p>Arabic
12920 </p>
12921 !! html/parsoid+integrated
12922 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#language:aR","function":"language"},"params":{"1":{"wt":"En"}},"i":0}}]}'>Arabic</span></p>
12923 !! end
12924
12925 !! test
12926 Language parser function (bcp-47 codes)
12927 !! wikitext
12928 {{#language:de-x-formal|en-simple}}
12929 !! html/php
12930 <p>German (formal address)
12931 </p>
12932 !! html/parsoid+integrated
12933 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#language:de-x-formal","function":"language"},"params":{"1":{"wt":"en-simple"}},"i":0}}]}'>German (formal address)</span></p>
12934 !! end
12935
12936 !! test
12937 Language parser function (target language)
12938 !! options
12939 language=ar
12940 !! wikitext
12941 {{#language}} / {{#language:}}
12942 !! html/php
12943 <p>العربية / العربية
12944 </p>
12945 !! html/parsoid+integrated
12946 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#language","function":"language"},"params":{},"i":0}}]}'>العربية</span> / <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#language:","function":"language"},"params":{},"i":0}}]}'>العربية</span></p>
12947 !! end
12948
12949 !! test
12950 Language parser function (target language, non-autonym)
12951 !! options
12952 language=ar
12953 !! wikitext
12954 {{#language:|en}}
12955 !! html/php
12956 <p>Arabic
12957 </p>
12958 !! html/parsoid+integrated
12959 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#language:","function":"language"},"params":{"1":{"wt":"en"}},"i":0}}]}'>Arabic</span></p>
12960 !! end
12961
12962 !! test
12963 Dir parser function (valid codes)
12964 !! wikitext
12965 Persian: {{#dir:fa}}
12966
12967 English: {{#dir:en}}
12968
12969 Persian (with space): {{#dir: fa}}
12970
12971 Tajik: {{#dir:tg}}
12972
12973 The string 'egl' is a valid internal code; however when used as a
12974 BCP-47 code it refers to the internal code 'eml'. Unfortunately,
12975 both of these have ltr directionality which makes this test case
12976 less useful than it could be.
12977
12978 Ambiguous BCP-47 code:
12979 ;Directionality of internal code 'egl':{{#dir:egl}}
12980 ;Directionality of internal code 'eml':{{#dir:egl|bcp47}} == {{#dir:eml}}
12981 !! html/php
12982 <p>Persian: rtl
12983 </p><p>English: ltr
12984 </p><p>Persian (with space): rtl
12985 </p><p>Tajik: ltr
12986 </p><p>The string 'egl' is a valid internal code; however when used as a
12987 BCP-47 code it refers to the internal code 'eml'. Unfortunately,
12988 both of these have ltr directionality which makes this test case
12989 less useful than it could be.
12990 </p><p>Ambiguous BCP-47 code:
12991 </p>
12992 <dl><dt>Directionality of internal code 'egl'</dt>
12993 <dd>ltr</dd>
12994 <dt>Directionality of internal code 'eml'</dt>
12995 <dd>ltr == ltr</dd></dl>
12996 !! html/parsoid+integrated
12997 <p>Persian: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:fa","function":"dir"},"params":{},"i":0}}]}'>rtl</span></p>
12998 <p>English: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:en","function":"dir"},"params":{},"i":0}}]}'>ltr</span></p>
12999 <p>Persian (with space): <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir: fa","function":"dir"},"params":{},"i":0}}]}'>rtl</span></p>
13000 <p>Tajik: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:tg","function":"dir"},"params":{},"i":0}}]}'>ltr</span></p>
13001 <p>The string 'egl' is a valid internal code; however when used as a BCP-47 code it refers to the internal code 'eml'. Unfortunately, both of these have ltr directionality which makes this test case less useful than it could be.</p>
13002 <p>Ambiguous BCP-47 code:</p>
13003 <dl>
13004 <dt>Directionality of internal code 'egl'</dt>
13005 <dd><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:egl","function":"dir"},"params":{},"i":0}}]}'>ltr</span></dd>
13006 <dt>Directionality of internal code 'eml'</dt>
13007 <dd><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:egl","function":"dir"},"params":{"1":{"wt":"bcp47"}},"i":0}}]}'>ltr</span> == <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:eml","function":"dir"},"params":{},"i":0}}]}'>ltr</span></dd>
13008 </dl>
13009 !! end
13010
13011 !! test
13012 Dir parser function (target language)
13013 !! options
13014 language=fa
13015 cat
13016 !! metadata
13017 !! wikitext
13018 These are all equivalent:
13019
13020 {{#dir}} / {{#dir:}} / {{#dir:{{PAGELANGUAGE}}}}
13021 !! html/php
13022 <p>These are all equivalent:
13023 </p><p>rtl / rtl / rtl
13024 </p>
13025 !! html/parsoid+integrated
13026 <p>These are all equivalent:</p>
13027 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir","function":"dir"},"params":{},"i":0}}]}'>rtl</span> / <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:","function":"dir"},"params":{},"i":0}}]}'>rtl</span> / <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:{{PAGELANGUAGE}}","function":"dir"},"params":{},"i":0}}]}'>rtl</span></p>
13028 !! end
13029
13030 !! test
13031 Dir parser function (invalid code)
13032 !! options
13033 cat
13034 !! wikitext
13035 {{#dir:blah<blah}}
13036 !! metadata
13037 cat=Pages_with_invalid_language_codes sort=
13038 !! html/php
13039 <p>ltr
13040 </p>
13041 !! html/parsoid+integrated
13042 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:blah&lt;blah","function":"dir"},"params":{},"i":0}}]}'>ltr</span></p>
13043 !! end
13044
13045 !! test
13046 Bcp47 parser function (valid codes)
13047 !! wikitext
13048 Serbian: {{#bcp47:sr-ec}}
13049
13050 Cantonese: {{#bcp47:zh-yue}}
13051
13052 Formal German (with space): {{#bcp47: de-formal}}
13053
13054 Simple English: {{#bcp47:simple}}
13055
13056 The string 'egl' is a valid internal code, distinct from the
13057 internal code 'eml'; however both map to the BCP-47 code 'egl'.
13058
13059 Ambiguous BCP-47 code:
13060 ;Internal code 'eml':{{#bcp47:eml}} == egl
13061 ;Internal code 'egl':{{#bcp47:egl}} == egl
13062 !! html/php
13063 <p>Serbian: sr-Cyrl
13064 </p><p>Cantonese: yue
13065 </p><p>Formal German (with space): de-x-formal
13066 </p><p>Simple English: en-simple
13067 </p><p>The string 'egl' is a valid internal code, distinct from the
13068 internal code 'eml'; however both map to the BCP-47 code 'egl'.
13069 </p><p>Ambiguous BCP-47 code:
13070 </p>
13071 <dl><dt>Internal code 'eml'</dt>
13072 <dd>egl == egl</dd>
13073 <dt>Internal code 'egl'</dt>
13074 <dd>egl == egl</dd></dl>
13075 !! html/parsoid+integrated
13076 <p>Serbian: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:sr-ec","function":"bcp47"},"params":{},"i":0}}]}'>sr-Cyrl</span></p>
13077 <p>Cantonese: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:zh-yue","function":"bcp47"},"params":{},"i":0}}]}'>yue</span></p>
13078 <p>Formal German (with space): <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47: de-formal","function":"bcp47"},"params":{},"i":0}}]}'>de-x-formal</span></p>
13079 <p>Simple English: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:simple","function":"bcp47"},"params":{},"i":0}}]}'>en-simple</span></p>
13080 <p>The string 'egl' is a valid internal code, distinct from the internal code 'eml'; however both map to the BCP-47 code 'egl'.</p>
13081 <p>Ambiguous BCP-47 code:</p>
13082 <dl>
13083 <dt>Internal code 'eml'</dt>
13084 <dd><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:eml","function":"bcp47"},"params":{},"i":0}}]}'>egl</span> == egl</dd>
13085 <dt>Internal code 'egl'</dt>
13086 <dd><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:egl","function":"bcp47"},"params":{},"i":0}}]}'>egl</span> == egl</dd>
13087 </dl>
13088 !! end
13089
13090 !! test
13091 Bcp47 parser function (target language)
13092 !! options
13093 language=sr-ec
13094 !! wikitext
13095 These are all equivalent:
13096
13097 {{#bcp47}} / {{#bcp47:}} / {{#bcp47:{{PAGELANGUAGE}}}}
13098 !! html/php
13099 <p>These are all equivalent:
13100 </p><p>sr-Cyrl / sr-Cyrl / sr-Cyrl
13101 </p>
13102 !! html/parsoid+integrated
13103 <p>These are all equivalent:</p>
13104 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47","function":"bcp47"},"params":{},"i":0}}]}'>sr-Cyrl</span> / <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:","function":"bcp47"},"params":{},"i":0}}]}'>sr-Cyrl</span> / <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:{{PAGELANGUAGE}}","function":"bcp47"},"params":{},"i":0}}]}'>sr-Cyrl</span></p>
13105 !! end
13106
13107 # from https://commons.wikimedia.org/w/index.php?title=Template:BCP47&oldid=597081406
13108 !! test
13109 Bcp47 parser function (examples from Template:BCP47)
13110 !! wikitext
13111 Unaffected codes, for example:
13112 *{{#bcp47:en}} returns: "en"
13113 Changes required by BCP47, using standard codes:
13114 *{{#bcp47:als}} returns: "gsw"
13115 *{{#bcp47:fiu-vro}} returns: "vro"
13116 *{{#bcp47:simple}} returns: "en"
13117 *{{#bcp47:zh-classical}} returns: "lzh"
13118 *{{#bcp47:roa-rup}} returns: "rup"
13119 Changes required by BCP47, currently using private-use extensions:
13120 *{{#bcp47:nrm}} returns: "nrf"
13121 *{{#bcp47:roa-tara}} returns: "it-x-tara"
13122 Changes preferable with BCP47 for improved interoperability (not really violations):
13123 *{{#bcp47:be-x-old}} returns: "be-tarask"
13124 !! html/php
13125 <p>Unaffected codes, for example:
13126 </p>
13127 <ul><li>en returns: "en"</li></ul>
13128 <p>Changes required by BCP47, using standard codes:
13129 </p>
13130 <ul><li>gsw returns: "gsw"</li>
13131 <li>vro returns: "vro"</li>
13132 <li>en-simple returns: "en"</li>
13133 <li>lzh returns: "lzh"</li>
13134 <li>rup returns: "rup"</li></ul>
13135 <p>Changes required by BCP47, currently using private-use extensions:
13136 </p>
13137 <ul><li>nrf returns: "nrf"</li>
13138 <li>nap-x-tara returns: "it-x-tara"</li></ul>
13139 <p>Changes preferable with BCP47 for improved interoperability (not really violations):
13140 </p>
13141 <ul><li>be-tarask returns: "be-tarask"</li></ul>
13142 !! html/parsoid+integrated
13143 <p>Unaffected codes, for example:</p>
13144 <ul>
13145 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:en","function":"bcp47"},"params":{},"i":0}}]}'>en</span> returns: "en"</li>
13146 </ul>
13147 <p>Changes required by BCP47, using standard codes:</p>
13148 <ul>
13149 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:als","function":"bcp47"},"params":{},"i":0}}]}'>gsw</span> returns: "gsw"</li>
13150 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:fiu-vro","function":"bcp47"},"params":{},"i":0}}]}'>vro</span> returns: "vro"</li>
13151 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:simple","function":"bcp47"},"params":{},"i":0}}]}'>en-simple</span> returns: "en"</li>
13152 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:zh-classical","function":"bcp47"},"params":{},"i":0}}]}'>lzh</span> returns: "lzh"</li>
13153 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:roa-rup","function":"bcp47"},"params":{},"i":0}}]}'>rup</span> returns: "rup"</li>
13154 </ul>
13155 <p>Changes required by BCP47, currently using private-use extensions:</p>
13156 <ul>
13157 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:nrm","function":"bcp47"},"params":{},"i":0}}]}'>nrf</span> returns: "nrf"</li>
13158 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:roa-tara","function":"bcp47"},"params":{},"i":0}}]}'>nap-x-tara</span> returns: "it-x-tara"</li>
13159 </ul>
13160 <p>Changes preferable with BCP47 for improved interoperability (not really violations):</p>
13161 <ul>
13162 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:be-x-old","function":"bcp47"},"params":{},"i":0}}]}'>be-tarask</span> returns: "be-tarask"</li>
13163 </ul>
13164 !! end
13165
13166 !!test
13167 Padleft and padright (default 0-padding)
13168 !! wikitext
13169 {{padleft:xyz|5}}
13170 {{padright:xyz|5}}
13171 !! html/php
13172 <p>00xyz
13173 xyz00
13174 </p>
13175 !! html/parsoid
13176 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
13177 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
13178 !! end
13179
13180 !!test
13181 Padleft and padright (partial fill)
13182 !! wikitext
13183 {{padleft:xyz|6|ab}}
13184 {{padright:xyz|6|ab}}
13185 !! html/php
13186 <p>abaxyz
13187 xyzaba
13188 </p>
13189 !! html/parsoid
13190 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"6"},"2":{"wt":"ab"}},"i":0}}]}'>abaxyz</span>
13191 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"6"},"2":{"wt":"ab"}},"i":0}}]}'>xyzaba</span></p>
13192 !! end
13193
13194 !!test
13195 Padleft and padright as substr
13196 !! wikitext
13197 {{padleft:|3|abcde}}
13198 {{padright:|3|abcde}}
13199 !! html/php
13200 <p>abc
13201 abc
13202 </p>
13203 !! html/parsoid
13204 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:","function":"padleft"},"params":{"1":{"wt":"3"},"2":{"wt":"abcde"}},"i":0}}]}'>abc</span>
13205 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:","function":"padright"},"params":{"1":{"wt":"3"},"2":{"wt":"abcde"}},"i":0}}]}'>abc</span></p>
13206 !! end
13207
13208 !! test
13209 Padleft and padright with non-numerical length (T180403)
13210 !! wikitext
13211 {{padleft:abcdef|junk}}
13212 {{padright:abcdef|junk}}
13213 !! html/php
13214 <p>abcdef
13215 abcdef
13216 </p>
13217 !! end
13218
13219 !!test
13220 Special parser function
13221 !! wikitext
13222 {{#special:RandomPage}}
13223 {{#special:BaDtItLe}}
13224 {{#special:Foobar}}
13225 !! html/php
13226 <p>Special:Random
13227 Special:Badtitle
13228 Special:Foobar
13229 </p>
13230 !! html/parsoid
13231 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#special:RandomPage","function":"special"},"params":{},"i":0}}]}'>Special:Random</span>
13232 <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#special:BaDtItLe","function":"special"},"params":{},"i":0}}]}'>Special:Badtitle</span>
13233 <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#special:Foobar","function":"special"},"params":{},"i":0}}]}'>Special:Foobar</span></p>
13234 !! end
13235
13236 # {{=}} will be converted to a parser function which expands to `=`
13237 # If you have it defined as a Template that expands to `=` that's ok;
13238 # and using it explicitly as {{Template:=}} (regardless of what it
13239 # expands to) is also ok and will not generate a tracking category.
13240 # T91154
13241 #
13242 # FIXME: Parsoid doesn't yet support this magic word natively, so standalone
13243 # mode will fail this test.
13244 !! test
13245 Using {{=}} when it expands to "=" should not create a tracking category
13246 !! wikitext
13247 This uses {{=}} and {{Template:=}}.
13248 !! html/php
13249 <p>This uses = and =.
13250 </p>
13251 !! html/parsoid
13252 <p>This uses <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"=","function":"="},"params":{},"i":0}}]}'>=</span> and <span typeof="mw:Nowiki mw:Transclusion" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"Template:=","href":"./Template:="},"params":{},"i":0}}]}'>=</span>.</p>
13253 !! end
13254
13255 # Repeat the test, looking at categories. Note: none should be emitted!
13256 !! test
13257 Using {{=}} when it expands to "=" should not create a tracking category (cat)
13258 !! options
13259 cat
13260 !! wikitext
13261 This uses {{=}} and {{Template:=}}.
13262 !! html/php
13263 <p>This uses = and =.
13264 </p>
13265 !! end
13266
13267 !!test
13268 T36939 - Case insensitive link parsing ([HttP://])
13269 !! wikitext
13270 [HttP://MediaWiki.Org/]
13271 !! html/php
13272 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13273 </p>
13274 !! html/parsoid
13275 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/" class="external autonumber"></a></p>
13276 !! end
13277
13278 !!test
13279 T36939 - Case insensitive link parsing ([HttP:// title])
13280 !! wikitext
13281 [HttP://MediaWiki.Org/ MediaWiki]
13282 !! html
13283 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13284 </p>
13285 !! end
13286
13287 !!test
13288 T36939 - Case insensitive link parsing (HttP://)
13289 !! wikitext
13290 HttP://MediaWiki.Org/
13291 !! html/php
13292 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13293 </p>
13294 !! html/parsoid
13295 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/" class="external free">HttP://MediaWiki.Org/</a></p>
13296 !! end
13297
13298
13299 ###
13300 ### Parsoid-specific tests
13301 ### Parsoid-PHP parser incompatibilities
13302 ###
13303 !!test
13304 1. SOL-sensitive wikitext tokens as template-args
13305 !! options
13306 parsoid=wt2html,wt2wt
13307 !! wikitext
13308 {{1x|*a}}
13309 {{1x|#a}}
13310 {{1x|:a}}
13311 !! html/php
13312 <ul><li>a</li></ul>
13313 <ol><li>a</li></ol>
13314 <dl><dd>a</dd></dl>
13315 !! html/parsoid
13316 <ul about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"*a"}},"i":0}}]}'><li>a</li></ul>
13317 <ol about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"#a"}},"i":0}}]}'><li>a</li></ol>
13318 <dl about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":":a"}},"i":0}}]}'><dd>a</dd></dl>
13319 !!end
13320
13321 #### -----------------------------------------------------------------
13322 #### Parsoid-specific functionality tests
13323 #### -----------------------------------------------------------------
13324
13325 ## Just a regression test
13326 !! test
13327 Wikilink with only closing tag in target
13328 !! options
13329 parsoid=wt2html
13330 !! wikitext
13331 [[Test|</span>]]
13332 !! html/parsoid
13333 <p><a rel="mw:WikiLink" href="./Test" title="Test" data-parsoid='{"stx":"piped","a":{"href":"./Test"},"sa":{"href":"Test"}}'></a></p>
13334 !! end
13335
13336 #### ----------------------------------------------------------------
13337 #### Parsoid-only testing of Parsoid's impl of LST
13338 #### Not implemented yet, see
13339 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
13340 #### ----------------------------------------------------------------
13341
13342 ## We still need to support serializing the older format while content is stored.
13343 !! test
13344 LST Sections: Backwards compatibility
13345 !! options
13346 parsoid={
13347 "suppressErrors": true,
13348 "modes": ["html2wt"]
13349 }
13350 !! wikitext
13351 <section begin="2011-05-16" />
13352 <section end="2014-04-10 (MW 1.23wmf22)" />
13353 !! html/parsoid
13354 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
13355 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
13356 !! end
13357
13358 !! test
13359 LST Sections: Newfangled approach
13360 !! wikitext
13361 <section begin="2011-05-16" />
13362 <section end="2014-04-10 (MW 1.23wmf22)" />
13363 !! html/parsoid
13364 <p><link typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}' />
13365 <link typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}' /></p>
13366 !! html/parsoid+integrated
13367 <p>&lt;section begin="2011-05-16" /> &lt;section end="2014-04-10 (MW 1.23wmf22)" /></p>
13368 !! end
13369
13370 !! test
13371 LST Sections: Fostering
13372 !! options
13373 parsoid=wt2html
13374 !! wikitext
13375 {|
13376 <section name="testing"/>
13377 | 123
13378 |}
13379 !! html/parsoid
13380 <link typeof="mw:Extension/section" about="#mwt2" data-parsoid='{"fostered":true}' data-mw='{"name":"section","attrs":{"name":"testing"}}'/><table>
13381
13382 <tbody><tr><td>123
13383 </td></tr></tbody></table>
13384 !! html/parsoid+integrated
13385 <p>&lt;section name="testing"/></p>
13386 <table>
13387 <tbody>
13388 <tr>
13389 <td>123</td>
13390 </tr>
13391 </tbody>
13392 </table>
13393 !! end
13394
13395 #--------- Test stripping of empty nodes in template content ----------
13396
13397 !! test
13398 Empty LI and TR nodes should be stripped from template content
13399 !! options
13400 parsoid=wt2html,wt2wt
13401 !! wikitext
13402 {{EmptyLITest}}
13403 {{EmptyTRTest}}
13404 !! html/parsoid
13405 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'><li>a</li>
13406
13407
13408 <li>b</li></ul>
13409 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
13410 <tbody>
13411 <tr>
13412 <td>foo</td></tr>
13413
13414 <tr>
13415 <td>bar</td></tr>
13416 </tbody></table>
13417 !! end
13418
13419 !! test
13420 Empty LI and TR nodes should not be stripped from top-level content
13421 !! wikitext
13422 *a
13423 *
13424 *b
13425
13426 {|
13427 |-
13428 |-
13429 |foo
13430 |}
13431 !! html/parsoid
13432 <ul>
13433 <li>a</li>
13434 <li class='mw-empty-elt'></li>
13435 <li>b</li>
13436 </ul>
13437 <table>
13438 <tbody>
13439 <tr class='mw-empty-elt'></tr>
13440 <tr>
13441 <td>foo</td>
13442 </tr>
13443 </tbody>
13444 </table>
13445 !! end
13446
13447 !! test
13448 Empty TR nodes should not be stripped if they have any attributes set
13449 !! wikitext
13450 {{EmptyTRWithHTMLAttrTest}}
13451 !! html/parsoid
13452 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
13453 <tr align='center'></tr>
13454 <tr><td>foo</td></tr>
13455 <tr align='center'></tr>
13456 <tr><td>bar</td></tr>
13457 </table>
13458 !! end
13459
13460 !! test
13461
13462 Tag-like HTML structures are passed through as text
13463 !! wikitext
13464 <x y>
13465
13466 <x.y>
13467
13468 <x-y>
13469
13470 1>2
13471
13472 x<y
13473
13474 a>b
13475
13476 1<d e>f
13477 !! html
13478 <p>&lt;x y&gt;
13479 </p><p>&lt;x.y&gt;
13480 </p><p>&lt;x-y&gt;
13481 </p><p>1&gt;2
13482 </p><p>x&lt;y
13483 </p><p>a&gt;b
13484 </p><p>1&lt;d e&gt;f
13485 </p>
13486 !! end
13487
13488 !! test
13489 HTML tag with necessary entities in attributes
13490 !! wikitext
13491 <span title="&amp;amp;">foo</span>
13492 !! html
13493 <p><span title="&amp;amp;">foo</span>
13494 </p>
13495 !! end
13496
13497 !! test
13498 HTML tag with 'unnecessary' entity encoding in attributes
13499 !! wikitext
13500 <span title="&amp;">foo</span>
13501 !! html
13502 <p><span title="&amp;">foo</span>
13503 </p>
13504 !! end
13505
13506 !! test
13507 HTML tag with broken attribute value quoting
13508 !! options
13509 parsoid=wt2html,html2html
13510 !! wikitext
13511 <span title="Hello world>Foo</span>
13512 !! html/php
13513 <p><span title="Hello world">Foo</span>
13514 </p>
13515 !! html/parsoid
13516 <p><span title="Hello world">Foo</span></p>
13517 !! end
13518
13519 !! test
13520 Self-closed tag with broken attribute value quoting
13521 !! options
13522 parsoid=wt2html,html2html
13523 !! wikitext
13524 <div title="Hello world />Foo
13525 !! html
13526 <div title="Hello world">Foo</div>
13527 !! end
13528
13529 !! test
13530 Table with broken attribute value quoting
13531 !! options
13532 parsoid=wt2html,html2html
13533 !! wikitext
13534 {|
13535 | title="Hello world|Foo
13536 |}
13537 !! html/php
13538 <table>
13539 <tbody><tr>
13540 <td title="Hello world">Foo
13541 </td></tr></tbody></table>
13542 !! html/parsoid
13543 <table>
13544 <tr>
13545 <td title="Hello world">Foo
13546 </td></tr></table>
13547 !! end
13548
13549 !! test
13550 Table with broken attribute value quoting on consecutive lines
13551 !! options
13552 parsoid=wt2html,html2html
13553 !! wikitext
13554 {|
13555 | title="Hello world|Foo
13556 | style="color:red|Bar
13557 |}
13558 !! html/php
13559 <table>
13560 <tbody><tr>
13561 <td title="Hello world">Foo
13562 </td>
13563 <td style="color:red">Bar
13564 </td></tr></tbody></table>
13565 !! html/parsoid
13566 <table><tbody>
13567 <tr>
13568 <td title="Hello world">Foo
13569 </td><td style="color:red">Bar
13570 </td></tr></tbody></table>
13571 !! end
13572
13573 !!test
13574 Accept empty td cell attribute
13575 !! wikitext
13576 {|
13577 | align="center" |foo|| |
13578 |}
13579 !! html
13580 <table>
13581 <tbody><tr>
13582 <td align="center">foo</td>
13583 <td>
13584 </td></tr></tbody></table>
13585 !! end
13586
13587 !!test
13588 Non-empty attributes in th-cells
13589 !! wikitext
13590 {|
13591 !Foo!! style="color: red" |Bar
13592 |}
13593 !! html
13594 <table>
13595 <tbody><tr>
13596 <th>Foo</th>
13597 <th style="color: red">Bar
13598 </th></tr></tbody></table>
13599 !! end
13600
13601 !!test
13602 Accept empty attributes in th-cells
13603 !! wikitext
13604 {|
13605 !|foo!!|bar
13606 |}
13607 !! html
13608 <table>
13609 <tbody><tr>
13610 <th>foo</th>
13611 <th>bar
13612 </th></tr></tbody></table>
13613 !! end
13614
13615 !!test
13616 Empty table rows go away
13617 !! wikitext
13618 {|
13619 |Hello
13620 |there
13621 |- class="foo"
13622 |-
13623 |}
13624 !! html
13625 <table>
13626 <tbody><tr>
13627 <td>Hello
13628 </td>
13629 <td>there
13630 </td></tr>
13631
13632 </tbody></table>
13633 !! end
13634
13635 ###
13636 ### Parsoid-centric tests for testing RTing of inter-element separators
13637 ### Edge cases not tested by existing parser tests and specific to
13638 ### Parsoid-specific serialization strategies.
13639 ###
13640
13641 !!test
13642 RT-ed inter-element separators should be valid separators
13643 !! wikitext
13644 {|
13645 |- [[foo]]
13646 |}
13647 !! html/php
13648 <table>
13649
13650 </table>
13651 !! html/parsoid
13652 <table>
13653 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""}}'></tr>
13654 </tbody></table>
13655 !!end
13656
13657 # Parsoid-only test of a DOM pass
13658 !!test
13659 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
13660 !! wikitext
13661 {|
13662 |<small>foo
13663 bar
13664 |}
13665
13666 {|
13667 |<small>foo<small>
13668 |}
13669 !! html/parsoid
13670 <table>
13671 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
13672 <p>bar</p></small></td></tr>
13673 </tbody></table>
13674
13675 <table>
13676 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo<small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></small></td></tr>
13677 </tbody></table>
13678 !!end
13679
13680 # Note that the "style" attribute is really a template parameter here.
13681 # The = would have to be {{=}} if you wanted the literal.
13682 !!test
13683 Empty TD followed by TD with tpl-generated attribute
13684 !! wikitext
13685 {|
13686 |-
13687 |
13688 |{{1x|style='color:red'}}|foo
13689 |}
13690 !! html
13691 <table>
13692
13693 <tbody><tr>
13694 <td>
13695 </td>
13696 <td>foo
13697 </td></tr></tbody></table>
13698 !! end
13699
13700 !!test
13701 Indented table with an empty td
13702 !! wikitext
13703 {|
13704 |-
13705 |
13706 |foo
13707 |}
13708 !! html
13709 <table>
13710
13711 <tbody><tr>
13712 <td>
13713 </td>
13714 <td>foo
13715 </td></tr></tbody></table>
13716 !! end
13717
13718 !! test
13719 Indented table with blank lines in between (T85627)
13720 !! wikitext
13721 {|
13722 |foo
13723
13724
13725 |}
13726 !! html/php
13727 <table>
13728 <tbody><tr>
13729 <td>foo
13730 <p><br />
13731 </p>
13732 </td></tr></tbody></table>
13733 !! html/parsoid
13734 <table>
13735 <tbody><tr><td>foo
13736 <p>
13737 <br /></p></td></tr>
13738 </tbody></table>
13739 !! end
13740
13741 !!test
13742 Indented block & table
13743 !! wikitext
13744 <div>foo</div>
13745 {|
13746 |foo
13747 |}
13748 !! html/php
13749 <div>foo</div>
13750 <table>
13751 <tbody><tr>
13752 <td>foo
13753 </td></tr></tbody></table>
13754 !! html/parsoid
13755 <div data-parsoid='{"stx":"html"}'>foo</div>
13756 <table><tbody>
13757 <tr data-parsoid='{"autoInsertedStart":true}'><td data-parsoid='{}'>foo</td></tr>
13758 </tbody></table>
13759 !!end
13760
13761 !! test
13762 Indent and comment before table row
13763 !! wikitext
13764 {|
13765 <!--hi-->|-
13766 |there
13767 |}
13768 !! html/php
13769 <table>
13770
13771 <tbody><tr>
13772 <td>there
13773 </td></tr></tbody></table>
13774 !! html/parsoid
13775 <table>
13776 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-"}'>
13777 <td data-parsoid='{}'> there</td></tr>
13778 </tbody></table>
13779 !! end
13780
13781 # PHP parser omits empty TR
13782 !!test
13783 Empty TR followed by a template-generated TR
13784 !! wikitext
13785 {|
13786 |-
13787 {{1x|<tr><td>foo</td></tr>}}
13788 |}
13789 !! html/php
13790 <table>
13791
13792 <tbody><tr><td>foo</td></tr>
13793 </tbody></table>
13794 !! html/parsoid
13795 <table>
13796 <tbody>
13797 <tr class='mw-empty-elt'></tr>
13798 <tr about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<tr><td>foo</td></tr>"}},"i":0}}]}'>
13799 <td>foo</td></tr>
13800 </tbody></table>
13801 !!end
13802
13803 ## PHP and parsoid output differ for this; as usual PHP omits empty
13804 ## elements, and since it strips the comments the TR is empty.
13805 !!test
13806 Empty TR followed by mixed-ws-comment line should RT correctly
13807 !! wikitext
13808 {|
13809 |-
13810 <!--c-->
13811 |-
13812 <!--c--> <!--d-->
13813 |}
13814 !! html/php
13815 <table>
13816
13817
13818 </table>
13819 !! html/parsoid
13820 <table>
13821 <tbody>
13822 <tr class='mw-empty-elt'></tr>
13823 <!--c-->
13824 <tr class="mw-empty-elt">
13825 <!--c--> </tr><!--d-->
13826 </tbody></table>
13827 !! end
13828
13829 !!test
13830 Multi-line image caption generated by templates with/without trailing newlines
13831 !! wikitext
13832 [[File:Foobar.jpg|thumb|300x300px|foo\n{{1x|A}}\n{{1x|B}}\n{{1x|C}}]]
13833 [[File:Foobar.jpg|thumb|300x300px|foo\n{{1x|A}}\n{{1x|B}}\n{{1x|C}}\n\n]]
13834 !! html/parsoid
13835 <figure typeof="mw:File/Thumb"><a href="./File:Foobar.jpg" class="mw-file-description"><img resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300" 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" class="mw-file-element"/></a><figcaption>foo\n<span about="#mwt9" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt10" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt11" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span></figcaption></figure>
13836 <figure typeof="mw:File/Thumb"><a href="./File:Foobar.jpg" class="mw-file-description"><img resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300" 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" class="mw-file-element"/></a><figcaption>foo\n<span about="#mwt12" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt14" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span>\n\n</figcaption></figure>
13837 !! end
13838
13839 !! test
13840 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
13841 !! options
13842 parsoid=html2wt
13843 !! html/parsoid
13844 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>foo&lt;/includeonly>"}' data-mw='{"src":"&lt;includeonly>foo&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p>
13845
13846 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
13847 !! wikitext
13848 <includeonly>foo</includeonly>
13849 new para
13850
13851 [[Category:Foo]]
13852
13853 = new heading =
13854 !! end
13855
13856 ## PHP emits broken html for this, and since this is primarily
13857 ## a Parsoid serializer test, marking this Parsoid only
13858 !! test
13859 Improperly nested inline or quotes tags with whitespace in between
13860 !! options
13861 parsoid=html2wt
13862 !! html/parsoid
13863 <p><span> <s>x</s></span><s> </s>
13864 <b> <i>x</i></b><i> </i>
13865 </p>
13866 !! wikitext
13867 <span> <s>x</s></span><s> </s>
13868 ''' ''x'''''
13869 !! end
13870
13871 !!test
13872 Encapsulate protected attributes from wt
13873 !! wikitext
13874 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
13875
13876 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
13877 |ok
13878 |}
13879 !! html/parsoid
13880 <div data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
13881
13882 <table data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">
13883 <tbody><tr><td data-parsoid='{}'>ok</td></tr>
13884 </tbody></table>
13885 !!end
13886
13887 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
13888 ## Having nested or stray pre tags results in the attempt to add duplicates,
13889 ## causing an assertion fail. This test tries to prevent that situation.
13890 !! test
13891 Ensure ParagraphWrapper can deal with stray closing pre tags
13892 !! options
13893 parsoid=wt2html
13894 !! wikitext
13895 plain text</pre>
13896 !! html/parsoid
13897 <p>plain text</p>
13898 !! end
13899
13900 ## Remex doesn't account for fostered content.
13901 !! test
13902 1. Ensure fostered text content is wrapped in element nodes
13903 !! options
13904 parsoid=wt2html
13905 !! wikitext
13906 <table>hi</table><table>ho</table>
13907 !! html/php
13908 hi<table></table>ho<table></table>
13909 !! html/parsoid
13910 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>hi</p><table data-parsoid='{"stx":"html"}'></table><p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>ho</p><table data-parsoid='{"stx":"html"}'></table>
13911 !! end
13912
13913 ## Remex doesn't account for fostered content.
13914 !! test
13915 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
13916 !! options
13917 parsoid=wt2html,wt2wt
13918 !! wikitext
13919 <table>
13920 <tr> || ||
13921 <td> a
13922 </table>
13923 !! html/php
13924 || ||
13925 <table>
13926 <tbody><tr><td> a
13927 </td></tr></tbody></table>
13928 !! html/parsoid
13929 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
13930 <table data-parsoid='{"stx":"html"}'>
13931 <tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'> a
13932 </td></tr></tbody></table>
13933 !! end
13934
13935 ## Remex doesn't account for fostered content.
13936 !! test
13937 Encapsulation properly handles null DSR information from foster box
13938 !! options
13939 parsoid=wt2html,wt2wt
13940 !! wikitext
13941 {{1x|<table>foo<tr><td>bar</td></tr></table>}}
13942 !! html/parsoid
13943 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;table>foo&lt;tr>&lt;td>bar&lt;/td>&lt;/tr>&lt;/table>"}},"i":0}}]}'>foo</p><table about="#mwt1" data-parsoid='{"stx":"html"}'><tbody><tr><td>bar</td></tr></tbody></table>
13944 !! end
13945
13946 ## Remex doesn't account for fostered content.
13947 !! test
13948 1. Encapsulate foster-parented transclusion content
13949 !! options
13950 parsoid=wt2wt,wt2html
13951 !! wikitext
13952 <table>{{1x|foo<tr><td>bar</td></tr>}}</table>
13953 !! html/php
13954 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
13955 !! html/parsoid
13956 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo&lt;tr>&lt;td>bar&lt;/td>&lt;/tr>"}},"i":0}},"&lt;/table>"]}'>foo</p><table about="#mwt2" data-parsoid='{"stx":"html"}'><tbody><tr><td>bar</td></tr></tbody></table>
13957 !! end
13958
13959 !! test
13960 2. Encapsulate foster-parented transclusion content
13961 !! options
13962 parsoid=wt2wt,wt2html
13963 !! wikitext
13964 <table><div>{{1x|foo}}</div><tr><td>bar</td></tr></table>
13965 !! html/parsoid
13966 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;1x&quot;,&quot;href&quot;:&quot;./Template:1x&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>
13967 <table>
13968 <tbody>
13969 <tr>
13970 <td>bar</td>
13971 </tr>
13972 </tbody>
13973 </table>
13974 !! end
13975
13976 !! test
13977 3. Encapsulate foster-parented transclusion content
13978 !! options
13979 parsoid=wt2wt,wt2html
13980 !! wikitext
13981 <table><div><p>{{1x|foo</p></div><tr><td>}}bar</td></tr></table>
13982 !! html/parsoid
13983 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;1x&quot;,&quot;href&quot;:&quot;./Template:1x&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;]}">
13984 <p>foo</p>
13985 </div>
13986 <table>
13987 <tbody>
13988 <tr>
13989 <td>bar</td>
13990 </tr>
13991 </tbody>
13992 </table>
13993 !! end
13994
13995 !! test
13996 4. Encapsulate foster-parented transclusion content
13997 !! options
13998 parsoid=wt2wt,wt2html
13999 !! wikitext
14000 <table><div><p>{{1x|foo</p></div><tr><td>}}bar</td></tr></table>
14001 !! html/parsoid
14002 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;1x&quot;,&quot;href&quot;:&quot;./Template:1x&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;]}">
14003 <p>foo</p>
14004 </div>
14005 <table>
14006 <tbody>
14007 <tr>
14008 <td>bar</td>
14009 </tr>
14010 </tbody>
14011 </table>
14012 !! end
14013
14014 ## Remex doesn't account for fostered content.
14015 !! test
14016 5. Encapsulate foster-parented transclusion content
14017 !!options
14018 parsoid=wt2wt,wt2html
14019 !! wikitext
14020 <table><tr><td><div><p>{{1x|foo</p></div></td>foo}}</tr></table>
14021 !! html/php
14022 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
14023 !! html/parsoid
14024 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;tr>&lt;td>&lt;div>&lt;p>",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo&lt;/p>&lt;/div>&lt;/td>foo"}},"i":0}},"&lt;/tr>&lt;/table>"]}'>foo</p><table about="#mwt2" data-parsoid='{"stx":"html"}'><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
14025 !! end
14026
14027 ## Remex doesn't account for fostered content.
14028 !! test
14029 6. Encapsulate foster-parented transclusion content
14030 !! options
14031 parsoid=wt2wt,wt2html
14032 !! wikitext
14033 <table><tr><td><div><p>{{1x|foo</p></div></td>foo</tr></table>}}<p>ok</p>
14034 !! html/php
14035 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
14036 !! html/parsoid
14037 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;tr>&lt;td>&lt;div>&lt;p>",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo&lt;/p>&lt;/div>&lt;/td>foo&lt;/tr>&lt;/table>"}},"i":0}}]}'>foo</p><table about="#mwt2" data-parsoid='{"stx":"html"}'><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p data-parsoid='{"stx":"html"}'>ok</p>
14038 !! end
14039
14040 !! test
14041 7. Encapsulate foster-parented transclusion content
14042 !!options
14043 parsoid=wt2wt,wt2html
14044 !! wikitext
14045 <table>{{1x|<p>foo</p>}}<td>bar</td></table>
14046 !! html/parsoid
14047 <p about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;1x&quot;,&quot;href&quot;:&quot;./Template:1x&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>
14048 <table>
14049 <tbody>
14050 <tr>
14051 <td>bar</td>
14052 </tr>
14053 </tbody>
14054 </table>
14055 !! end
14056
14057 ## Remex doesn't account for fostered content.
14058 # Note that the wt is broken on purpose: the = should be {{=}} if you
14059 # don't want it to be a template parameter key.
14060 !! test
14061 8. Encapsulate foster-parented transclusion content
14062 !! options
14063 parsoid=wt2wt,wt2html
14064 !! wikitext
14065 {{1x|a
14066 }}{|{{1x|style='color:red'}}
14067 |-
14068 |b
14069 |}
14070 !! html/php
14071 <p>a
14072 </p>
14073 <table>
14074
14075 <tbody><tr>
14076 <td>b
14077 </td></tr></tbody></table>
14078 !! html/parsoid
14079 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p><span about="#mwt1">
14080 </span><p about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"style","named":true}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"style":{"wt":"&apos;color:red&apos;"}},"i":0}},"\n|-\n|b\n|}"]}'>{{{1}}}</p><table about="#mwt3">
14081 <tbody><tr>
14082 <td>b
14083 </td></tr></tbody></table>
14084 !! end
14085
14086 ## Remex doesn't account for fostered content.
14087 !! test
14088 9. Encapsulate foster-parented transclusion content
14089 !!options
14090 parsoid=wt2wt,wt2html
14091 !! wikitext
14092 <table>{{1x|hi</table>hello}}
14093 !! html/php
14094 hi<table></table><p>hello</p>
14095 !! html/parsoid
14096 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}'>hi</p><table about="#mwt2"></table><p about="#mwt2">hello</p>
14097 !! end
14098
14099 !! test
14100 Table in fosterable position
14101 !!options
14102 parsoid=wt2html
14103 !! wikitext
14104 {{OpenTable}}
14105 <div>
14106 {|
14107 |}
14108 </div>
14109 |}
14110 !! html/parsoid
14111 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>\n"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'>
14112 </div><span about="#mwt1">
14113 </span>
14114 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
14115
14116 <table>
14117 </table>
14118 !! end
14119
14120 # Parsoid only for T66747
14121 # (Also core doesn't define {{#if}} in default install)
14122 !! test
14123 Properly encapsulate empty-content transclusions in fosterable positions
14124 !! wikitext
14125 <table>
14126 {{#if:|
14127 <td>foo</td>
14128 }}
14129 </table>
14130 !! html/parsoid
14131 <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"}]]}'>
14132
14133 </table>
14134 !! end
14135
14136 ## No longer captures its original intention
14137 !! test
14138 Always encapsulate foster box when template range is expanded to table
14139 !! options
14140 disabled
14141 parsoid=wt2wt
14142 !! wikitext
14143 {|
14144 hello
14145 {{OpenTable}}
14146 |}
14147 !! html/parsoid
14148 !! end
14149
14150 !! test
14151 T115289: Unclosed table
14152 !! wikitext
14153 {{1x|<table>}}<!--c-->[[Category:Two]]
14154 !! html/parsoid
14155 <link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><table about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><!--c--></table>
14156 !! end
14157
14158 !! test
14159 T115289: Don't migrate newlines out of tables with fostered content
14160 !! wikitext
14161 <table><td></td>{{1x|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
14162 !! html/parsoid
14163 <link rel="mw:PageProp/Category" href="./Category:One" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:One"},"sa":{"href":"Category:One"},"fostered":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;td>&lt;/td>",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;tr>[[Category:One]]"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt2"/><table about="#mwt2" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr><td></td></tr><!--c--></tbody></table>
14164 !! end
14165
14166 !! test
14167 T73074: More fostering fun
14168 !! wikitext
14169 <table><td></td>{{1x|<tr>}}<!--c-->[[Category:Two]]
14170 !! html/parsoid
14171 <link rel="mw:PageProp/Category" href="./Category:Two" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"fostered":true}'/><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td data-parsoid='{"stx":"html"}'></td></tr><tr about="#mwt1" typeof="mw:Transclusion" class='mw-empty-elt' data-parsoid='{"autoInsertedEnd":true,"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;tr>"}},"i":0}}]}'></tr><!--c--></tbody></table>
14172 !! end
14173
14174 ## Regression test for Parsoid's template wrapping of fostered content
14175 !! test
14176 Fostered content with a dom fragment token starting with a transclusion
14177 !! options
14178 parsoid=wt2html
14179 !! wikitext
14180 {|
14181 [[File:Foobar.jpg|right|{{1x|<div>123</div>}}]]
14182 |}
14183 !! html/parsoid
14184 <figure class="mw-default-size mw-halign-right" typeof="mw:File" data-parsoid='{"fostered":true}'><a href="./File:Foobar.jpg" class="mw-file-description" title="123"><img alt="123" resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element"/></a><figcaption><div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;div>123&lt;/div>"}},"i":0}}]}'>123</div></figcaption></figure><table>
14185
14186 </table>
14187 !! end
14188
14189 !! article
14190 Template:Tr
14191 !! text
14192 |-
14193 !! end
14194
14195 !! test
14196 1. Template wrapping shouldn't ignore fostered content
14197 !! options
14198 parsoid=wt2wt
14199 !! wikitext
14200 {|
14201 {{tr}}
14202 {{1x|
14203 }}
14204
14205 hiho
14206 !! html/parsoid
14207 !! end
14208
14209 !! test
14210 2. Template wrapping shouldn't ignore fostered content
14211 !! options
14212 parsoid=wt2wt
14213 !! wikitext
14214 {|
14215 {{tr}}
14216 {{1x|
14217 }}
14218
14219 hiho
14220 !! html/parsoid
14221 !! end
14222
14223 !!test
14224 Support <object> element with .data attribute
14225 !!options
14226 parsoid=html2wt
14227 !! html/parsoid
14228 <object data="test.swf"></object>
14229 !! wikitext
14230 <object data="test.swf"></object>
14231 !!end
14232
14233 !! test
14234 T72867: Don't block XML namespace declaration
14235 !! wikitext
14236 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
14237 !! html/php
14238 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
14239 </p>
14240 !! html/parsoid
14241 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
14242 !! end
14243
14244 # -----------------------------------------------------------------
14245 # The following section of tests are primarily to spec requirements
14246 # around Parsoid's serialization (old, new, edited content)
14247 #
14248 # All these tests are marked Parsoid html2wt and html2html only
14249 # ----------------------------------------------------------------
14250
14251 !! test
14252 Ignore rel attribute in a-tags during serialization to url-links
14253 !! options
14254 parsoid=html2wt
14255 !! html/parsoid
14256 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
14257 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
14258 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
14259 !! wikitext
14260 http://en.wikipedia.org/wiki/Foobar
14261 http://en.wikipedia.org/wiki/Foobar
14262 http://en.wikipedia.org/wiki/Foobar
14263 !! end
14264
14265 # 'mi' is a localinterwiki prefix as well as a language
14266 !! test
14267 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
14268 !! options
14269 parsoid=html2wt
14270 !! html/parsoid
14271 <p><a rel="mw:ExtLink" href="http://example.org/wiki/Foo">Foo</a></p>
14272 !! wikitext
14273 [[Foo]]
14274 !! end
14275
14276 !! test
14277 Parsoid should accept interwiki shortcuts
14278 !! options
14279 parsoid=html2wt
14280 !! html/parsoid
14281 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
14282 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
14283 <a href='./fr:Foo'>Foo</a></p>
14284 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
14285 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
14286 <a href='fr%3AFoo'>Foo</a></p>
14287 <p><a href='FR%3AFoo'>Foo</a>
14288 <a href='./FR:Foo'>Foo</a></p>
14289 !! wikitext
14290 [[:fr:Foo|Foo]]
14291 [[:fr:Foo|Foo]]
14292 [[:fr:Foo|Foo]]
14293
14294 [[:fr:Foo|Foo]]
14295 [[:fr:Foo|Foo]]
14296 [[:fr:Foo|Foo]]
14297
14298 [[:fr:Foo|Foo]]
14299 [[:fr:Foo|Foo]]
14300 !! end
14301
14302 !! test
14303 Parsoid should not accept invalid interwiki shortcuts
14304 !! options
14305 parsoid=html2wt
14306 !! html/parsoid
14307 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
14308 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
14309 <a href='news:Foo'>Foo</a></p>
14310 !! wikitext
14311 [news:Foo Foo]
14312 [news:Foo Foo]
14313 [news:Foo Foo]
14314 !! end
14315
14316 # See T93839
14317 !! test
14318 New wikilinks should be serialized properly
14319 !! options
14320 parsoid=html2wt
14321 !! html/parsoid
14322 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
14323 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
14324 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
14325 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
14326 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
14327 !! wikitext
14328 [[Foo]]
14329 [[Foo]]
14330 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
14331 http://en.wikipedia.org/wiki/Foo
14332 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
14333 !! end
14334
14335 !! test
14336 New wiki links (href variations)
14337 !! options
14338 parsoid=html2wt
14339 !! html/parsoid
14340 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
14341 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
14342 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
14343 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
14344 !! wikitext
14345 [[Foo_bar]]
14346 [[Foo_bar]]
14347 [[Foo_bar]]
14348 [[Toxine bactérienne]]
14349 !! end
14350
14351 !! test
14352 New wiki links (content string variations)
14353 !! options
14354 parsoid=html2wt
14355 !! html/parsoid
14356 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
14357 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
14358 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
14359 !! wikitext
14360 [[Foo_bar]]
14361 [[Foo bar]]
14362 [[Foo_bar|./Foo_bar]]
14363 !! end
14364
14365 !! test
14366 New category links (href variations)
14367 !! options
14368 parsoid=html2wt
14369 !! html/parsoid
14370 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
14371 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
14372 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
14373 !! wikitext
14374 [[Category:Toxine bactérienne]]
14375 [[Category:Toxine bactérienne]]
14376 [[Category:Toxine bactérienne]]
14377 !! end
14378
14379 !! test
14380 New sol transparent links don't need indent-pre nowiki protection
14381 !! options
14382 parsoid=html2wt
14383 language=de
14384 !! html/parsoid
14385 <link rel="mw:PageProp/redirect" href="./Main_Page">
14386 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
14387 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
14388 !! wikitext
14389 #WEITERLEITUNG [[Main Page]]
14390 <!-- this is good --> [[Category:Good]]
14391 <!-- this is great --> [[Kategorie:Great]]
14392 !! end
14393
14394 !! test
14395 New interlanguage links (href variations)
14396 !! options
14397 parsoid=html2wt
14398 !! html/parsoid
14399 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
14400 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
14401 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
14402 !! wikitext
14403 [[es:Toxine bactérienne]]
14404 [[es:Toxine_bactérienne]]
14405 [[es:Toxine_bactérienne]]
14406 !! end
14407
14408 # Regression test for T219023
14409 !! test
14410 Emit simple non-piped link where possible
14411 !! options
14412 parsoid=html2wt
14413 !! html/parsoid
14414 <a rel='mw:WikiLink' href='./VisualEditor'>VisualEditor</a>
14415 <a rel='mw:WikiLink' href='./VisualEditor'>visualEditor</a>
14416 <a rel='mw:WikiLink' href='./VisualEditor link'>VisualEditor link</a>
14417 <a rel='mw:WikiLink' href='./VisualEditor link'>visualEditor link</a>
14418 !! wikitext
14419 [[VisualEditor]]
14420 [[visualEditor]]
14421 [[VisualEditor link]]
14422 [[visualEditor link]]
14423 !! end
14424
14425 !! test
14426 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
14427 !! options
14428 parsoid=html2wt
14429 !! html/parsoid
14430 <ul>
14431 <li><p>foo</p></li>
14432 </ul>
14433 !! wikitext
14434 * foo
14435 !! end
14436
14437 !! test
14438 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
14439 !! options
14440 parsoid=html2wt
14441 !! html/parsoid
14442 <ul> <li>foo</li></ul>
14443 !! wikitext
14444 * foo
14445 !! end
14446
14447 !! test
14448 Don't strip leading whitespace when handling indent-pre suppressing tags
14449 !! options
14450 parsoid=html2wt
14451 !! html/parsoid
14452 <table>
14453 <tr><td> indented row</td></tr>
14454 </table>
14455 <blockquote><p>
14456 <b>This is very bold of you!</b>
14457 </p>
14458 <table><tr><td>
14459 indented cell (no pre-wrapping!)
14460 </td></tr></table>
14461 </blockquote>
14462 <p>foo</p>
14463 <div>bar</div>
14464 !! wikitext
14465 {|
14466 | indented row
14467 |}
14468 <blockquote>
14469 '''This is very bold of you!'''
14470
14471 {|
14472 |
14473 indented cell (no pre-wrapping!)
14474 |}
14475 </blockquote>
14476 foo
14477 <div>bar</div>
14478 !! end
14479
14480 !! test
14481 Strip leading whitespace when handling indent-pre inducing tags
14482 !! options
14483 parsoid=html2wt
14484 !! html/parsoid
14485 <p>foo</p>
14486 <span>bar</span>
14487
14488 <span>foo2
14489 </span>bar2
14490
14491 <div>foo</div>
14492 <span>bar</span>
14493
14494 <div>
14495 <span>foo</span>
14496 </div>
14497 !! wikitext
14498 foo
14499
14500 <span>bar</span>
14501
14502 <span>foo2
14503 </span>bar2
14504
14505 <div>foo</div>
14506 <span>bar</span>
14507
14508 <div>
14509 <span>foo</span>
14510 </div>
14511 !! end
14512
14513 !! test
14514 Lists: Dont insert newlines in a serialized list item.
14515 !! options
14516 parsoid=html2wt
14517 !! html/parsoid
14518 <ul><li>a<br>b</li><li>c</li></ul>
14519 !! wikitext
14520 * a<br />b
14521 * c
14522 !! end
14523
14524 !! test
14525 Headings: Force sol-transparent links and behavior switches to serialize before/after
14526 !! options
14527 parsoid={
14528 "modes": ["html2wt"]
14529 }
14530 !! html/parsoid
14531 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
14532 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
14533
14534 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
14535 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
14536
14537 <h2><meta property="mw:PageProp/toc" /> ok</h2>
14538 !! wikitext
14539 == hello there ==
14540 [[Category:A1]]
14541 [[Category:A2]]
14542
14543 == hi pal ==
14544
14545 <!--foo--> [[Category:A3]]
14546
14547 == how goes it ==
14548
14549 == it goes well ==
14550 [[Category:A4]] <!--bar-->
14551
14552 __TOC__
14553
14554 == ok ==
14555 !! end
14556
14557 !! test
14558 Headings: Don't hoist metas that come from templates
14559 !! options
14560 parsoid={
14561 "modes": ["html2wt"]
14562 }
14563 !! html/parsoid
14564 <h2><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo [[Category:Foo]]"}},"i":0}}]}'>foo </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" /></h2>
14565 !! wikitext
14566 == {{1x|foo [[Category:Foo]]}} ==
14567 !! end
14568
14569 !! test
14570 Parsoid: Serialize positional parameters with = in them as named parameter
14571 !! options
14572 parsoid=html2wt
14573 !! html/parsoid
14574 <p about="#mwt1" typeof="mw:Transclusion"
14575 data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
14576
14577 <p about="#mwt1" typeof="mw:Transclusion"
14578 data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
14579
14580 <!--Orig params with data-parsoid has heuristics for handling = chars-->
14581 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
14582 <p data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"f=oo"},"2":{"wt":"bar"}},"i":0}}]}'>foo</p>
14583 !! wikitext
14584 {{1x|1=f=oo}}
14585
14586 {{1x|1=f=oo|2=bar}}
14587
14588 <!--Orig params with data-parsoid has heuristics for handling = chars-->
14589 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
14590 {{1x|<nowiki>f=oo</nowiki>|bar}}
14591 !! end
14592
14593 !! test
14594 Parsoid: Serialize positional parameters with = in extlink as named parameter
14595 !! options
14596 parsoid=html2wt
14597 !! html/parsoid
14598 <p><a rel="mw:ExtLink" href="http://stuff?is=ok" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"http://stuff?is=ok"}},"i":0}}]}'>http://stuff?is=ok</a></p>
14599 !! wikitext
14600 {{1x|1=http://stuff?is=ok}}
14601 !! end
14602
14603 !! test
14604 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
14605 !! options
14606 parsoid=html2wt
14607 !! html/parsoid
14608 <div>a<p>b</p></div>
14609 <div>a
14610 <p>b</p></div>
14611 <div>
14612 a
14613 <p>b</p></div>
14614 !! wikitext
14615 <div>a
14616 b
14617 </div>
14618 <div>a
14619 b
14620 </div>
14621 <div>
14622 a
14623
14624 b
14625 </div>
14626 !! end
14627
14628 !! test
14629 Substrings resembling wikitext in hrefs should not get nowiki escapes
14630 !! options
14631 parsoid=html2wt
14632 !! html/parsoid
14633 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
14634 !! wikitext
14635 [[Foo''bar''baz]]
14636 !! end
14637
14638 !! test
14639 Enforce single-line context in the serializer
14640 !! options
14641 parsoid=html2wt
14642 !! html/parsoid
14643 <h2>testing
14644 123</h2>
14645
14646 <h2> hi <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bogus","href":"./Template:Bogus"},"params":{"1":{"wt":"there\nyou"}},"i":0}}]}'>there</span><span about="#mwt1">
14647 </span><span about="#mwt1">you</span> </h2>
14648
14649 <h2> foo <span about="#mwt2" typeof="mw:Extension/spantag" data-mw='{"name":"spantag","body":{"extsrc":"hello\nthere"},"attrs":{}}'>hello
14650 there</span> </h2>
14651
14652 <ul><li>asd
14653 sdf</li></ul>
14654
14655 <ul><li>foo
14656 bar
14657 baz</li>
14658 <li>foo <b>bar</b>
14659 baz</li></ul>
14660
14661 <dl><dt>hi
14662 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
14663 ho</dd></dl>
14664
14665 <dl><dd> <table>
14666 <tbody><tr><td> ha
14667 ha
14668 ha</td></tr>
14669 </tbody></table></dd></dl>
14670 !! wikitext
14671 == testing 123 ==
14672
14673 == hi {{bogus|there
14674 you}} ==
14675
14676 == foo <spantag>hello
14677 there</spantag> ==
14678
14679 * asd sdf
14680
14681 * foo bar baz
14682 * foo '''bar''' baz
14683
14684 ; hi ho : hi ho
14685
14686 : {|
14687 | ha
14688 ha
14689 ha
14690 |}
14691 !! end
14692
14693 # Note that core parser doesn't like newlines in wikilinks in headings.
14694 # But, Parsoid handles it just fine. We'll consider this acceptable divergence.
14695 # We can change behavior if this becomes a real problem (ex: VE users start
14696 # adding newlines in links in headings which then breaks rendering when rendered
14697 # outside of Parsoid, or breaks section editing code). Eventually Parsoid will
14698 # core parser everywhere and this inconsistency will go away.
14699 !! test
14700 Ignore single-line context for wikilinks
14701 !! options
14702 parsoid=html2wt
14703 !! html/parsoid
14704 <ul><li><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect">
14705 bar</a></li></ul>
14706 <h2><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect">
14707 bar</a></h2>
14708 <ul><li><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect">bar
14709 <span style="background-color:green;
14710 color:blue" data-parsoid='{"stx":"html"}'>x</span></a></li></ul>
14711 !! wikitext
14712 * [[Foo|
14713 bar]]
14714
14715 == [[Foo|
14716 bar]] ==
14717
14718 * [[Foo|bar
14719 <span style="background-color:green;
14720 color:blue">x</span>]]
14721 !! end
14722
14723 !! test
14724 Selser: Ignore single-line context for wikilinks
14725 !! options
14726 parsoid={
14727 "modes": ["selser"],
14728 "selser": "noauto",
14729 "changes": [
14730 [ "ul > li ", "append", "<ul><li>foo</li></ul>" ]
14731 ]
14732 }
14733 !! wikitext
14734 * [[Foo|
14735 bar]]
14736 !! wikitext/edited
14737 * [[Foo|
14738 bar]]
14739 ** foo
14740 !! end
14741
14742 !! test
14743 Serialize new displayspace spans
14744 !! options
14745 parsoid=html2wt
14746 !! html/parsoid
14747 <p>foo<span typeof="mw:DisplaySpace"> </span>: bar</p>
14748
14749 <p>foo<span typeof="mw:DisplaySpace"> </span>: bar</p>
14750
14751 <p><span typeof="mw:Extension/spantag" data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"foo : bar"}}'>foo<span typeof="mw:DisplaySpace"> </span>: bar</span>ok</p>
14752
14753 <a href="http://example.com">«<span typeof="mw:DisplaySpace">&nsbp;</span>Tour Eiffel<span typeof="mw:DisplaySpace">&nsbp;</span>»</a>
14754
14755 Hello<span typeof="mw:DisplaySpace">&nbsp;</span>World!
14756
14757 <ul>
14758 <li><span typeof="mw:DisplaySpace">&nbsp;</span>Foo</li>
14759 </ul>
14760 !! wikitext
14761 foo : bar
14762
14763 foo : bar
14764
14765 <spantag>foo : bar</spantag>ok
14766
14767 [http://example.com « Tour Eiffel »]
14768
14769 Hello World!
14770
14771 * Foo
14772 !! end
14773
14774
14775 #-----------------------
14776 # Tag minimization tests
14777 #-----------------------
14778
14779 !! test
14780 1. I/B quote minimization: wikitext-only tags should be combined
14781 !! options
14782 parsoid=html2wt
14783 !! html/parsoid
14784 <p><i>A</i><i>B</i></p>
14785 <p><b>A</b><b>B</b></p>
14786 <p><i>A</i><b><i>B</i></b></p>
14787 <p><b>A</b><i><b>B</b></i></p>
14788 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
14789 <p><i><b>A</b></i><i><b>B</b></i></p>
14790 <p><i><b>A</b></i><b><i>B</i></b></p>
14791 <p><b><i>A</i></b><i><b>B</b></i></p>
14792 !! wikitext
14793 ''AB''
14794
14795 '''AB'''
14796
14797 ''A'''B'''''
14798
14799 '''A''B'''''
14800
14801 '''A''BC''D'''
14802
14803 '''''AB'''''
14804
14805 '''''AB'''''
14806
14807 '''''AB'''''
14808 !! end
14809
14810 !! test
14811 2. I/B quote minimization: wikitext and html tags should not be combined
14812 !! options
14813 parsoid=html2wt
14814 !! html/parsoid
14815 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
14816 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
14817 !! wikitext
14818 ''A''<i>B</i>
14819
14820 ''A''<nowiki/>'''<i>B</i>'''
14821 !! end
14822
14823 !! test
14824 3. I/B quote minimization: templated content stops minimization
14825 !! options
14826 parsoid=html2wt
14827 !! html/parsoid
14828 <p><i>A</i><i about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&#39;&#39;B&#39;&#39;"}},"i":0}}]}'>B</i>
14829 <p><i>A</i><b about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&#39;&#39;&#39;&#39;&#39;B&#39;&#39;&#39;&#39;&#39;"}},"i":0}}]}'><i>B</i></b>
14830 !! wikitext
14831 ''A''{{1x|''B''}}
14832
14833 ''A''{{1x|'''''B'''''}}
14834 !! end
14835
14836 !! test
14837 4. I/B quote minimization: new content should be mimimized with adjacent old content
14838 !! options
14839 parsoid=html2wt
14840 !! html/parsoid
14841 <p><i>A</i><i>B</i></p>
14842 <p><b>A</b><b>B</b></p>
14843 <p><i>A</i><b><i>B</i></b></p>
14844 !! wikitext
14845 ''AB''
14846
14847 '''AB'''
14848
14849 ''A'''B'''''
14850 !! end
14851
14852 !! test
14853 5a. Merge adjacent quote nodes if they've been edited
14854 !! options
14855 parsoid={
14856 "modes": ["wt2wt", "selser"],
14857 "changes": [
14858 ["p", "contents", "remove", ":contains('b')"]
14859 ]
14860 }
14861 !! wikitext
14862 ''a''b''c''
14863 !! wikitext/edited
14864 ''ac''
14865 !! end
14866
14867 !! test
14868 5b. Merge adjacent quote nodes if they've been edited
14869 !! options
14870 parsoid={
14871 "modes": ["wt2wt", "selser"],
14872 "changes": [
14873 ["#x", "remove"]
14874 ]
14875 }
14876 !! wikitext
14877 ''a''<span id="x">b</span>''c''
14878 !! wikitext/edited
14879 ''ac''
14880 !! end
14881
14882 !! test
14883 1. Merge adjacent link nodes as long as at least one element is new
14884 !! options
14885 parsoid={
14886 "modes": ["html2wt"]
14887 }
14888 !! html/parsoid
14889 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
14890 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
14891 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
14892 !! wikitext
14893 [[Football]]
14894 [[Football]]
14895 [[Football|Foot]][[Football|ball]]
14896 !! end
14897
14898 !! test
14899 2. Merge adjacent link nodes and enable additional normalizations
14900 !! options
14901 parsoid={
14902 "modes": ["html2wt"]
14903 }
14904 !! html/parsoid
14905 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
14906 !! wikitext
14907 ''[[Football]]''
14908 !! end
14909
14910 !! test
14911 1. Move format tags outside of WikiLink
14912 !! options
14913 parsoid={
14914 "modes": ["html2wt"]
14915 }
14916 !! html/parsoid
14917 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
14918 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
14919 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
14920 !! wikitext
14921 ''[[Football]]''
14922 '''''[[Football]]'''''
14923 <u>'''''[[Football]]'''''</u>
14924 !! end
14925
14926 !! test
14927 2. Move format tags outside of WikiLink with mergable A tags
14928 !! options
14929 parsoid={
14930 "modes": ["html2wt"]
14931 }
14932 !! html/parsoid
14933 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
14934 !! wikitext
14935 '''''[[Football]]'''''
14936 !! end
14937
14938 !! test
14939 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
14940 !! options
14941 parsoid={
14942 "modes": ["html2wt"]
14943 }
14944 !! html/parsoid
14945 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
14946 !! wikitext
14947 <font color="red"><u>'''[[Foo]]'''</u></font>
14948 !! end
14949
14950 !! test
14951 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
14952 !! options
14953 parsoid={
14954 "modes": ["html2wt"]
14955 }
14956 !! html/parsoid
14957 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
14958 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
14959 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
14960 !! wikitext
14961 [[Foo|<font color="red">Foo</font>]]
14962 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
14963 [[Foo|<span class="Bar">Foo</span>]]
14964 !! end
14965
14966 !! test
14967 5. T194083 Regression test: Manual edit test to move format tags outside wikilinks
14968 !! options
14969 parsoid={
14970 "modes": ["selser"],
14971 "changes": [
14972 ["a", "html", "<i>Foo</i>"]
14973 ]
14974 }
14975 !! wikitext
14976 [[Foo]]
14977 !! wikitext/edited
14978 ''[[Foo]]''
14979 !! end
14980
14981 !! test
14982 6. Regression test: Manual edit test to ensure diff markers are not lost
14983 !! options
14984 parsoid={
14985 "modes": ["selser"],
14986 "changes": [
14987 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
14988 ]
14989 }
14990 !! wikitext
14991 ''Foo''
14992 !! wikitext/edited
14993 ''[[Foo]]''
14994 !! end
14995
14996 !! test
14997 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
14998 !! options
14999 parsoid={
15000 "modes": ["selser"],
15001 "changes": [
15002 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
15003 ]
15004 }
15005 !! wikitext
15006 <div>placeholder</div>
15007 !! wikitext/edited
15008 <div>placeholder</div>
15009 [[Foo]] , placeholder
15010 !! end
15011
15012 ## No sort-key or templated sort-key
15013 !! test
15014 T192913 Regression test: 1. html2wt of links should not trip on parser functions found in target
15015 !! options
15016 parsoid
15017 !! wikitext
15018 [[Category:Bugs-{{#if:blah|Regression|None}}]]
15019 [[Category:Bugs-{{#if:blah|Regression|None}}|{{#if:blah|2020|None}}-#fragment]]
15020 !! html/parsoid
15021 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/Category" href="./Category:Bugs-Regression" data-mw='{"attribs":[[{"txt":"href"},{"html":"Category:Bugs-&lt;span typeof=\"mw:Transclusion\" data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#if:blah\",\"function\":\"if\"},\"params\":{\"1\":{\"wt\":\"Regression\"},\"2\":{\"wt\":\"None\"}},\"i\":0}}]}&apos;>Regression&lt;/span>"}]]}'/>
15022 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/Category" href="./Category:Bugs-Regression#2020-%23fragment" data-mw='{"attribs":[[{"txt":"href"},{"html":"Category:Bugs-&lt;span typeof=\"mw:Transclusion\" data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#if:blah\",\"function\":\"if\"},\"params\":{\"1\":{\"wt\":\"Regression\"},\"2\":{\"wt\":\"None\"}},\"i\":0}}]}&apos;>Regression&lt;/span>"}],[{"txt":"mw:sortKey"},{"html":"&lt;span typeof=\"mw:Transclusion\" data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#if:blah\",\"function\":\"if\"},\"params\":{\"1\":{\"wt\":\"2020\"},\"2\":{\"wt\":\"None\"}},\"i\":0}}]}&apos;>2020&lt;/span>-#fragment"}]]}'/>
15023 !! end
15024
15025 ## Untemplated sort-key (wt2html data-mw is missing sort-key information!)
15026 !! test
15027 T192913 Regression test: 2. html2wt of links should not trip on parser functions found in target (2)
15028 !! options
15029 parsoid
15030 !! wikitext
15031 [[Category:Bugs-{{#if:blah|Regression|None}}|fragment]]
15032 [[Category:Bugs-{{#if:blah|Regression|None}}-{{#if:blah|2020|None}}|fragment]]
15033 !! html/parsoid
15034 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/Category" href="./Category:Bugs-Regression#fragment" data-mw='{"attribs":[[{"txt":"href"},{"html":"Category:Bugs-&lt;span typeof=\"mw:Transclusion\" data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#if:blah\",\"function\":\"if\"},\"params\":{\"1\":{\"wt\":\"Regression\"},\"2\":{\"wt\":\"None\"}},\"i\":0}}]}&apos;>Regression&lt;/span>"}]]}'/>
15035 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/Category" href="./Category:Bugs-Regression-2020#fragment" data-mw='{"attribs":[[{"txt":"href"},{"html":"Category:Bugs-&lt;span typeof=\"mw:Transclusion\" data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#if:blah\",\"function\":\"if\"},\"params\":{\"1\":{\"wt\":\"Regression\"},\"2\":{\"wt\":\"None\"}},\"i\":0}}]}&apos;>Regression&lt;/span>-&lt;span typeof=\"mw:Transclusion\" data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#if:blah\",\"function\":\"if\"},\"params\":{\"1\":{\"wt\":\"2020\"},\"2\":{\"wt\":\"None\"}},\"i\":0}}]}&apos;>2020&lt;/span>"}]]}'/>
15036 !! end
15037
15038 #------------------------------
15039 # End of tag minimization tests
15040 #------------------------------
15041
15042 !!test
15043 T56262: New entities
15044 !! options
15045 parsoid=html2wt
15046 !! html/parsoid
15047 <span typeof="mw:Entity">&nbsp;</span>
15048 !! wikitext
15049 &nbsp;
15050 !! end
15051
15052 !! test
15053 Consecutive <pre>s should not get merged
15054 !! options
15055 parsoid=html2wt,html2html
15056 !! html/parsoid
15057 <pre>a</pre><pre>b</pre>
15058
15059 <pre>c
15060 </pre><pre>
15061 d</pre>
15062
15063 <pre>e
15064
15065 </pre><pre>
15066
15067 f</pre>
15068 !! wikitext
15069 a
15070
15071 b
15072
15073 c
15074
15075 d
15076
15077 e
15078
15079
15080
15081 f
15082 !! end
15083
15084 !! test
15085 WTS of autolinks with trailing/surrounding context
15086 !! options
15087 parsoid=html2wt
15088 !! html/parsoid
15089 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
15090 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
15091 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
15092 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
15093 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
15094 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
15095 !! wikitext
15096 http://cscott.net'''foo'''
15097
15098 http://cscott.net<b>foo</b>
15099
15100 '''http://cscott.net'''
15101
15102 '''http://cscott.net '''
15103
15104 '''http://cscott.net<nowiki/>x'''
15105
15106 http://cscott.net<nowiki/>x
15107 !! end
15108
15109 !! test
15110 WTS of autolinks with nowikis (round-trip)
15111 !! wikitext
15112 x<nowiki/>http://cscott.net<nowiki/>x
15113 !! html/parsoid
15114 <p>x<a rel="mw:ExtLink" href="http://cscott.net" class="external free">http://cscott.net</a>x</p>
15115 !! end
15116
15117 # this is the "easy" test because it leaves in place all the
15118 # data-parsoid information indicating this is an autolink
15119 !! test
15120 WTS of autolinks with escapes (editing)
15121 !! options
15122 parsoid={
15123 "modes": ["wt2wt"],
15124 "changes": [
15125 [ "span", "remove" ]
15126 ]
15127 }
15128 !! wikitext
15129 x<nowiki/>http://cscott.net<nowiki/>x
15130 !! wikitext/edited
15131 x<nowiki/>http://cscott.net<nowiki/>x
15132 !! end
15133
15134 !! test
15135 WTS of edited autolink-like text (T103364)
15136 !! options
15137 parsoid={
15138 "modes": ["wt2wt"],
15139 "changes": [
15140 [ "span[typeof]", "removeAttr", "typeof" ]
15141 ]
15142 }
15143 !! wikitext
15144 Not a link: <nowiki>http://example.com</nowiki>.
15145 !! wikitext/edited
15146 Not a link: <span><nowiki>http://example.com</nowiki></span>.
15147 !! end
15148
15149 !! test
15150 WTS of newly-authored autolink-like text (T103364)
15151 !! options
15152 parsoid=html2wt
15153 !! html/parsoid
15154 <p>http://example.com is not a link.</p>
15155 !! wikitext
15156 <nowiki>http://example.com</nowiki> is not a link.
15157 !! end
15158
15159 !! test
15160 WTS of autolink-like text after an autolink (T108563)
15161 !! options
15162 parsoid=html2wt
15163 !! html/parsoid
15164 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
15165 !! wikitext
15166 http://example.com <nowiki>http://example.com</nowiki> is not a link.
15167 !! end
15168
15169 !! test
15170 WTS of an autolink surrounded by square brackets (T220018)
15171 !! options
15172 parsoid=html2wt
15173 !! html/parsoid
15174 <p>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]</p>
15175 !! wikitext
15176 <nowiki>[</nowiki>http://example.com]
15177 !! end
15178
15179 !! test
15180 WTS of edited autolink surrounded by square brackets (T220018)
15181 !! options
15182 parsoid={
15183 "modes": ["wt2wt"],
15184 "changes": [
15185 [ "a", "before", "[" ],
15186 [ "a", "after", "]" ]
15187 ]
15188 }
15189 !! wikitext
15190 http://example.com
15191 !! wikitext/edited
15192 <nowiki>[</nowiki>http://example.com]
15193 !! end
15194
15195 !! test
15196 WTS of an external link surrounded by square brackets (T220018)
15197 !! options
15198 parsoid=html2wt
15199 !! html/parsoid
15200 <p>[<a rel="mw:ExtLink" href="http://example.com">foo</a>]</p>
15201 !! wikitext
15202 <nowiki>[</nowiki>[http://example.com foo]]
15203 !! end
15204
15205 !! test
15206 WTS of edited external link surrounded by square brackets (T220018)
15207 !! options
15208 parsoid={
15209 "modes": ["wt2wt"],
15210 "changes": [
15211 [ "a", "before", "[" ],
15212 [ "a", "after", "]" ]
15213 ]
15214 }
15215 !! wikitext
15216 [http://example.com foo]
15217 !! wikitext/edited
15218 <nowiki>[</nowiki>[http://example.com foo]]
15219 !! end
15220
15221 !! test
15222 Edited Redirect link should emit a non-piped wikitext link
15223 !! options
15224 parsoid=html2wt
15225 !! html/parsoid
15226 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
15227 !! wikitext
15228 #REDIRECT [[Bar]]
15229 !! end
15230
15231 !! test
15232 T75121: Infer extension name from typeOf if data-mw is not present
15233 !! options
15234 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
15235 !! html/parsoid
15236 <div typeOf="mw:Extension/foo"></div>
15237 !! wikitext
15238 <foo />
15239 !! end
15240
15241 # Note that the <p> wrapping isn't present in PHP parser output
15242 # The important thing for this test is that P-wrapping doesn't
15243 # interfere with the <nowiki> protection for leading - in <td>
15244 # (which isn't necessary for <th>).
15245 !! test
15246 T88318: p-wrapped dash in table.
15247 !! options
15248 parsoid=html2wt,wt2wt
15249 !! html/parsoid
15250 <table><tbody>
15251 <tr><th><p>-</p></th><th><p>- </p></th></tr>
15252 <tr><td><p>-</p></td><td><p>- </p></td></tr>
15253 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
15254 </tbody></table>
15255 !! wikitext
15256 {|
15257 !-
15258 !-
15259 |-
15260 |<nowiki>-</nowiki>
15261 |<nowiki>- </nowiki>
15262 |-
15263 |<small>-</small>
15264 |<br />
15265 -
15266 |<br />-
15267 |}
15268 !! html/php
15269 <table>
15270 <tbody><tr>
15271 <th>-
15272 </th>
15273 <th>-
15274 </th></tr>
15275 <tr>
15276 <td>-
15277 </td>
15278 <td>-
15279 </td></tr>
15280 <tr>
15281 <td><small>-</small>
15282 </td>
15283 <td><br />
15284 <p>-
15285 </p>
15286 </td>
15287 <td><br />-
15288 </td></tr></tbody></table>
15289 !! end
15290
15291 !! test
15292 T149209: WTS: Handle newlines in table cells properly
15293 !! options
15294 parsoid=html2wt
15295 !! html/parsoid
15296 <table>
15297 <tbody>
15298 <tr><td>a
15299 b
15300 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
15301 <tr><td><p>x</p>
15302 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
15303 </tbody></table>
15304 <table>
15305 <tbody>
15306 <tr><th>a
15307 b
15308 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
15309 <tr><th><p>x</h>
15310 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
15311 </tbody></table>
15312 !! wikitext
15313 {|
15314 |a
15315 b
15316 |c
15317 |-
15318 |x
15319 {{!}}y
15320 |}
15321 {|
15322 !a
15323 b
15324 !c
15325 |-
15326 !x
15327 !y
15328 |}
15329 !! end
15330
15331 !! test
15332 T149209: Selser: Handle newlines in table cells properly
15333 !! options
15334 parsoid={
15335 "modes": ["selser"],
15336 "changes": [
15337 [ "#h1", "html", "a\nb\n" ],
15338 [ "#h2", "html", "a\nb\n" ],
15339 [ "#c1", "html", "a\nb\n" ],
15340 [ "#c2", "html", "<p>a</p>" ],
15341 [ "#c3", "html", "<p>a</p>" ],
15342 [ "#c4", "html", "edit-me<p>a</p>" ]
15343 ]
15344 }
15345 !! wikitext
15346 {|
15347 ! id="h1" |edit-me!!1
15348 |-
15349 ! id="h2" |edit-me||2
15350 |-
15351 | id="c1" |edit-me||3
15352 |-
15353 | id="c2" |edit-me||4
15354 |-
15355 | id="c3" |edit-me||p||q||r
15356 |-
15357 | id="c4" |edit-me||p||q||r
15358 |}
15359 !! wikitext/edited
15360 {|
15361 ! id="h1" |a
15362 b
15363 !1
15364 |-
15365 ! id="h2" |a
15366 b
15367 !2
15368 |-
15369 | id="c1" |a
15370 b
15371 |3
15372 |-
15373 | id="c2" |a
15374 |4
15375 |-
15376 | id="c3" |a
15377 |p||q||r
15378 |-
15379 | id="c4" |edit-me
15380 a
15381 |p||q||r
15382 |}
15383 !! end
15384
15385 !! test
15386 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
15387 !! options
15388 parsoid=html2wt
15389 !! html/parsoid
15390 <table id='mwAb'>
15391 <td id='mwAc'>foo</td>
15392 <td id='serialize-this'>bar</td>
15393 </table>
15394 !! wikitext
15395 {|
15396 |foo
15397 | id="serialize-this" |bar
15398 |}
15399 !! end
15400
15401 !! test
15402 Parsoid-like element ids should not be serialized to wikitext unless shadowed
15403 !! options
15404 parsoid=html2wt
15405 !! html/parsoid
15406 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
15407 !! wikitext
15408 <div id="hello">ok</div>
15409 !! end
15410
15411 !!test
15412 Testing serialization after deletion of table cells
15413 !!options
15414 parsoid={
15415 "modes": ["wt2wt", "selser"],
15416 "changes": [
15417 ["#x", "remove"]
15418 ]
15419 }
15420 !!wikitext
15421 {|
15422 !h1 !!h2 !!h3
15423 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
15424 |}
15425 !! wikitext/edited
15426 {|
15427 !h1!!h2!!h3
15428 |c2|||c3
15429 |}
15430 !!end
15431
15432 !! test
15433 Testing selser after addition of new row before first row (T125419)
15434 !! options
15435 parsoid={
15436 "modes": ["wt2wt", "selser"],
15437 "changes": [
15438 [ "tr", "before", "<tr><td>X</td></tr>" ]
15439 ]
15440 }
15441 !! wikitext
15442 {|
15443 |a
15444 |}
15445 !! wikitext/edited
15446 {|
15447 |X
15448 |-
15449 |a
15450 |}
15451 !! end
15452
15453 !! test
15454 Serialize new table rows in a HTML table using HTML tags
15455 !! options
15456 parsoid={
15457 "modes": ["wt2wt", "selser"],
15458 "changes": [
15459 [ "tr", "before", "<tr><td>X</td></tr>" ]
15460 ]
15461 }
15462 !! wikitext
15463 <table><tr><td>a</td></tr></table>
15464 !! wikitext/edited
15465 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
15466 !! end
15467
15468 !! test
15469 Serialize new table cells in a HTML row using HTML tags
15470 !! options
15471 parsoid={
15472 "modes": ["wt2wt", "selser"],
15473 "changes": [
15474 [ "td", "before", "<td>X</td>" ]
15475 ]
15476 }
15477 !! wikitext
15478 <table><tr><td>a</td></tr></table>
15479 !! wikitext/edited
15480 <table><tr><td>X</td><td>a</td></tr></table>
15481 !! end
15482
15483 !! test
15484 Serialize wikitext list items as HTML list items when embedded in a HTML list
15485 !! options
15486 parsoid=html2wt
15487 !! html/parsoid
15488 <ul data-parsoid='{"stx": "html"}'>
15489 <li data-parsoid='{}'>a</li>
15490 <li>b</li>
15491 </ul>
15492 !! wikitext
15493 <ul>
15494 <li>a</li>
15495 <li>b</li>
15496 </ul>
15497 !! html/php
15498 <ul>
15499 <li>a</li>
15500 <li>b</li>
15501 </ul>
15502 !! end
15503
15504 # Nested list should be inside <li>, that is
15505 # <ul><li>foo<ul>..</ul></li></ul> instead of
15506 # <ul><li>foo</li><ul>..</ul></ul>
15507 # See https://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list
15508 !! test
15509 Wikitext lists can be nested inside HTML lists
15510 !! options
15511 parsoid=html2wt
15512 !! html/parsoid
15513 <ul data-parsoid='{"stx": "html"}'>
15514 <li data-parsoid='{"stx": "html"}'>a
15515 <ul><li>b</li></ul>
15516 </li>
15517 </ul>
15518
15519 <ul data-parsoid='{"stx": "html"}'>
15520 <li>x
15521 <ul><li>y</li></ul>
15522 </li>
15523 </ul>
15524 !! wikitext
15525 <ul>
15526 <li>a
15527 * b
15528 </li>
15529 </ul>
15530
15531 <ul>
15532 <li>x
15533 * y
15534 </li>
15535 </ul>
15536 !! html/php
15537 <ul>
15538 <li>a
15539 <ul><li>b</li></ul>
15540 </li>
15541 </ul>
15542 <ul>
15543 <li>x
15544 <ul><li>y</li></ul>
15545 </li>
15546 </ul>
15547 !! end
15548
15549 !! test
15550 WTS change modes
15551 !! options
15552 parsoid={
15553 "modes": ["wt2wt"],
15554 "changes": [
15555 [ "#xyz", "before", "<b>before</b> stuff " ],
15556 [ "#xyz", "after", " stuff <i>after</i>" ],
15557 [ "#xyz", "html", "x <b>y</b> z" ]
15558 ]
15559 }
15560 !! wikitext
15561 <span id="xyz">hello</span>
15562 !! wikitext/edited
15563 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
15564 !! end
15565
15566 !! test
15567 Never serialize a-tag as html, regardless of what data-parsoid has to say
15568 !! options
15569 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
15570 !! html/parsoid
15571 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
15572 !! wikitext
15573 [[Foo]]
15574 !! end
15575
15576 ## SSS FIXME: This is broken output nevertheless.
15577 ## What might be a reasonable non-broken output for this?
15578 ## This is an edge case unlikely to be seen in production
15579 ## that I am not wasting more time on this right now.
15580 !! test
15581 Never serialize a-tag as html, no matter what attributes it has
15582 !! options
15583 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
15584 !! html/parsoid
15585 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
15586 !! wikitext
15587 [http://boo.org http://boohoo.org]
15588 !! end
15589
15590 # Misnested is an indication that selser can reuse the source but these have
15591 # shown to sneak through on occasion. See T101768.
15592 # The original wikitext here is: [http://test.com [[one]] two three]
15593 !! test
15594 Strip span tags added to mark misnested links
15595 !! options
15596 parsoid=html2wt
15597 !! html/parsoid
15598 <p data-parsoid='{}'><a rel="mw:ExtLink" href="http://test.com"></a><a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"simple","a":{"href":"./One"},"sa":{"href":"one"},"misnested":true}'>one</a><span data-parsoid='{"misnested":true}'> two three</span></p>
15599 !! wikitext
15600 [http://test.com][[one]] two three
15601 !! end
15602
15603 !! test
15604 Catch regression when unpacking misnested links
15605 !! options
15606 parsoid=wt2html
15607 !! wikitext
15608 {{1x|hi}}[http://example.com [[ho]]]
15609 !! html/parsoid
15610 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span><a rel="mw:ExtLink nofollow" href="http://example.com" class="external autonumber"></a><a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"stx":"simple","a":{"href":"./Ho"},"sa":{"href":"ho"},"misnested":true}'>ho</a></p>
15611 !! end
15612
15613 !! test
15614 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
15615 !! options
15616 parsoid=html2wt
15617 !! html/parsoid
15618 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span><table about="#mwt2" typeof="mw:Transclusion mw:ExpandedAttrs" data-parsoid='{"a":{"{{1x|c\n{{!}}d\n}}":null},"sa":{"{{1x|c\n{{!}}d\n}}":""},"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"c\n{{!}}d\n"}},"i":0}},"\n|}"]}'>
15619 <tbody><tr><td>d
15620 </td></tr>
15621 </tbody></table>
15622 !! wikitext
15623 {{1x|a}}
15624 {|{{1x|c
15625 {{!}}d
15626 }}
15627 |}
15628 !! end
15629
15630 ## This test verifies the presence and computation of this attribute indirectly
15631 ## by making an edit and ensuring that the serialization is correct (which it would be
15632 ## only if firstWikitextNode is properly set).
15633 !! test
15634 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
15635 !! options
15636 parsoid= {
15637 "modes": ["wt2wt"],
15638 "changes": [
15639 [ "div#x", "remove" ],
15640 [ "div", "before", "<div>new</div>" ]
15641 ]
15642 }
15643 !! wikitext
15644 <div id="x">foo</div>
15645 {|
15646 {{1x|<div>boo</div>
15647 {{!}}b}}
15648 |c
15649 |}
15650 !! wikitext/edited
15651
15652 <div>new</div>
15653 {|
15654 {{1x|<div>boo</div>
15655 {{!}}b}}
15656 |c
15657 |}
15658 !! end
15659
15660 # --------------------------------------------
15661 # Tests spec'ing wikitext serialization norms |
15662 # --------------------------------------------
15663
15664 !! test
15665 Serialize multi-line indent-pre starting with wikitext syntax
15666 !! options
15667 parsoid=html2wt
15668 !! html/parsoid
15669 <pre>* 1
15670 ** 2
15671 * 3</pre>
15672 !! wikitext
15673 * 1
15674 ** 2
15675 * 3
15676 !! end
15677
15678 !! test
15679 1. Categories should always be serialized on their own line
15680 !! options
15681 parsoid=html2wt
15682 !! html/parsoid
15683 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
15684 !! wikitext
15685 foo
15686 [[Category:Foo]]
15687 bar
15688 !! end
15689
15690 !! test
15691 2. Categories that are part of templates should not introduce a line break
15692 !! wikitext
15693 foo {{1x|<span>bar</span> [[Category:baz]]}} bar
15694 !! html/parsoid
15695 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;span>bar&lt;/span> [[Category:baz]]"}},"i":0}}]}'>bar</span><span about="#mwt1"> </span><link rel="mw:PageProp/Category" href="./Category:Baz" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:baz"}}'/> bar</p>
15696 !! end
15697
15698 # Careful while editing these next 2 tests. There are \u200f characters
15699 # before and after the <link> tags in the HTML and following some
15700 # of the categories in wikitext
15701 # Do not remove these characters in edits.
15702 #
15703 # As part of the serialization, these bidi characters will get stripped.
15704 !! test
15705 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
15706 !! options
15707 parsoid={
15708 "modes": ["html2wt"]
15709 }
15710 !! html/parsoid
15711 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
15712 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
15713 !! wikitext
15714 [[קטגוריה:טקסים]]
15715 [[קטגוריה: שיטות משפט]]
15716 !! end
15717
15718 !! test
15719 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
15720 !! options
15721 parsoid={
15722 "modes": ["html2wt"]
15723 }
15724 !! html/parsoid
15725 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
15726 !! wikitext
15727 [[קטגוריה:טקסים]]
15728 ‏y
15729 !! end
15730
15731 !! test
15732 Lists: Add space after bullets
15733 !! options
15734 parsoid=html2wt
15735 !! html/parsoid
15736 <ul>
15737 <li>foo</li>
15738 <li> bar</li>
15739 <li><span> baz</span></li>
15740 </ul>
15741 !! wikitext
15742 * foo
15743 * bar
15744 * <span> baz</span>
15745 !! end
15746
15747 !! test
15748 1. Headings: Add space before/after == (T53744)
15749 !! options
15750 parsoid=html2wt
15751 !! html/parsoid
15752 <h2>foo</h2>
15753 <h2> bar</h2>
15754 <h2>baz </h2>
15755 <h2><span> baz</span></h2>
15756 !! wikitext
15757 == foo ==
15758
15759 == bar ==
15760
15761 == baz ==
15762
15763 == <span> baz</span> ==
15764 !! end
15765
15766 !! test
15767 2. Headings: Add space before/after == even after hoisted content
15768 !! options
15769 parsoid={
15770 "modes": ["html2wt"]
15771 }
15772 !! html/parsoid
15773 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
15774 !! wikitext
15775 [[Category:A2]]
15776
15777 == ok ==
15778 !! end
15779
15780 !! test
15781 1. Headings: suppress newly created empty headings
15782 !! options
15783 parsoid={
15784 "modes": ["html2wt"]
15785 }
15786 !! html/parsoid
15787 <h2></h2>
15788 !! wikitext
15789 !! end
15790
15791 !! test
15792 2. Headings: suppress empty headings on edits
15793 !! options
15794 parsoid={
15795 "modes": ["selser"],
15796 "changes": [
15797 [ "#x", "remove"]
15798 ]
15799 }
15800 !! wikitext
15801 ==<span id="x">foo</span>==
15802 !! wikitext/edited
15803 !! end
15804
15805 !! test
15806 Headings: Replace <br/> with a single whitespace char
15807 !! options
15808 parsoid={
15809 "modes": ["html2wt"]
15810 }
15811 !! html/parsoid
15812 <h2>foo<br/>bar</h2>
15813 <h2>foo <span><br/>bar</span> baz</h2>
15814 !! wikitext
15815 == foo bar ==
15816
15817 == foo <span> bar</span> baz ==
15818 !! end
15819
15820 !! test
15821 1. WT Quote Tags: suppress newly created empty style tags
15822 !! options
15823 parsoid={
15824 "modes": ["html2wt"]
15825 }
15826 !! html/parsoid
15827 <i></i><b></b>
15828 !! wikitext
15829 !! end
15830
15831 !! test
15832 2. WT Quote Tags: suppress empty style tags on edits
15833 !! options
15834 parsoid={
15835 "modes": ["selser"],
15836 "changes": [
15837 [ "#x", "remove"]
15838 ]
15839 }
15840 !! wikitext
15841 '''<span id="x">foo</span>'''
15842 !! wikitext/edited
15843 !! end
15844
15845 !! test
15846 1. Anchors: suppress newly created empty anchors
15847 !! options
15848 parsoid={
15849 "modes": ["html2wt"]
15850 }
15851 !! html/parsoid
15852 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
15853 !! wikitext
15854 !! end
15855
15856 !! test
15857 2. Anchors: suppress empty anchors on edits
15858 !! options
15859 parsoid={
15860 "modes": ["selser"],
15861 "changes": [
15862 [ "#x", "remove"]
15863 ]
15864 }
15865 !! wikitext
15866 [[Test|<span id="x">foo</span>]]
15867 !! wikitext/edited
15868 !! end
15869
15870 !! test
15871 3a. Anchors: do not suppress numbered extlinks
15872 !! options
15873 parsoid={
15874 "modes": ["wt2wt"]
15875 }
15876 !! wikitext
15877 [http://foo.com]
15878 !! html/parsoid
15879 <a rel="mw:ExtLink" href="http://foo.com"></a>
15880 !! end
15881
15882 !! test
15883 3b. Anchors: do not suppress numbered extlinks
15884 !! options
15885 parsoid={
15886 "modes": ["wt2wt"],
15887 "changes": [
15888 [ "#x", "remove"]
15889 ]
15890 }
15891 !! wikitext
15892 [http://foo.com <span id="x">foo</span>]
15893 !! wikitext/edited
15894 [http://foo.com]
15895 !! end
15896
15897 !!test
15898 Normalizations should be restricted to edited content
15899 !!options
15900 parsoid={
15901 "modes": ["selser"],
15902 "changes": [
15903 [ "h1", "before", "<i></i>"]
15904 ]
15905 }
15906 !!wikitext
15907 a
15908 = =
15909 b
15910 !!wikitext/edited
15911 a
15912 = =
15913 b
15914 !!end
15915
15916 !! test
15917 1. Multiple normalizations (html2wt)
15918 !! options
15919 parsoid={
15920 "modes": ["html2wt"]
15921 }
15922 !! html/parsoid
15923 <h2><i></i></h2>
15924 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
15925 </a><b><i></i></b>x</p>
15926 !! wikitext
15927
15928 [[foo]]
15929 x
15930 !! end
15931
15932 !! test
15933 2. Multiple normalizations (selser)
15934 !! options
15935 parsoid={
15936 "modes": ["selser"],
15937 "changes": [
15938 [ "#x", "after", "<h1><i></i></h1>\n<p> bar<b></b></p>"]
15939 ]
15940 }
15941 !! wikitext
15942 <div id="x">foo</div>
15943 !! wikitext/edited
15944 <div id="x">foo</div>
15945 bar
15946 !! end
15947
15948 !! test
15949 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
15950 !! options
15951 parsoid={
15952 "modes": ["html2wt"]
15953 }
15954 !! html/parsoid
15955 <p> hi</p>
15956 <p> hello</p>
15957 !! wikitext
15958 hi
15959
15960 hello
15961 !! end
15962
15963 !! test
15964 2. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
15965 !! options
15966 parsoid={
15967 "modes": ["html2wt"]
15968 }
15969 !! html/parsoid
15970 <p>Foo
15971 bar
15972 baz</p>
15973
15974 <table><tr><td>Foo
15975 bar
15976 baz bang</td></tr></table>
15977
15978 <p><!--boo--> foo
15979 bar</p>
15980
15981 <p> foo
15982 bar<span>boo</span></p>
15983 !! wikitext
15984 Foo
15985 bar
15986 baz
15987
15988 {|
15989 |Foo
15990 bar
15991 baz bang
15992 |}
15993
15994 <!--boo-->foo
15995 bar
15996
15997 foo
15998 bar<span>boo</span>
15999 !! end
16000
16001 !! test
16002 3. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
16003 !! options
16004 parsoid={
16005 "modes": ["selser"],
16006 "changes": [
16007 [ "p", "html", " a\n b" ]
16008 ]
16009 }
16010 !! wikitext
16011 xyz
16012 !! wikitext/edited
16013 a
16014 b
16015 !! end
16016
16017 !! test
16018 New links that end in spaces
16019 !! options
16020 parsoid={
16021 "modes": ["html2wt"]
16022 }
16023 !! html/parsoid
16024 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
16025 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
16026 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
16027 !! wikitext
16028 [[Berlin]] is the capital of Germany.
16029
16030 [[Foo]] '''bar'''
16031
16032 [[Boston]] is a city.
16033 !! end
16034
16035 !! test
16036 1. Table cells with escapable prefixes
16037 !! options
16038 parsoid={
16039 "modes": ["html2wt"]
16040 }
16041 !! html/parsoid
16042 <table>
16043 <tr><td>a</td></tr>
16044 <tr><td>-</td></tr>
16045 <tr><td>+</td></tr>
16046 <tr><td>}</td></tr>
16047 </table>
16048 !! wikitext
16049 {|
16050 |a
16051 |-
16052 | -
16053 |-
16054 | +
16055 |-
16056 | }
16057 |}
16058 !! end
16059
16060 !! test
16061 2a. Table cells with escapable prefixes after edits
16062 !! options
16063 parsoid={
16064 "modes": ["selser"],
16065 "changes": [
16066 [ "table tbody tr:first-child td:first-child", "remove"]
16067 ]
16068 }
16069 !! wikitext
16070 {|
16071 |a||-
16072 |}
16073 !! wikitext/edited
16074 {|
16075 | -
16076 |}
16077 !! end
16078
16079 !! test
16080 2b. Table cells with escapable prefixes after edits
16081 !! options
16082 parsoid={
16083 "modes": ["selser"],
16084 "changes": [
16085 [ "table tbody tr:first-child td:first-child", "html", "-" ],
16086 [ "#x", "remove" ]
16087 ]
16088 }
16089 !! wikitext
16090 {|
16091 |pqr
16092 |<span id="x">foo</span>+
16093 |}
16094 !! wikitext/edited
16095 {|
16096 | -
16097 | +
16098 |}
16099 !! end
16100
16101 # FIXME: This test will fail because
16102 # normalization doesn't realize that the id attribute
16103 # will eliminate the escapable scenario
16104 !! test
16105 3a. Table cells without escapable prefixes after edits
16106 !! options
16107 parsoid={
16108 "modes": ["selser"],
16109 "changes": [
16110 [ "#x", "html", "-" ]
16111 ]
16112 }
16113 !! wikitext
16114 {|
16115 | id="x" |abcd
16116 |}
16117 !! wikitext/edited
16118 {|
16119 | id="x" |-
16120 |}
16121 !! end
16122
16123 ## This tests normalizer's ability to discriminate between
16124 ## cells having identical content.
16125 !! test
16126 3b. Table cells without escapable prefixes after edits
16127 !! options
16128 parsoid={
16129 "modes": ["selser"],
16130 "changes": [
16131 [ "td", "html", "-" ]
16132 ]
16133 }
16134 !! wikitext
16135 {|
16136 |a||b
16137 |}
16138 !! wikitext/edited
16139 {|
16140 | -||-
16141 |}
16142 !! end
16143
16144 ## This tests normalizer's ability to not be tripped by
16145 ## comments (and whitespace)
16146 !! test
16147 3c. Table cells without escapable prefixes after edits
16148 !! options
16149 parsoid={
16150 "modes": ["selser"],
16151 "changes": [
16152 [ "table tbody tr td:first-child", "remove" ]
16153 ]
16154 }
16155 !! wikitext
16156 {|
16157 |-
16158 <!--foo--> |a||-
16159 |}
16160 !! wikitext/edited
16161 {|
16162 |-
16163 <!--foo--> | -
16164 |}
16165 !! end
16166
16167 ## This tests normalizer's ability to handle HTML cells
16168 !! test
16169 3d. Table cells without escapable prefixes after edits
16170 !! options
16171 parsoid={
16172 "modes": ["selser"],
16173 "changes": [
16174 [ "td", "html", "-" ]
16175 ]
16176 }
16177 !! wikitext
16178 <table>
16179 <tr><td>a</td></tr>
16180 </table>
16181 !! wikitext/edited
16182 <table>
16183 <tr><td>-</td></tr>
16184 </table>
16185 !! end
16186
16187 ## T111151 Remove font elements without attributes
16188 !! test
16189 4. font tags without attributes should be dropped
16190 !! options
16191 parsoid={
16192 "modes": ["html2wt"]
16193 }
16194 !! html/parsoid
16195 <font>foo</font>
16196 <font><font>bar</font></font>
16197 <font class="x">boo</font>
16198 !! wikitext
16199 foo
16200 bar
16201 <font class="x">boo</font>
16202 !! end
16203
16204 !! test
16205 Normalize empty paragraphs to HTML form that html2wt expects
16206 !! options
16207 parsoid={
16208 "modes": ["html2wt"]
16209 }
16210 !! html/parsoid
16211 <div>1</div>
16212 <p>a</p><p></p><p>b</p>
16213 <div>2</div>
16214 <p>a</p>
16215 <p></p>
16216 <p>b</p>
16217 <div>3</div>
16218 <p>a</p>
16219 <p></p>
16220 <p></p>
16221 <p></p>
16222 <p></p>
16223 <p>b</p>
16224 <div>4</div>
16225 <p>a</p>
16226 <p></p>
16227 <div>foo</div>
16228 !! wikitext
16229 <div>1</div>
16230 a
16231
16232
16233 b
16234 <div>2</div>
16235 a
16236
16237
16238 b
16239 <div>3</div>
16240 a
16241
16242
16243
16244
16245
16246 b
16247 <div>4</div>
16248 a
16249
16250 <div>foo</div>
16251 !! html/php
16252 <div>1</div>
16253 <p>a
16254 </p><p><br />
16255 b
16256 </p>
16257 <div>2</div>
16258 <p>a
16259 </p><p><br />
16260 b
16261 </p>
16262 <div>3</div>
16263 <p>a
16264 </p><p><br />
16265 </p><p><br />
16266 </p><p>b
16267 </p>
16268 <div>4</div>
16269 <p>a
16270 </p>
16271 <div>foo</div>
16272 !! end
16273
16274 !! test
16275 Templated content should be skipped over by normalization
16276 !! options
16277 parsoid={
16278 "modes": ["html2wt"]
16279 }
16280 !! html/parsoid
16281 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SomeTemplate1","href":"./Template:SomeTemplate1"},"params":{"1":{"wt":"boo"}},"i":0}}]}'>foobar</p><p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SomeTemplate2","href":"./Template:SomeTemplate2"},"params":{"1":{"wt":"booboo"}},"i":0}}]}'>foobar</p><span about="#mwt2">
16282 </span><p about="#mwt2"></p><span about="#mwt2">
16283 </span>
16284 !! wikitext
16285 {{SomeTemplate1|boo}}{{SomeTemplate2|booboo}}
16286 !! end
16287
16288 !! test
16289 Escape DOM elements
16290 !! options
16291 parsoid=html2wt
16292 !! html/parsoid
16293 <nowiki><i>foo</i></nowiki>
16294 <noinclude><i>foo</i></noinclude>
16295 <includeonly><i>foo</i></includeonly>
16296 !! wikitext
16297 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
16298 &lt;noinclude&gt;''foo''&lt;/noinclude&gt;
16299 &lt;includeonly&gt;''foo''&lt;/includeonly&gt;
16300 !! end
16301
16302 !! test
16303 Don't escape pre elements that fail to parse as extension tags
16304 !! wikitext
16305 <pre>closed is extension tag, so everything is <span>text</span></pre>
16306 <pre>unclosed is not, so these are <span>tags</span>
16307 !! html/php
16308 <pre>closed is extension tag, so everything is &lt;span&gt;text&lt;/span&gt;</pre>
16309 <pre>unclosed is not, so these are <span>tags</span></pre>
16310 !! html/parsoid
16311 <pre typeof="mw:Extension/pre" about="#mwt3" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"closed is extension tag, so everything is &lt;span>text&lt;/span>"}}'>closed is extension tag, so everything is &lt;span>text&lt;/span></pre>
16312 <pre data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unclosed is not, so these are <span>tags</span></pre>
16313 !! end
16314
16315 !! test
16316 New list is serialized on newlines
16317 !! options
16318 parsoid=html2wt
16319 !! html/parsoid
16320 <p>The quick brown fox jumps over the lazy dog.</p><ul>
16321 <li>Yesterday</li>
16322 <li>Today</li>
16323 <li>Tomorrow</li>
16324 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
16325 !! wikitext
16326 The quick brown fox jumps over the lazy dog.
16327
16328 * Yesterday
16329 * Today
16330 * Tomorrow
16331
16332 The quick onyx goblin jumps over the lazy dwarf.
16333 !! end
16334
16335 !! test
16336 New lists in formatting elements serialized w/o newlines
16337 !! options
16338 parsoid=html2wt
16339 !! html/parsoid
16340 <small>
16341
16342 <ul>
16343 <li>123</li>
16344 </ul>
16345
16346 </small>
16347
16348 <small><ul><li>hi</li></ul></small>
16349 !! wikitext
16350 <small>
16351 * 123
16352 </small>
16353
16354 <small>
16355 * hi
16356 </small>
16357 !! end
16358
16359 !! test
16360 New list in table doesn't need newlines
16361 !! options
16362 parsoid=html2wt
16363 !! html/parsoid
16364 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
16365 !! wikitext
16366 {|
16367 |
16368 * test
16369 * 123
16370 |}
16371 !! end
16372
16373 !! test
16374 Newly inserted noinclude tags do not need newlines before/after
16375 !! html/parsoid
16376 <p>a<meta typeof="mw:Includes/NoInclude">b<meta typeof="mw:Includes/NoInclude/End">c</p>
16377 !! wikitext
16378 a<noinclude>b</noinclude>c
16379 !! end
16380
16381 # ---------------------------------------------------
16382 # End of tests spec'ing wikitext serialization norms |
16383 # ---------------------------------------------------
16384
16385 # T104032
16386 !! test
16387 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
16388 !! options
16389 parsoid=html2wt
16390 !! html/parsoid
16391 a<p>b</p>
16392 <b>c</b><p>d</p>
16393 <table><tr>
16394 <td>a<p>b</p></td>
16395 <td><b>c</b><p>d</p></td>
16396 </tr></table>
16397 !! wikitext
16398 a
16399
16400 b
16401
16402 '''c'''
16403
16404 d
16405 {|
16406 |a
16407 b
16408 |'''c'''
16409 d
16410 |}
16411 !! end
16412
16413 !! test
16414 Anchor without href scenarios
16415 !! options
16416 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
16417 !! html/parsoid
16418 <a class="bc"></a>
16419 <a class="no">dice</a>
16420 <a name="foo"></a>
16421 !! wikitext
16422
16423 dice
16424 <span name="foo"></span>
16425 !! end
16426
16427 !! test
16428 New transclusion added after a list should be serialized after the list
16429 !! options
16430 parsoid=html2wt
16431 !! html/parsoid
16432 <ul><li>a</li></ul><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>
16433 !! wikitext
16434 * a
16435 {{1x|foo}}
16436 !! end
16437
16438 ## FIXME: This test is less useful now that the leading space is normalized away
16439 !! test
16440 Only html p-tag is strong indent pre suppressing
16441 !! options
16442 parsoid=html2wt
16443 !! html/parsoid
16444 <p>test2<span>
16445 test3
16446 </span></p>
16447 !! wikitext
16448 test2<span>
16449 test3
16450 </span>
16451 !! end
16452
16453 # Clients like VE don't know about this property (T238721)
16454 !! test
16455 T238721: New transclusion without the "i" property for a template part should be handled properly
16456 !! options
16457 parsoid=html2wt
16458 !! html/parsoid
16459 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"}}}]}'>foo</span>
16460 !! wikitext
16461 {{1x}}
16462 !! end
16463
16464 # -----------------------------------------------------------------
16465 # End of section for Parsoid-only html2wt tests for serialization
16466 # of new content
16467 # -----------------------------------------------------------------
16468
16469 # -----------------------------------------------------------------
16470 # The following section of tests are primarily to spec behavior of
16471 # the selective serializer. All these tests have manual selser
16472 # changes. The automated selser changes for all tests handle the
16473 # wide variation of changes, but these tests here capture specs
16474 # deterministically.
16475 # ----------------------------------------------------------------
16476
16477 ## T90517
16478 !! test
16479 Selser: New comments should not be lost
16480 !! options
16481 parsoid={
16482 "modes": ["selser"],
16483 "changes": [
16484 [ "#a", "after", "<!--c1-->" ],
16485 [ "#b", "before", "<!--c2-->" ]
16486 ]
16487 }
16488 !! wikitext
16489 <span id="a">a</span>
16490
16491 <span id="b">b</span>
16492 !! wikitext/edited
16493 <span id="a">a</span><!--c1-->
16494
16495 <!--c2--><span id="b">b</span>
16496 !! end
16497
16498 ## T89383
16499 !! test
16500 Selser: Check for validity of DSR before using it
16501 !! options
16502 parsoid={
16503 "modes": ["selser"],
16504 "changes": [
16505 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
16506 ]
16507 }
16508 !! wikitext
16509 <span id="a">a</span>
16510 !! wikitext/edited
16511 {{DISPLAYTITLE:foo}}
16512 <span id="a">a</span>
16513 !! end
16514
16515 !! test
16516 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
16517 !! options
16518 parsoid={
16519 "modes": ["selser"],
16520 "changes": [
16521 [ "div:first-child", "text", "bar" ]
16522 ]
16523 }
16524 !! wikitext
16525 <div style="{{1x|color:red;}}%">foo</div>
16526 !! wikitext/edited
16527 <div style="{{1x|color:red;}}%">bar</div>
16528 !! end
16529
16530 !! test
16531 Empty LI (T49673)
16532 !! wikitext
16533 *a
16534 *
16535 *
16536 *b
16537 !! html
16538 <ul><li>a</li>
16539 <li class="mw-empty-elt"></li>
16540 <li class="mw-empty-elt"></li>
16541 <li>b</li></ul>
16542 !! end
16543
16544 !! test
16545 Empty list item with rendering transparent tag
16546 !! wikitext
16547 {{1x|*hmm
16548 *[[category:123]]}}
16549 !! html/php
16550 <ul><li>hmm</li>
16551 <li class="mw-empty-elt"></li></ul>
16552 !! html/parsoid
16553 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"*hmm\n*[[category:123]]"}},"i":0}}]}'><li>hmm</li>
16554 <li class="mw-empty-elt"><link rel="mw:PageProp/Category" href="./Category:123"/></li></ul>
16555 !! end
16556
16557 !! test
16558 unclosed internal link XSS (T137264)
16559 !! wikitext
16560 [[#%3Cscript%3Ealert(1)%3C/script%3E|
16561 !! html/php
16562 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
16563 </p>
16564 !! html/parsoid
16565 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
16566 !! end
16567
16568 !! test
16569 Validating that <style> isn't eaten by tidy (T167349)
16570 !! options
16571 styletag=1
16572 !! wikitext
16573 <div class="foo">
16574 <style>.foo::before { content: "<foo>"; }</style>
16575 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
16576 </div>
16577 !! html/php
16578 <div class="foo">
16579 <style>.foo::before { content: "<foo>"; }</style>
16580 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
16581 </div>
16582 !! html/parsoid
16583 <div class="foo">
16584 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
16585 <style data-x-data-mw-foobar="baz" typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{"data-x-data-mw-foobar":"baz"},"body":{"extsrc":".foo::after { content: \"&lt;bar>\"; }"}}'>.foo::after { content: "<bar>"; }</style>
16586 </div>
16587 !! end
16588
16589 ## Right now, Parsoid doesn't de-duplicate style tags.
16590 ## So, we shouldn't see link tags that need to bypass the sanitizer.
16591 ## In a followup patch, when we de-duplicate style tags and
16592 ## introduce link tags, we'll add a hook for link tags in
16593 ## the parser test runner script.
16594 !! test
16595 Validating that <style> isn't wrapped in a paragraph (T186965)
16596 !! options
16597 styletag=1
16598 !! wikitext
16599 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
16600
16601 <style>.foo::before { content: "<foo>"; }</style>
16602
16603 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
16604
16605 But if it's on a line with other content, let it be wrapped.
16606
16607 <style>.foo::before { content: "<foo>"; }</style> bar
16608
16609 foo <style>.foo::before { content: "<foo>"; }</style>
16610
16611 foo <style>.foo::before { content: "<foo>"; }</style> bar
16612
16613 And the same if we have non-paragraph-breaking whitespace
16614
16615 foo
16616 <style>.foo::before { content: "<foo>"; }</style>
16617 bar
16618 !! html/php
16619 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
16620 </p>
16621 <style>.foo::before { content: "<foo>"; }</style>
16622 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar" /><style>.foo::before { content: "<foo>"; }</style>
16623 <p>But if it's on a line with other content, let it be wrapped.
16624 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
16625 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
16626 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
16627 </p><p>And the same if we have non-paragraph-breaking whitespace
16628 </p><p>foo
16629 <style>.foo::before { content: "<foo>"; }</style>
16630 bar
16631 </p>
16632 !! html/parsoid
16633 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph</p>
16634
16635 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
16636
16637 <p><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style> &lt;link rel="foo" href="bar"/><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style></p>
16638
16639 <p>But if it's on a line with other content, let it be wrapped.</p>
16640
16641 <p><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style> bar</p>
16642
16643 <p>foo <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style></p>
16644
16645 <p>foo <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style> bar</p>
16646
16647 <p>And the same if we have non-paragraph-breaking whitespace</p>
16648
16649 <p>foo
16650 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
16651 bar</p>
16652 !! end
16653
16654 !! test
16655 Validating that <link> isn't wrapped in a paragraph (T186965)
16656 !! options
16657 styletag=1
16658 !! wikitext
16659 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
16660
16661 <link rel="foo" href="bar"/>
16662
16663 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
16664
16665 But if it's on a line with other content, let it be wrapped.
16666
16667 <link rel="foo" href="bar"/> bar
16668
16669 foo <link rel="foo" href="bar"/>
16670
16671 foo <link rel="foo" href="bar"/> bar
16672
16673 And the same if we have non-paragraph-breaking whitespace
16674
16675 foo
16676 <link rel="foo" href="bar"/>
16677 bar
16678 !! html/php
16679 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
16680 </p>
16681 <link rel="foo" href="bar" />
16682 <link rel="foo" href="bar" /> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar" />
16683 <p>But if it's on a line with other content, let it be wrapped.
16684 </p><p><link rel="foo" href="bar" /> bar
16685 </p><p>foo <link rel="foo" href="bar" />
16686 </p><p>foo <link rel="foo" href="bar" /> bar
16687 </p><p>And the same if we have non-paragraph-breaking whitespace
16688 </p><p>foo
16689 <link rel="foo" href="bar" />
16690 bar
16691 </p>
16692 !! end
16693
16694 !! test
16695 Extension returning multiple nodes starting with a style tag roundtrips
16696 !! options
16697 wgRawHtml=1
16698 !! wikitext
16699 <table>
16700 {{1x|<html><style>.hi { color: red; }</style>
16701 </html>}}
16702 <tr><td class="hi">ho</td></tr>
16703 </table>
16704 !! html/parsoid
16705 <p about="#mwt5" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;html>&lt;style>.hi { color: red; }&lt;/style>\n&lt;/html>"}},"i":0}},"\n&lt;tr>&lt;td class=\"hi\">ho&lt;/td>&lt;/tr>\n&lt;/table>"]}'><style typeof="mw:Extension/html" about="#mwt4" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;style>.hi { color: red; }&lt;/style>\n"}}'>.hi { color: red; }</style><span about="#mwt4">
16706 </span></p><table about="#mwt5" data-parsoid='{"stx":"html"}'>
16707
16708 <tbody><tr><td class="hi">ho</td></tr>
16709 </tbody></table>
16710 !! end
16711
16712 !! test
16713 Decoding of HTML entities in embedded HTML tags
16714 !! wikitext
16715 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
16716 !! html/php
16717 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tbody><tr><td>x</td></tr></tbody></table>
16718 !! html/parsoid
16719 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5" data-parsoid='{"stx":"html","a":{"class":"1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"},"sa":{"class":"1&amp;2&amp;amp;3&amp;amp;amp;4&amp;amp;amp;amp;5"}}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>x</td></tr></tbody></table>
16720 !! end
16721
16722 !! test
16723 T51672: Test for brackets in attributes of elements in external link texts
16724 !! wikitext
16725 [http://example.com/ link <span title="title with [brackets]">span</span>]
16726 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
16727
16728 !! html/php
16729 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
16730 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
16731 </p>
16732 !! html/parsoid
16733 <p><a rel="mw:ExtLink" href="http://example.com/" class="external text">link <span title="title with [brackets]">span</span></a>
16734 <a rel="mw:ExtLink" href="http://example.com/" class="external text">link <span title="title with [brackets]" data-parsoid='{"stx":"html","a":{"title":"title with [brackets]"},"sa":{"title":"title with &amp;#91;brackets&amp;#93;"}}'>span</span></a></p>
16735 !! end
16736
16737 !! test
16738 T72875: Test for brackets in attributes of elements in internal link texts
16739 !! wikitext
16740 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
16741 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
16742
16743 !! html/php
16744 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
16745 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
16746 </p>
16747 !! html/parsoid
16748 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
16749 <a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]" data-parsoid='{"stx":"html","a":{"title":"title with [[double brackets]]"},"sa":{"title":"title with &amp;#91;&amp;#91;double brackets&amp;#93;&amp;#93;"}}'>span</span></a></p>
16750 !! end
16751
16752 !! test
16753 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
16754 !! options
16755 parsoid={
16756 "modes": ["html2wt"]
16757 }
16758 !! html/parsoid
16759 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
16760 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total">10</a>
16761 !! wikitext
16762 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
16763 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
16764 !! end
16765
16766 !! test
16767 T199926: Hash only interwiki link
16768 !! config
16769 wgFragmentMode=[ "html5" ]
16770 !! wikitext
16771 [[meatball:Test#1/2]]
16772 [[gerrit:#/q/project:mediawiki/services/parsoid|Gerrit]]
16773 !! html/php
16774 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Test#1.2F2" class="extiw" title="meatball:Test">meatball:Test#1/2</a>
16775 <a href="https://gerrit.wikimedia.org/#/q/project:mediawiki/services/parsoid" class="extiw" title="gerrit:">Gerrit</a>
16776 </p>
16777 !! html/parsoid
16778 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Test#1.2F2" title="meatball:Test" class="extiw" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Test#1.2F2"},"sa":{"href":"meatball:Test#1/2"},"isIW":true}'>meatball:Test#1/2</a>
16779 <a rel="mw:WikiLink/Interwiki" href="https://gerrit.wikimedia.org/#/q/project:mediawiki/services/parsoid" class="extiw">Gerrit</a></p>
16780 !! end
16781
16782 !! test
16783 T179544: {{anchorencode:}} output should be always usable in links
16784 !! config
16785 wgFragmentMode=[ "html5" ]
16786 !! wikitext
16787 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
16788 !! html/php
16789 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
16790 </p>
16791 !! html/parsoid
16792 <p><span id="[foo]" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"id":"[foo]"},"sa":{"id":"{{anchorencode:[foo]}}"}}' data-mw='{"attribs":[[{"txt":"id"},{"html":"&lt;span typeof=\"mw:Transclusion mw:Entity\" about=\"#mwt1\" data-parsoid=&apos;{\"srcContent\":\"[\",\"dsr\":[10,32,null,null],\"pi\":[[]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:[foo]\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&apos;>[&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">foo&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&apos;{\"src\":\"&amp;amp;#x5D;\",\"srcContent\":\"]\"}&apos;>]&lt;/span>"}]]}'></span><a typeof="mw:ExpandedAttrs" about="#mwt4" rel="mw:WikiLink" href="./Parser_test#[foo]" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#[foo]"},"sa":{"href":"#{{anchorencode:[foo]}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"#&lt;span typeof=\"mw:Transclusion mw:Entity\" about=\"#mwt3\" data-parsoid=&apos;{\"srcContent\":\"[\",\"dsr\":[44,66,null,null],\"pi\":[[]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:[foo]\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&apos;>[&lt;/span>&lt;span about=\"#mwt3\" data-parsoid=\"{}\">foo&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt3\" data-parsoid=&apos;{\"src\":\"&amp;amp;#x5D;\",\"srcContent\":\"]\"}&apos;>]&lt;/span>"}]]}'>#[foo]</a></p>
16793 !! end
16794 ##########################################################################
16795 # Tests demonstrating white-space insensitivity in input wikitext
16796 # for wikitext headings, wikitext list items, and wikitext table captions,
16797 # headings, and cells. HTML versions of the same should preserve whitespace.
16798 ##########################################################################
16799 !! test
16800 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
16801 !! options
16802 parsoid={
16803 "modes": ["wt2html"],
16804 "preserveIEW": true
16805 }
16806 !! config
16807 wgParserEnableLegacyHeadingDOM=false
16808 !! wikitext
16809 __NOTOC__
16810 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
16811 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
16812 == <!--Headings with fallback ids--> Личная жизнь ==
16813 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
16814 ; <!--term to define--> term : <!--term's definition--> definition
16815 {|
16816 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
16817 |-
16818 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
16819 |-
16820 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
16821 |-
16822 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
16823 |-
16824 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
16825 |}
16826 : {|
16827 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
16828 |} foo <!--c1-->
16829 !! html/php
16830 <div class="mw-heading mw-heading2"><h2 id="Spaces">Spaces</h2><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: Spaces">edit</a><span class="mw-editsection-bracket">]</span></span></div>
16831 <div class="mw-heading mw-heading2"><h2 id="Tabs">Tabs</h2><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: Tabs">edit</a><span class="mw-editsection-bracket">]</span></span></div>
16832 <div class="mw-heading mw-heading2"><h2 id=".D0.9B.D0.B8.D1.87.D0.BD.D0.B0.D1.8F_.D0.B6.D0.B8.D0.B7.D0.BD.D1.8C">Личная жизнь</h2><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: Личная жизнь">edit</a><span class="mw-editsection-bracket">]</span></span></div>
16833 <ul><li>List item</li></ul>
16834 <dl><dt>term</dt>
16835 <dd>definition</dd></dl>
16836 <table>
16837 <caption>Table Caption
16838 </caption>
16839 <tbody><tr>
16840 <th>Table Heading 1</th>
16841 <th>Table Heading 2
16842 </th></tr>
16843 <tr>
16844 <td>Table Cell 1</td>
16845 <td>Table Cell 2
16846 </td></tr>
16847 <tr>
16848 <td>class="foo"</td>
16849 <td>Table Cell 3
16850 </td></tr>
16851 <tr>
16852 <td>testing <a href="/wiki/One" title="One">two</a> | some content
16853 </td></tr></tbody></table>
16854 <dl><dd><table>
16855 <tbody><tr>
16856 <td>Table Cell 1</td>
16857 <td>Table Cell 2
16858 </td></tr></tbody></table> foo</dd></dl>
16859 !! html/parsoid
16860 <meta property="mw:PageProp/notoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
16861 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
16862 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
16863 <h2 id="Личная_жизнь"><span id=".D0.9B.D0.B8.D1.87.D0.BD.D0.B0.D1.8F_.D0.B6.D0.B8.D0.B7.D0.BD.D1.8C" typeof="mw:FallbackId"></span><!--Headings with fallback ids-->Личная жизнь</h2>
16864 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
16865 <dl><dt><!--term to define-->term</dt><dd data-parsoid='{"stx":"row"}'><!--term's definition-->definition</dd></dl>
16866 <table>
16867 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
16868 <tbody><tr data-parsoid='{"startTagSrc":"|-"}'>
16869 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th data-parsoid='{"stx":"row"}'>Table Heading 2<!--c5--></th></tr>
16870 <tr data-parsoid='{"startTagSrc":"|-"}'>
16871 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td data-parsoid='{"stx":"row"}'>Table Cell 2<!--c5--></td></tr>
16872 <tr data-parsoid='{"startTagSrc":"|-"}'>
16873 <td>class="foo"</td><td data-parsoid='{"stx":"row"}'><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
16874 <tr data-parsoid='{"startTagSrc":"|-"}'>
16875 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> <!--c2--> | <!--c3--> some content</td></tr>
16876 </tbody></table>
16877 <dl><dd><table>
16878 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td data-parsoid='{"stx":"row"}'>Table Cell 2 <!--c5-->
16879 </td></tr></tbody></table> foo<!--c1--></dd></dl>
16880 !! end
16881
16882 # Looks like <caption> is not accepted in HTML
16883 !! test
16884 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
16885 !! options
16886 parsoid={
16887 "modes": ["wt2html"],
16888 "preserveIEW": true
16889 }
16890 !! config
16891 wgParserEnableLegacyHeadingDOM=false
16892 !! wikitext
16893 __NOTOC__
16894 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
16895 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
16896 <table>
16897 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
16898 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
16899 </table>
16900 !! html/php
16901 <div class="mw-heading mw-heading2"><h2 id="Heading"> Heading </h2></div>
16902 <ul><li> List item </li></ul>
16903 <table>
16904 <tbody><tr><th> Table Heading </th><th></th></tr>
16905 <tr><td> Table Cell </td><th></th></tr>
16906 </tbody></table>
16907 !! html/parsoid
16908 <meta property="mw:PageProp/notoc"/>
16909 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
16910 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
16911 <table>
16912 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
16913 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
16914 </tbody></table>
16915 !! end
16916
16917 !! test
16918 Do not trim whitespace in links and quotes
16919 !! options
16920 parsoid={
16921 "modes": ["wt2html"],
16922 "preserveIEW": true
16923 }
16924 !! wikitext
16925 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
16926 [[Foo| some text ]]
16927 !! html/php
16928 <p>foo <i> italic </i> and <b> bold </b>
16929 <a href="/wiki/Foo" title="Foo"> some text </a>
16930 </p>
16931 !! html/parsoid
16932 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
16933 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
16934 !! end
16935
16936 !! test
16937 Remove p tags surrounding a single element in a figcaption
16938 !! options
16939 parsoid=html2wt
16940 !! wikitext
16941 [[File:Foobar.jpg|right|200x200px|Caption]]
16942 !! html/parsoid
16943 <figure class="mw-halign-right" typeof="mw:File"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption><p>Caption</p></figcaption></figure>
16944 !! end
16945
16946 !! test
16947 Selser preserves lack of newline before list and allows newline after the list
16948 !! options
16949 parsoid={
16950 "modes": ["selser"],
16951 "changes": [
16952 [ "ul", "after", "<p>footer</p>" ]
16953 ]
16954 }
16955 !! wikitext
16956 header
16957 *foo
16958 *bar
16959 !! wikitext/edited
16960 header
16961 *foo
16962 *bar
16963 footer
16964 !! end
16965
16966 !! test
16967 Selser does not introduce newlines between unedited paragraph preceding the list
16968 !! options
16969 parsoid={
16970 "modes": ["selser"],
16971 "changes": [
16972 [ "table tbody tr td p:last-child", "empty" ]
16973 ]
16974 }
16975 !! wikitext
16976 {|
16977 |
16978 header
16979 *foo
16980 *bar
16981 footer
16982 |}
16983 !! wikitext/edited
16984 {|
16985 |
16986 header
16987 *foo
16988 *bar
16989
16990 |}
16991 !! end
16992
16993 !! test
16994 Selser does not introduce newlines between unedited paragraph following the list
16995 !! options
16996 parsoid={
16997 "modes": ["selser"],
16998 "changes": [
16999 [ "table tbody tr td p:first-child", "empty" ]
17000 ]
17001 }
17002 !! wikitext
17003 {|
17004 |
17005 header
17006 *foo
17007 *bar
17008 footer
17009 |}
17010 !! wikitext/edited
17011 {|
17012 |
17013 *foo
17014 *bar
17015 footer
17016 |}
17017 !! end
17018
17019 !! test
17020 Remove a list item but do not insert newline above list
17021 !! options
17022 parsoid={
17023 "modes": ["selser"],
17024 "changes": [
17025 [ "ul li:last-child", "remove" ]
17026 ]
17027 }
17028 !! wikitext
17029 header
17030 *foo
17031 *bar
17032 footer
17033 !! wikitext/edited
17034 header
17035 *foo
17036 footer
17037 !! end
17038
17039 !! test
17040 Spaced heading with element
17041 !! options
17042 parsoid={
17043 "modes": ["selser"],
17044 "changes": [
17045 ["#x", "attr", "class", "y"]
17046 ]
17047 }
17048 !! wikitext
17049 === hi <span id="x">hi</span> hi ho ===
17050 !! wikitext/edited
17051 === hi <span id="x" class="y">hi</span> hi ho ===
17052 !! end
17053
17054 !! test
17055 Allow tabindex 0
17056 !! wikitext
17057 <div tabindex="0">A</div>
17058 !! html
17059 <div tabindex="0">A</div>
17060 !! end
17061
17062 !! test
17063 Don't allow tabindex -1
17064 !! options
17065 parsoid=wt2html
17066 !! wikitext
17067 <div tabindex="-1">A</div>
17068 !! html
17069 <div>A</div>
17070 !! end
17071
17072 !! test
17073 Don't Allow tabindex > 0
17074 !! options
17075 parsoid=wt2html
17076 !! wikitext
17077 <div tabindex="3">A</div>
17078 !! html
17079 <div>A</div>
17080 !! end
17081
17082 !! test
17083 aside tag in extension HTML is not p-wrapped (T278565)
17084 !! wikitext
17085 <asidetag></asidetag>This is some article content.
17086 !! html/php
17087 <aside>Some aside content</aside><p>This is some article content.</p>
17088 !! html/parsoid
17089 <aside typeof="mw:Extension/asidetag" data-mw='{"name":"asidetag","attrs":{},"body":{"extsrc":""}}'>Some aside content</aside><p>This is some article content.</p>
17090 !! end
17091
17092 !! test
17093 aside tag is not allowed directly in wikitext (T278565)
17094 !! wikitext
17095 <aside>This aside tag in wikitext should be escaped</aside>
17096 !! html
17097 <p>&lt;aside&gt;This aside tag in wikitext should be escaped&lt;/aside&gt;
17098 </p>
17099 !! end
17100
17101 !! test
17102 Stripped tag in list
17103 !! options
17104 parsoid={
17105 "modes": ["selser"],
17106 "selser": "noauto",
17107 "changes": [
17108 ["dd", "append", "ho"]
17109 ]
17110 }
17111 !! wikitext
17112 :<i>hi</i></b>
17113 !! wikitext/edited
17114 :<i>hi</i></b>ho
17115 !! end
17116
17117 !! test
17118 Misnested link nested in span
17119 !! options
17120 parsoid={
17121 "modes": ["selser"],
17122 "selser": "noauto",
17123 "changes": [
17124 ["dd", "append", " ho"]
17125 ]
17126 }
17127 !! wikitext
17128 : [http://google.com <span>[[Lala]]:</span>ok]-hi
17129 !! wikitext/edited
17130 : [http://google.com <span>[[Lala]]:</span>ok]-hi ho
17131 !! end
17132
17133 ## From T290938, wrapper unmodified was prevented due to the auto-inserted end
17134 !! test
17135 Preserve the order invalid attributes
17136 !! options
17137 parsoid={
17138 "modes": ["selser"],
17139 "selser": "noauto",
17140 "changes": [
17141 ["div", "append", "ho"]
17142 ]
17143 }
17144 !! wikitext
17145 <div width="95%" style="border: 3px solid darkblue">hi
17146 !! wikitext/edited
17147 <div width="95%" style="border: 3px solid darkblue">hiho
17148 !! end