Debian Codegraph @

vendor/wikimedia/parsoid/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 !! options
9212 disabled
9213 !! wikitext
9214 <br id="" /><br id="a space" />
9215 !! html
9216 Something ...
9217 !! end
9218
9219 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
9220 !! test
9221 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
9222 !! options
9223 disabled
9224 !! wikitext
9225 <br id="foo" /><br id="foo" />
9226 !! html
9227 Something need to be done. foo-2 ?
9228 !! end
9229
9230 !! test
9231 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9232 !! wikitext
9233 <div itemscope>
9234 <meta itemprop="hello" content="world">
9235 <meta http-equiv="refresh" content="5">
9236 <meta itemprop="hello" http-equiv="refresh" content="5">
9237 <link itemprop="hello" href="{{SERVER}}">
9238 <link rel="stylesheet" href="{{SERVER}}">
9239 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9240 </div>
9241 !! html
9242 <div itemscope="">
9243 <p> <meta itemprop="hello" content="world" />
9244 &lt;meta http-equiv="refresh" content="5"&gt;
9245 <meta itemprop="hello" content="5" />
9246 <link itemprop="hello" href="http&#58;//example.org" />
9247 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9248 <link itemprop="hello" href="http&#58;//example.org" />
9249 </p>
9250 </div>
9251 !! end
9252
9253 !! test
9254 Sanitizer: Strip comments from CSS attributes
9255 !! options
9256 parsoid=wt2html,wt2wt
9257 !! wikitext
9258 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
9259 !! html/php
9260 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
9261 </p>
9262 !! html/parsoid
9263 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
9264 !! end
9265
9266 !! test
9267 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
9268 !! wikitext
9269 [[meatball:Soft"Security]]
9270 !! html/php
9271 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
9272 </p>
9273 !! html/parsoid
9274 <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>
9275 !! end
9276
9277 !! test
9278 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
9279 !! wikitext
9280 [[meatball:Foo<Bar]]
9281 [[meatball:Foo>Bar]]
9282 [[meatball:Foo&lt;bar]]
9283 [[meatball:Foo&gt;bar]]
9284 !! html/php
9285 <p>[[meatball:Foo&lt;Bar]]
9286 [[meatball:Foo&gt;Bar]]
9287 [[meatball:Foo&lt;bar]]
9288 [[meatball:Foo&gt;bar]]
9289 </p>
9290 !! html/parsoid
9291 <p>[[meatball:Foo&lt;Bar]]
9292 [[meatball:Foo>Bar]]
9293 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
9294 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
9295 !! end
9296
9297 !! test
9298 Self closed html pairs (T7487)
9299 !! wikitext
9300 <center><font id="bug" />Centered text</center>
9301 <div><font id="bug2" />In div text</div>
9302 !! html
9303 <center><font id="bug">Centered text</font></center><font id="bug"><div><font id="bug2">In div text</font></div></font>
9304 !! end
9305
9306 !! test
9307 Punctuation: nbsp before exclamation
9308 !! wikitext
9309 C'est grave !
9310 !! html/php
9311 <p>C'est grave&#160;!
9312 </p>
9313 !! html/parsoid
9314 <p>C'est grave<span typeof="mw:DisplaySpace"> </span>!</p>
9315 !! end
9316
9317 !! test
9318 Punctuation: CSS !important (T13874)
9319 !! wikitext
9320 <div style="width:50% !important">important</div>
9321 !! html
9322 <div style="width:50% !important">important</div>
9323 !! end
9324
9325 !! test
9326 Punctuation: CSS ! important (T13874; with space after)
9327 !! wikitext
9328 <div style="width:50% ! important">important</div>
9329 !! html
9330 <div style="width:50% ! important">important</div>
9331 !! end
9332
9333 !! test
9334 HTML bullet list, closed tags (T7497)
9335 !! wikitext
9336 <ul>
9337 <li>One</li>
9338 <li>Two</li>
9339 </ul>
9340 !! html/php
9341 <ul>
9342 <li>One</li>
9343 <li>Two</li>
9344 </ul>
9345 !! html/parsoid
9346 <ul data-parsoid='{"stx":"html"}'>
9347 <li data-parsoid='{"stx":"html"}'>One</li>
9348 <li data-parsoid='{"stx":"html"}'>Two</li>
9349 </ul>
9350 !! end
9351
9352 !! test
9353 HTML bullet list, unclosed tags (T7497)
9354 !! wikitext
9355 <ul>
9356 <li>One
9357 <li>Two
9358 </ul>
9359 !! html/php
9360 <ul>
9361 <li>One
9362 </li><li>Two
9363 </li></ul>
9364 !! html/parsoid
9365 <ul data-parsoid='{"stx":"html"}'>
9366 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
9367 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
9368 </ul>
9369 !! end
9370
9371 !! test
9372 HTML ordered list, closed tags (T7497)
9373 !! wikitext
9374 <ol>
9375 <li>One</li>
9376 <li>Two</li>
9377 </ol>
9378 !! html/php
9379 <ol>
9380 <li>One</li>
9381 <li>Two</li>
9382 </ol>
9383 !! html/parsoid
9384 <ol data-parsoid='{"stx":"html"}'>
9385 <li data-parsoid='{"stx":"html"}'>One</li>
9386 <li data-parsoid='{"stx":"html"}'>Two</li>
9387 </ol>
9388 !! end
9389
9390 !! test
9391 HTML ordered list, unclosed tags (T7497)
9392 !! options
9393 !! wikitext
9394 <ol>
9395 <li>One
9396 <li>Two
9397 </ol>
9398 !! html/php
9399 <ol>
9400 <li>One
9401 </li><li>Two
9402 </li></ol>
9403 !! html/parsoid
9404 <ol data-parsoid='{"stx":"html"}'>
9405 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
9406 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
9407 </ol>
9408 !! end
9409
9410 !! test
9411 HTML nested bullet list, closed tags (T7497)
9412 !! wikitext
9413 <ul>
9414 <li>One</li>
9415 <li>Two:
9416 <ul>
9417 <li>Sub-one</li>
9418 <li>Sub-two</li>
9419 </ul>
9420 </li>
9421 </ul>
9422 !! html/php
9423 <ul>
9424 <li>One</li>
9425 <li>Two:
9426 <ul>
9427 <li>Sub-one</li>
9428 <li>Sub-two</li>
9429 </ul>
9430 </li>
9431 </ul>
9432 !! html/parsoid
9433 <ul data-parsoid='{"stx":"html"}'>
9434 <li data-parsoid='{"stx":"html"}'>One</li>
9435 <li data-parsoid='{"stx":"html"}'>Two:
9436 <ul data-parsoid='{"stx":"html"}'>
9437 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
9438 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
9439 </ul>
9440 </li>
9441 </ul>
9442 !! end
9443
9444 !! test
9445 HTML nested bullet list, open tags (T7497)
9446 !! wikitext
9447 <ul>
9448 <li>One
9449 <li>Two:
9450 <ul>
9451 <li>Sub-one
9452 <li>Sub-two
9453 </ul>
9454 </ul>
9455 !! html
9456 <ul>
9457 <li>One
9458 </li><li>Two:
9459 <ul>
9460 <li>Sub-one
9461 </li><li>Sub-two
9462 </li></ul>
9463 </li></ul>
9464 !! end
9465
9466 !! test
9467 HTML nested ordered list, closed tags (T7497)
9468 !! wikitext
9469 <ol>
9470 <li>One</li>
9471 <li>Two:
9472 <ol>
9473 <li>Sub-one</li>
9474 <li>Sub-two</li>
9475 </ol>
9476 </li>
9477 </ol>
9478 !! html
9479 <ol>
9480 <li>One</li>
9481 <li>Two:
9482 <ol>
9483 <li>Sub-one</li>
9484 <li>Sub-two</li>
9485 </ol>
9486 </li>
9487 </ol>
9488 !! end
9489
9490 !! test
9491 HTML nested ordered list, open tags (T7497)
9492 !! wikitext
9493 <ol>
9494 <li>One
9495 <li>Two:
9496 <ol>
9497 <li>Sub-one
9498 <li>Sub-two
9499 </ol>
9500 </ol>
9501 !! html/php
9502 <ol>
9503 <li>One
9504 </li><li>Two:
9505 <ol>
9506 <li>Sub-one
9507 </li><li>Sub-two
9508 </li></ol>
9509 </li></ol>
9510 !! html/parsoid
9511 <ol>
9512 <li>One
9513 </li>
9514 <li>Two:
9515 <ol>
9516 <li>Sub-one
9517 </li>
9518 <li>Sub-two
9519 </li>
9520 </ol>
9521 </li>
9522 </ol>
9523 !! end
9524
9525 !! test
9526 HTML ordered list item with parameters oddity
9527 !! wikitext
9528 <ol><li id="fragment">One</li>
9529 </ol>
9530 !! html
9531 <ol><li id="fragment">One</li>
9532 </ol>
9533 !! end
9534
9535 # parsoid doesn't explicitly mark autonumbered links, see T55505
9536 !!test
9537 T7918: autonumbering
9538 !! wikitext
9539 [http://first/] [http://second] [ftp://ftp]
9540
9541 ftp://inlineftp
9542
9543 [mailto:[email protected] With target]
9544
9545 [mailto:[email protected]]
9546
9547 mailto:[email protected]
9548 !! html/php
9549 <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>
9550 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9551 </p><p><a rel="nofollow" class="external text" href="mailto:[email protected]">With target</a>
9552 </p><p><a rel="nofollow" class="external autonumber" href="mailto:[email protected]">[4]</a>
9553 </p><p><a rel="nofollow" class="external free" href="mailto:[email protected]">mailto:[email protected]</a>
9554 </p>
9555 !! html/parsoid
9556 <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>
9557 <p><a rel="mw:ExtLink" href="ftp://inlineftp" class="external free">ftp://inlineftp</a></p>
9558 <p><a rel="mw:ExtLink" href="mailto:[email protected]" class="external text">With target</a></p>
9559 <p><a rel="mw:ExtLink" href="mailto:[email protected]" class="external autonumber"></a></p>
9560 <p><a rel="mw:ExtLink" href="mailto:[email protected]" class="external free">mailto:[email protected]</a></p>
9561 !! end
9562
9563
9564 #
9565 # Security and HTML correctness
9566 # From Nick Jenkins' fuzz testing
9567 #
9568
9569 !! test
9570 Fuzz testing: Parser13
9571 !! wikitext
9572 {|
9573 | http://a|
9574 !! html
9575 <table>
9576 <tbody><tr>
9577 <td>
9578 </td>
9579 </tr>
9580 </tbody></table>
9581 !! end
9582
9583 # Known to produce bogus xml (extra </td>)
9584 # Don't add the html/php section since it generates broken HTML
9585 !! test
9586 Fuzz testing: Parser16
9587 !! wikitext
9588 {|
9589 !https://||||||
9590 !! html
9591 <table>
9592 <tbody><tr>
9593 <th>https://</th>
9594 <th></th>
9595 <th></th>
9596 <th>
9597
9598 </th></tr>
9599 </tbody></table>
9600 !! end
9601
9602 !! test
9603 Fuzz testing: Parser21
9604 !! wikitext
9605 {|
9606 !irc://{{ftp://a" onmouseover="alert('hello world');"
9607 |
9608 !! html
9609 <table>
9610 <tbody><tr>
9611 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9612 </th>
9613 <td>
9614 </td>
9615 </tr>
9616 </tbody></table>
9617 !! end
9618
9619 !! test
9620 Fuzz testing: Parser22
9621 !! wikitext
9622 http://===r:::https://b
9623
9624 {|
9625 !! html/php
9626 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9627 </p>
9628 <table>
9629 <tbody><tr><td></td></tr>
9630 </tbody></table>
9631 !! html/parsoid
9632 <p><a rel="mw:ExtLink" href="http://===r:::https://b" class="external free" data-parsoid='{"stx":"url"}'>http://===r:::https://b</a></p>
9633
9634 <table data-parsoid='{"autoInsertedEnd":true}'></table>
9635 !! end
9636
9637 # The above 'Parser24' fuzz test exposed a tokenizer bug (T221384);
9638 # this is a minimized version of the above test to catch regressions.
9639 !! test
9640 Fuzz testing: Parser24 (minimized)
9641 !! options
9642 parsoid=wt2html
9643 !! wikitext
9644 {{<u {{{{[[Sx-->}}
9645 !! html/php
9646 <p>{{<u>}}
9647 </u></p>
9648 !! html/parsoid
9649 <p>{{<u data-parsoid='{"stx":"html","a":{"{{{{[[Sx--":null},"sa":{"{{{{[[Sx--":""},"autoInsertedEnd":true}'>}}</u></p>
9650 !! end
9651
9652 ## Remex doesn't account for fostered content.
9653 ## Known to produce bad XML for now
9654 !! test
9655 Fuzz testing: Parser24
9656 !! options
9657 parsoid=wt2html
9658 !! wikitext
9659 {|
9660 {{{|
9661 <u CLASS=
9662 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9663 <br style="onmouseover='alert(document.cookie);' " />
9664
9665 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9666 |
9667 !! html/php
9668
9669 {{{|
9670 <u class="&#124;">}}}} &gt;
9671 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9672
9673 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9674 </u><table><tbody><tr>
9675 <td>
9676 </td>
9677 </tr>
9678 </tbody></table>
9679 !! html/parsoid
9680 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
9681 {{{|
9682 <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>"}'/>}}}} >
9683 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
9684
9685 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
9686 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
9687 !! end
9688
9689 # Note: the current result listed for this is not what the original one was,
9690 # but the original bug was JavaScript injection, which is fixed in any case.
9691 # It's not clear that the original result listed was any more correct than the
9692 # current one. Original result:
9693 # <p>{{{|
9694 # </p>
9695 # <li class="&#124;&#124;">
9696 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9697 !!test
9698 Fuzz testing: Parser25 (T8055)
9699 !! wikitext
9700 {{{
9701 |
9702 <LI CLASS=||
9703 >
9704 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9705 !! html/php
9706 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9707 </p>
9708 !! html/parsoid
9709 <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"]}'>
9710 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
9711 !! end
9712
9713 !!test
9714 Fuzz testing: URL adjacent extension (with space, clean)
9715 !! wikitext
9716 http://example.com <nowiki>junk</nowiki>
9717 !! html/php
9718 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9719 </p>
9720 !! html/parsoid
9721 <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>
9722 !! end
9723
9724 !!test
9725 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9726 !! wikitext
9727 http://example.com<nowiki>junk</nowiki>
9728 !! html/php
9729 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9730 </p>
9731 !! html/parsoid
9732 <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>
9733 !! end
9734
9735 !! test
9736 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9737 !! wikitext
9738 http://example.com<pre>junk</pre>
9739 !! html/php
9740 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
9741 !! html/parsoid
9742 <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>
9743 !! end
9744
9745 # Parsoid will emit the newline literally in wt2wt; see next test case.
9746 !! test
9747 Fuzz testing: encoded newline in generated HTML replacements (T8577)
9748 !! options
9749 parsoid=wt2html
9750 !! wikitext
9751 <pre dir="&#10;"></pre>
9752 !! html/php
9753 <pre dir="&#10;"></pre>
9754 !! html/parsoid
9755 <pre dir="
9756 " typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"dir":""},"body":{"extsrc":""}}'></pre>
9757 !! end
9758
9759 !! test
9760 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
9761 !! options
9762 parsoid=html2wt
9763 !! html/parsoid
9764 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
9765 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
9766 !! wikitext
9767 <pre dir="
9768 "></pre>
9769 !! html/php
9770 <pre dir=""></pre>
9771 !! end
9772
9773 !! test
9774 Templates in extension attributes are not expanded
9775 !! wikitext
9776 <pre dir="{{1x|ltr}}"></pre>
9777 !! html/php
9778 <pre dir="{{1x|ltr}}"></pre>
9779 !! html/parsoid
9780 <pre dir="{{1x|ltr}}" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"dir":"{{1x|ltr}}"},"body":{"extsrc":""}}'></pre>
9781 !! end
9782
9783 !! test
9784 Parsing optional HTML elements (T8171)
9785 !! options
9786 !! wikitext
9787 <table>
9788 <tr>
9789 <td> Some tabular data</td>
9790 <td> More tabular data ...
9791 <td> And yet som tabular data</td>
9792 </tr>
9793 </table>
9794 !! html
9795 <table>
9796 <tbody><tr>
9797 <td> Some tabular data</td>
9798 <td> More tabular data ...
9799 </td><td> And yet som tabular data</td>
9800 </tr>
9801 </tbody></table>
9802 !! end
9803
9804 !! test
9805 Correct handling of <td>, <tr> (T8171)
9806 !! options
9807 !! wikitext
9808 <table>
9809 <tr>
9810 <td> Some tabular data</td>
9811 <td> More tabular data ...</td>
9812 <td> And yet som tabular data</td>
9813 </tr>
9814 </table>
9815 !! html
9816 <table>
9817 <tbody><tr>
9818 <td> Some tabular data</td>
9819 <td> More tabular data ...</td>
9820 <td> And yet som tabular data</td>
9821 </tr>
9822 </tbody></table>
9823 !! end
9824
9825
9826 !! test
9827 Parsing crashing regression (fr:JavaScript)
9828 !! wikitext
9829 </body></x>
9830 !! html
9831 <p>&lt;/body&gt;&lt;/x&gt;
9832 </p>
9833 !! end
9834
9835 !! test
9836 Inline wiki vs wiki block nesting
9837 !! wikitext
9838 '''Bold paragraph
9839
9840 New wiki paragraph
9841 !! html
9842 <p><b>Bold paragraph</b>
9843 </p><p>New wiki paragraph
9844 </p>
9845 !! end
9846
9847 # FIXME: The current php output is documented
9848 # and desired output is the parsoid target.
9849 !! test
9850 Inline HTML vs wiki block nesting
9851 !! wikitext
9852 <b>Bold paragraph
9853
9854 New wiki paragraph
9855 !! html/php
9856 <p><b>Bold paragraph
9857 </b></p><p><b>New wiki paragraph
9858 </b></p>
9859 !! html/parsoid
9860 <p><b>Bold paragraph</b>
9861 </p><p>New wiki paragraph
9862 </p>
9863 !! end
9864
9865 # Original result was this:
9866 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9867 # </p>
9868 # While that might be marginally more intuitive, maybe, the six-apostrophe
9869 # construct is clearly pathological and the result stated here (which is what
9870 # the parser actually does) is about as reasonable as anything.
9871 !!test
9872 Mixing markup for italics and bold
9873 !! options
9874 !! wikitext
9875 '''bold''''''bold''bolditalics'''''
9876 !! html
9877 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9878 </p>
9879 !! end
9880
9881
9882 !! article
9883 Xyzzyx
9884 !! text
9885 Article for special page transclusion test
9886 !! endarticle
9887
9888 !! test
9889 Special page transclusion
9890 !! wikitext
9891 {{Special:Prefixindex/Xyzzyx}}
9892 !! html/php
9893 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
9894 </ul>
9895 !! html/parsoid+integrated
9896 <ul class="mw-prefixindex-list" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Special:Prefixindex/Xyzzyx","href":"./Special:PrefixIndex/Xyzzyx"},"params":{},"i":0}}]}'>
9897 <li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
9898 </ul>
9899 !! end
9900
9901 !! test
9902 Special page transclusion twice (T7021)
9903 !! wikitext
9904 {{Special:Prefixindex/Xyzzyx}}
9905 {{Special:Prefixindex/Xyzzyx}}
9906 !! html/php
9907 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
9908 </ul>
9909 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
9910 </ul>
9911 !! html/parsoid+integrated
9912 <ul class="mw-prefixindex-list" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Special:Prefixindex/Xyzzyx","href":"./Special:PrefixIndex/Xyzzyx"},"params":{},"i":0}}]}'>
9913 <li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
9914 </ul>
9915 <ul class="mw-prefixindex-list" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Special:Prefixindex/Xyzzyx","href":"./Special:PrefixIndex/Xyzzyx"},"params":{},"i":0}}]}'>
9916 <li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
9917 </ul>
9918 !! end
9919
9920 !! test
9921 Transclusion of default MediaWiki message
9922 !! wikitext
9923 {{MediaWiki:Mainpage}}
9924 !! html/php
9925 <p>Main Page
9926 </p>
9927 !! html/parsoid+integrated
9928 <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>
9929 !! end
9930
9931 !! test
9932 Transclusion of nonexistent MediaWiki message
9933 !! wikitext
9934 {{MediaWiki:Mainpagexxx}}
9935 !! html/php
9936 <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>
9937 </p>
9938 !! html/parsoid
9939 <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>
9940 !! end
9941
9942 !! test
9943 Transclusion of MediaWiki message with underscore
9944 !! wikitext
9945 {{MediaWiki:history_short}}
9946 !! html/php
9947 <p>History
9948 </p>
9949 !! html/parsoid+integrated
9950 <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>
9951 !! end
9952
9953 !! test
9954 Transclusion of MediaWiki message with space
9955 !! wikitext
9956 {{MediaWiki:history short}}
9957 !! html/php
9958 <p>History
9959 </p>
9960 !! html/parsoid+integrated
9961 <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>
9962 !! end
9963
9964 !! test
9965 Invalid header with following text
9966 !! wikitext
9967 = x = y
9968 !! html
9969 <p>= x = y
9970 </p>
9971 !! end
9972
9973
9974 !! test
9975 Section extraction test (section 0)
9976 !! options
9977 section=0
9978 !! wikitext
9979 start
9980 ==a==
9981 ===aa===
9982 ====aaa====
9983 ==b==
9984 ===ba===
9985 ===bb===
9986 ====bba====
9987 ===bc===
9988 ==c==
9989 ===ca===
9990 !! html/php
9991 start
9992 !! end
9993
9994 !! test
9995 Section extraction test (section 1)
9996 !! options
9997 section=1
9998 !! wikitext
9999 start
10000 ==a==
10001 ===aa===
10002 ====aaa====
10003 ==b==
10004 ===ba===
10005 ===bb===
10006 ====bba====
10007 ===bc===
10008 ==c==
10009 ===ca===
10010 !! html/php
10011 ==a==
10012 ===aa===
10013 ====aaa====
10014 !! end
10015
10016 !! test
10017 Section extraction test (section 2)
10018 !! options
10019 section=2
10020 !! wikitext
10021 start
10022 ==a==
10023 ===aa===
10024 ====aaa====
10025 ==b==
10026 ===ba===
10027 ===bb===
10028 ====bba====
10029 ===bc===
10030 ==c==
10031 ===ca===
10032 !! html/php
10033 ===aa===
10034 ====aaa====
10035 !! end
10036
10037 !! test
10038 Section extraction test (section 3)
10039 !! options
10040 section=3
10041 !! wikitext
10042 start
10043 ==a==
10044 ===aa===
10045 ====aaa====
10046 ==b==
10047 ===ba===
10048 ===bb===
10049 ====bba====
10050 ===bc===
10051 ==c==
10052 ===ca===
10053 !! html/php
10054 ====aaa====
10055 !! end
10056
10057 !! test
10058 Section extraction test (section 4)
10059 !! options
10060 section=4
10061 !! wikitext
10062 start
10063 ==a==
10064 ===aa===
10065 ====aaa====
10066 ==b==
10067 ===ba===
10068 ===bb===
10069 ====bba====
10070 ===bc===
10071 ==c==
10072 ===ca===
10073 !! html/php
10074 ==b==
10075 ===ba===
10076 ===bb===
10077 ====bba====
10078 ===bc===
10079 !! end
10080
10081 !! test
10082 Section extraction test (section 5)
10083 !! options
10084 section=5
10085 !! wikitext
10086 start
10087 ==a==
10088 ===aa===
10089 ====aaa====
10090 ==b==
10091 ===ba===
10092 ===bb===
10093 ====bba====
10094 ===bc===
10095 ==c==
10096 ===ca===
10097 !! html/php
10098 ===ba===
10099 !! end
10100
10101 !! test
10102 Section extraction test (section 6)
10103 !! options
10104 section=6
10105 !! wikitext
10106 start
10107 ==a==
10108 ===aa===
10109 ====aaa====
10110 ==b==
10111 ===ba===
10112 ===bb===
10113 ====bba====
10114 ===bc===
10115 ==c==
10116 ===ca===
10117 !! html/php
10118 ===bb===
10119 ====bba====
10120 !! end
10121
10122 !! test
10123 Section extraction test (section 7)
10124 !! options
10125 section=7
10126 !! wikitext
10127 start
10128 ==a==
10129 ===aa===
10130 ====aaa====
10131 ==b==
10132 ===ba===
10133 ===bb===
10134 ====bba====
10135 ===bc===
10136 ==c==
10137 ===ca===
10138 !! html/php
10139 ====bba====
10140 !! end
10141
10142 !! test
10143 Section extraction test (section 8)
10144 !! options
10145 section=8
10146 !! wikitext
10147 start
10148 ==a==
10149 ===aa===
10150 ====aaa====
10151 ==b==
10152 ===ba===
10153 ===bb===
10154 ====bba====
10155 ===bc===
10156 ==c==
10157 ===ca===
10158 !! html/php
10159 ===bc===
10160 !! end
10161
10162 !! test
10163 Section extraction test (section 9)
10164 !! options
10165 section=9
10166 !! wikitext
10167 start
10168 ==a==
10169 ===aa===
10170 ====aaa====
10171 ==b==
10172 ===ba===
10173 ===bb===
10174 ====bba====
10175 ===bc===
10176 ==c==
10177 ===ca===
10178 !! html/php
10179 ==c==
10180 ===ca===
10181 !! end
10182
10183 !! test
10184 Section extraction test (section 10)
10185 !! options
10186 section=10
10187 !! wikitext
10188 start
10189 ==a==
10190 ===aa===
10191 ====aaa====
10192 ==b==
10193 ===ba===
10194 ===bb===
10195 ====bba====
10196 ===bc===
10197 ==c==
10198 ===ca===
10199 !! html/php
10200 ===ca===
10201 !! end
10202
10203 !! test
10204 Section extraction test (nonexistent section 11)
10205 !! options
10206 section=11
10207 !! wikitext
10208 start
10209 ==a==
10210 ===aa===
10211 ====aaa====
10212 ==b==
10213 ===ba===
10214 ===bb===
10215 ====bba====
10216 ===bc===
10217 ==c==
10218 ===ca===
10219 !! html/php
10220 !! end
10221
10222 !! test
10223 Section extraction test with bogus heading (section 1)
10224 !! options
10225 section=1
10226 !! wikitext
10227 ==a==
10228 ==bogus== not a legal section
10229 ==b==
10230 !! html/php
10231 ==a==
10232 ==bogus== not a legal section
10233 !! end
10234
10235 !! test
10236 Section extraction test with bogus heading (section 2)
10237 !! options
10238 section=2
10239 !! wikitext
10240 ==a==
10241 ==bogus== not a legal section
10242 ==b==
10243 !! html/php
10244 ==b==
10245 !! end
10246
10247 !! test
10248 Section extraction test with comment after heading (section 1)
10249 !! options
10250 section=1
10251 !! wikitext
10252 ==a==
10253 ==b== <!-- -->
10254 ==c==
10255 !! html/php
10256 ==a==
10257 !! end
10258
10259 !! test
10260 Section extraction test with comment after heading (section 2)
10261 !! options
10262 section=2
10263 !! wikitext
10264 ==a==
10265 ==b== <!-- -->
10266 ==c==
10267 !! html/php
10268 ==b== <!-- -->
10269 !! end
10270
10271 !! test
10272 Section extraction test with bogus <nowiki> heading (section 1)
10273 !! options
10274 section=1
10275 !! wikitext
10276 ==a==
10277 ==bogus== <nowiki>not a legal section</nowiki>
10278 ==b==
10279 !! html/php
10280 ==a==
10281 ==bogus== <nowiki>not a legal section</nowiki>
10282 !! end
10283
10284 !! test
10285 Section extraction test with bogus <nowiki> heading (section 2)
10286 !! options
10287 section=2
10288 !! wikitext
10289 ==a==
10290 ==bogus== <nowiki>not a legal section</nowiki>
10291 ==b==
10292 !! html/php
10293 ==b==
10294 !! end
10295
10296 # Formerly testing for T4587, now resolved by the use of unmarked sections
10297 # instead of respecting commented sections
10298 !! test
10299 Section extraction prefixed by comment (section 1)
10300 !! options
10301 section=1
10302 !! wikitext
10303 <!-- -->==sec1==
10304 ==sec2==
10305 !! html/php
10306 ==sec2==
10307 !!end
10308
10309 !! test
10310 Section extraction prefixed by comment (section 2)
10311 !! options
10312 section=2
10313 !! wikitext
10314 <!-- -->==sec1==
10315 ==sec2==
10316 !! html/php
10317 !! end
10318
10319 # Formerly testing for T4607, now resolved by the use of unmarked sections
10320 # instead of respecting HTML-style headings
10321 !! test
10322 Section extraction, mixed wiki and html (section 1)
10323 !! options
10324 section=1
10325 !! wikitext
10326 <h2>unmarked</h2>
10327 unmarked
10328 ==1==
10329 one
10330 ==2==
10331 two
10332 !! html/php
10333 ==1==
10334 one
10335 !! end
10336
10337 !! test
10338 Section extraction, mixed wiki and html (section 2)
10339 !! options
10340 section=2
10341 !! wikitext
10342 <h2>unmarked</h2>
10343 unmarked
10344 ==1==
10345 one
10346 ==2==
10347 two
10348 !! html/php
10349 ==2==
10350 two
10351 !! end
10352
10353
10354 # Formerly testing for T5342
10355 !! test
10356 Section extraction, heading surrounded by <noinclude>
10357 !! options
10358 section=1
10359 !! wikitext
10360 <noinclude>==unmarked==</noinclude>
10361 ==marked==
10362 !! html/php
10363 ==marked==
10364 !!end
10365
10366 # Test behavior of T21910
10367 !! test
10368 Sectiion with all-equals
10369 !! options
10370 section=2
10371 !! wikitext
10372 ===
10373 The line above must have a trailing space
10374 === <!--
10375 --> <!-- -->
10376 But just in case it doesn't...
10377 !! html/php
10378 === <!--
10379 --> <!-- -->
10380 But just in case it doesn't...
10381 !! end
10382
10383 !! test
10384 Section replacement test (section 0)
10385 !! options
10386 replace=0,"xxx"
10387 !! wikitext
10388 start
10389 ==a==
10390 ===aa===
10391 ====aaa====
10392 ==b==
10393 ===ba===
10394 ===bb===
10395 ====bba====
10396 ===bc===
10397 ==c==
10398 ===ca===
10399 !! html/php
10400 xxx
10401
10402 ==a==
10403 ===aa===
10404 ====aaa====
10405 ==b==
10406 ===ba===
10407 ===bb===
10408 ====bba====
10409 ===bc===
10410 ==c==
10411 ===ca===
10412 !! end
10413
10414 !! test
10415 Section replacement test (section 1)
10416 !! options
10417 replace=1,"xxx"
10418 !! wikitext
10419 start
10420 ==a==
10421 ===aa===
10422 ====aaa====
10423 ==b==
10424 ===ba===
10425 ===bb===
10426 ====bba====
10427 ===bc===
10428 ==c==
10429 ===ca===
10430 !! html/php
10431 start
10432 xxx
10433
10434 ==b==
10435 ===ba===
10436 ===bb===
10437 ====bba====
10438 ===bc===
10439 ==c==
10440 ===ca===
10441 !! end
10442
10443 !! test
10444 Section replacement test (section 2)
10445 !! options
10446 replace=2,"xxx"
10447 !! wikitext
10448 start
10449 ==a==
10450 ===aa===
10451 ====aaa====
10452 ==b==
10453 ===ba===
10454 ===bb===
10455 ====bba====
10456 ===bc===
10457 ==c==
10458 ===ca===
10459 !! html/php
10460 start
10461 ==a==
10462 xxx
10463
10464 ==b==
10465 ===ba===
10466 ===bb===
10467 ====bba====
10468 ===bc===
10469 ==c==
10470 ===ca===
10471 !! end
10472
10473 !! test
10474 Section replacement test (section 3)
10475 !! options
10476 replace=3,"xxx"
10477 !! wikitext
10478 start
10479 ==a==
10480 ===aa===
10481 ====aaa====
10482 ==b==
10483 ===ba===
10484 ===bb===
10485 ====bba====
10486 ===bc===
10487 ==c==
10488 ===ca===
10489 !! html/php
10490 start
10491 ==a==
10492 ===aa===
10493 xxx
10494
10495 ==b==
10496 ===ba===
10497 ===bb===
10498 ====bba====
10499 ===bc===
10500 ==c==
10501 ===ca===
10502 !! end
10503
10504 !! test
10505 Section replacement test (section 4)
10506 !! options
10507 replace=4,"xxx"
10508 !! wikitext
10509 start
10510 ==a==
10511 ===aa===
10512 ====aaa====
10513 ==b==
10514 ===ba===
10515 ===bb===
10516 ====bba====
10517 ===bc===
10518 ==c==
10519 ===ca===
10520 !! html/php
10521 start
10522 ==a==
10523 ===aa===
10524 ====aaa====
10525 xxx
10526
10527 ==c==
10528 ===ca===
10529 !! end
10530
10531 !! test
10532 Section replacement test (section 5)
10533 !! options
10534 replace=5,"xxx"
10535 !! wikitext
10536 start
10537 ==a==
10538 ===aa===
10539 ====aaa====
10540 ==b==
10541 ===ba===
10542 ===bb===
10543 ====bba====
10544 ===bc===
10545 ==c==
10546 ===ca===
10547 !! html/php
10548 start
10549 ==a==
10550 ===aa===
10551 ====aaa====
10552 ==b==
10553 xxx
10554
10555 ===bb===
10556 ====bba====
10557 ===bc===
10558 ==c==
10559 ===ca===
10560 !! end
10561
10562 !! test
10563 Section replacement test (section 6)
10564 !! options
10565 replace=6,"xxx"
10566 !! wikitext
10567 start
10568 ==a==
10569 ===aa===
10570 ====aaa====
10571 ==b==
10572 ===ba===
10573 ===bb===
10574 ====bba====
10575 ===bc===
10576 ==c==
10577 ===ca===
10578 !! html/php
10579 start
10580 ==a==
10581 ===aa===
10582 ====aaa====
10583 ==b==
10584 ===ba===
10585 xxx
10586
10587 ===bc===
10588 ==c==
10589 ===ca===
10590 !! end
10591
10592 !! test
10593 Section replacement test (section 7)
10594 !! options
10595 replace=7,"xxx"
10596 !! wikitext
10597 start
10598 ==a==
10599 ===aa===
10600 ====aaa====
10601 ==b==
10602 ===ba===
10603 ===bb===
10604 ====bba====
10605 ===bc===
10606 ==c==
10607 ===ca===
10608 !! html/php
10609 start
10610 ==a==
10611 ===aa===
10612 ====aaa====
10613 ==b==
10614 ===ba===
10615 ===bb===
10616 xxx
10617
10618 ===bc===
10619 ==c==
10620 ===ca===
10621 !! end
10622
10623 !! test
10624 Section replacement test (section 8)
10625 !! options
10626 replace=8,"xxx"
10627 !! wikitext
10628 start
10629 ==a==
10630 ===aa===
10631 ====aaa====
10632 ==b==
10633 ===ba===
10634 ===bb===
10635 ====bba====
10636 ===bc===
10637 ==c==
10638 ===ca===
10639 !! html/php
10640 start
10641 ==a==
10642 ===aa===
10643 ====aaa====
10644 ==b==
10645 ===ba===
10646 ===bb===
10647 ====bba====
10648 xxx
10649
10650 ==c==
10651 ===ca===
10652 !!end
10653
10654 !! test
10655 Section replacement test (section 9)
10656 !! options
10657 replace=9,"xxx"
10658 !! wikitext
10659 start
10660 ==a==
10661 ===aa===
10662 ====aaa====
10663 ==b==
10664 ===ba===
10665 ===bb===
10666 ====bba====
10667 ===bc===
10668 ==c==
10669 ===ca===
10670 !! html/php
10671 start
10672 ==a==
10673 ===aa===
10674 ====aaa====
10675 ==b==
10676 ===ba===
10677 ===bb===
10678 ====bba====
10679 ===bc===
10680 xxx
10681 !! end
10682
10683 !! test
10684 Section replacement test (section 10)
10685 !! options
10686 replace=10,"xxx"
10687 !! wikitext
10688 start
10689 ==a==
10690 ===aa===
10691 ====aaa====
10692 ==b==
10693 ===ba===
10694 ===bb===
10695 ====bba====
10696 ===bc===
10697 ==c==
10698 ===ca===
10699 !! html/php
10700 start
10701 ==a==
10702 ===aa===
10703 ====aaa====
10704 ==b==
10705 ===ba===
10706 ===bb===
10707 ====bba====
10708 ===bc===
10709 ==c==
10710 xxx
10711 !! end
10712
10713 !! test
10714 Section replacement test with initial whitespace (T15728)
10715 !! options
10716 replace=2,"xxx"
10717 !! wikitext
10718 Preformatted initial line
10719 ==a==
10720 ===a===
10721 !! html/php
10722 Preformatted initial line
10723 ==a==
10724 xxx
10725 !! end
10726
10727
10728 !! test
10729 Section extraction, heading followed by pre with 20 spaces (T8398)
10730 !! options
10731 section=1
10732 !! wikitext
10733 ==a==
10734 a
10735 !! html/php
10736 ==a==
10737 a
10738 !! end
10739
10740 !! test
10741 Section extraction, heading followed by pre with 19 spaces (T8398 check)
10742 !! options
10743 section=1
10744 !! wikitext
10745 ==a==
10746 a
10747 !! html/php
10748 ==a==
10749 a
10750 !! end
10751
10752
10753 !! test
10754 Section extraction, <pre> around bogus header (T12309)
10755 !! options
10756 section=2
10757 !! wikitext
10758 == Section One ==
10759 <pre>
10760 =======
10761 </pre>
10762
10763 == Section Two ==
10764 stuff
10765 !! html/php
10766 == Section Two ==
10767 stuff
10768 !! end
10769
10770 !! test
10771 Section replacement, <pre> around bogus header (T12309)
10772 !! options
10773 replace=2,"xxx"
10774 !! wikitext
10775 == Section One ==
10776 <pre>
10777 =======
10778 </pre>
10779
10780 == Section Two ==
10781 stuff
10782 !! html/php
10783 == Section One ==
10784 <pre>
10785 =======
10786 </pre>
10787
10788 xxx
10789 !! end
10790
10791 !! test
10792 Handling of &#x0A; in URLs
10793 !! wikitext
10794 *irc://&#x0A;a
10795 !! html/php
10796 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
10797 !! html/parsoid
10798 <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>
10799 !! end
10800
10801 !! test
10802 Handling of %0A in URLs
10803 !! wikitext
10804 *irc://%0Aa
10805 !! html/php
10806 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
10807 !! html/parsoid
10808 <ul><li><a rel="mw:ExtLink" href="irc://%0Aa" class="external free">irc://%0Aa</a></li></ul>
10809 !! end
10810
10811 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
10812 !! test
10813 5 quotes, code coverage +1 line
10814 !! options
10815 parsoid=wt2html
10816 !! wikitext
10817 '''''
10818 !! html/php
10819 !! html/parsoid
10820 <p><b><i></i></b></p>
10821 !! end
10822
10823 # same html as previous, but wikitext adjusted to match parsoid html2wt
10824 # note that wt2html will put the <i> before the <b>
10825 !! test
10826 5 quotes, code coverage +1 line (1)
10827 !! options
10828 parsoid=html2wt
10829 !! html/parsoid
10830 <p><b><i></i></b></p>
10831 !! wikitext
10832 !! end
10833
10834 # same as previous, just swapping the <i> and <b>
10835 !! test
10836 5 quotes, code coverage +1 line (2)
10837 !! options
10838 parsoid=html2wt
10839 !! html/parsoid
10840 <p><i><b></b></i></p>
10841 !! wikitext
10842 !! end
10843
10844 !! test
10845 Special:Search page linking.
10846 !! wikitext
10847 {{Special:search}}
10848 !! html/php
10849 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10850 </p>
10851 !! html/parsoid+integrated
10852 <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>
10853 !! end
10854
10855 !! test
10856 {{!}} is a magic word
10857 !! wikitext
10858 {{!}} is a magic word there and {{!}} is still a magic word here
10859 | is not a magic word here but {{!}} is still a magic word here
10860 !! html/php
10861 <p>| is a magic word there and | is still a magic word here
10862 | is not a magic word here but | is still a magic word here
10863 </p>
10864 !! html/parsoid
10865 <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
10866 | 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>
10867 !! end
10868
10869 !! test
10870 Single {{!}} in table cell
10871 !! wikitext
10872 {|
10873 | colspan="1" |foo {{!}} bar
10874 |}
10875 !! html/php
10876 <table>
10877 <tbody><tr>
10878 <td colspan="1">foo | bar
10879 </td></tr></tbody></table>
10880 !! html/parsoid
10881 <table>
10882 <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>
10883 </tbody></table>
10884 !! end
10885
10886 !! article
10887 Template:T290526
10888 !! text
10889 Main Page{{!}}Something else
10890 !! endarticle
10891
10892 !! test
10893 Using {{!}} in wikilinks (T290526)
10894 !! wikitext
10895 [[Main Page{{!}}Something else]]
10896
10897 [[{{T290526}}]]
10898 !! html
10899 <p><a href="/wiki/Main_Page" title="Main Page">Something else</a>
10900 </p><p><a href="/wiki/Main_Page" title="Main Page">Something else</a>
10901 </p>
10902 !! end
10903
10904 !! test
10905 Using {{!}} in template arguments (T290526)
10906 !! wikitext
10907 {{1x|Main Page{{!}}Something else}}
10908
10909 {{1x|{{T290526}}}}
10910 !! html/php
10911 <p>Main Page|Something else
10912 </p><p>Main Page|Something else
10913 </p>
10914 !! html/parsoid
10915 <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>
10916
10917 <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>
10918 !! end
10919
10920 # wt2wt,html2wt,html2html modes will add <nowiki> around the {{ }} in
10921 # the last line
10922 !! test
10923 Using {{!}} in template arguments, part 2 (T290526)
10924 !! options
10925 parsoid=wt2html
10926 !! wikitext
10927 {{ Main Page|Something else }}
10928
10929 {{ {{T290526}} }}
10930 !! html/php
10931 <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>
10932 </p><p>{{ Main Page|Something else }}
10933 </p>
10934 !! html/parsoid
10935 <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>
10936
10937 <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>
10938 !! end
10939
10940 !! test
10941 Say the magic word
10942 !! options
10943 title=[[Parser test]]
10944 !! wikitext
10945 *{{PAGENAME}}
10946 *{{PAGENAMEE}}
10947 *{{FULLPAGENAME}}
10948 *{{FULLPAGENAMEE}}
10949 *{{BASEPAGENAME}}
10950 *{{BASEPAGENAMEE}}
10951 *{{SUBPAGENAME}}
10952 *{{SUBPAGENAMEE}}
10953 *{{ROOTPAGENAME}}
10954 *{{ROOTPAGENAMEE}}
10955 *{{TALKPAGENAME}}
10956 *{{TALKPAGENAMEE}}
10957 *{{SUBJECTPAGENAME}}
10958 *{{SUBJECTPAGENAMEE}}
10959 *{{NAMESPACEE}}
10960 *{{NAMESPACE}}
10961 *{{NAMESPACENUMBER}}
10962 *{{TALKSPACE}}
10963 *{{TALKSPACEE}}
10964 *{{SUBJECTSPACE}}
10965 *{{SUBJECTSPACEE}}
10966 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10967 !! html/php
10968 <ul><li>Parser test</li>
10969 <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>Talk:Parser test</li>
10979 <li>Talk:Parser_test</li>
10980 <li>Parser test</li>
10981 <li>Parser_test</li>
10982 <li class="mw-empty-elt"></li>
10983 <li class="mw-empty-elt"></li>
10984 <li>0</li>
10985 <li>Talk</li>
10986 <li>Talk</li>
10987 <li class="mw-empty-elt"></li>
10988 <li class="mw-empty-elt"></li>
10989 <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>
10990 !! html/parsoid
10991 <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>
10992 <li><span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"PAGENAMEE","function":"pagenamee"},"params":{},"i":0}}]}'></span></li>
10993 <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>
10994 <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>
10995 <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>
10996 <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>
10997 <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>
10998 <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>
10999 <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>
11000 <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>
11001 <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>
11002 <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>
11003 <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>
11004 <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>
11005 <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>
11006 <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>
11007 <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>
11008 <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>
11009 <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>
11010 <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>
11011 <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>
11012 <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>
11013 !! html/parsoid+integrated
11014 <ul><li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"PAGENAME","function":"pagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11015 <li><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"PAGENAMEE","function":"pagenamee"},"params":{},"i":0}}]}'>Parser_test</span></li>
11016 <li><span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"FULLPAGENAME","function":"fullpagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11017 <li><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"FULLPAGENAMEE","function":"fullpagenamee"},"params":{},"i":0}}]}'>Parser_test</span></li>
11018 <li><span about="#mwt5" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"BASEPAGENAME","function":"basepagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11019 <li><span about="#mwt6" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"BASEPAGENAMEE","function":"basepagenamee"},"params":{},"i":0}}]}'>Parser_test</span></li>
11020 <li><span about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SUBPAGENAME","function":"subpagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11021 <li><span about="#mwt8" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SUBPAGENAMEE","function":"subpagenamee"},"params":{},"i":0}}]}'>Parser_test</span></li>
11022 <li><span about="#mwt9" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ROOTPAGENAME","function":"rootpagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11023 <li><span about="#mwt10" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ROOTPAGENAMEE","function":"rootpagenamee"},"params":{},"i":0}}]}'>Parser_test</span></li>
11024 <li><span about="#mwt11" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"TALKPAGENAME","function":"talkpagename"},"params":{},"i":0}}]}'>Talk:Parser test</span></li>
11025 <li><span about="#mwt12" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"TALKPAGENAMEE","function":"talkpagenamee"},"params":{},"i":0}}]}'>Talk:Parser_test</span></li>
11026 <li><span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SUBJECTPAGENAME","function":"subjectpagename"},"params":{},"i":0}}]}'>Parser test</span></li>
11027 <li><span about="#mwt14" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SUBJECTPAGENAMEE","function":"subjectpagenamee"},"params":{},"i":0}}]}'>Parser_test</span></li>
11028 <li><span about="#mwt15" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"NAMESPACEE","function":"namespacee"},"params":{},"i":0}}]}'></span></li>
11029 <li><span about="#mwt16" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"NAMESPACE","function":"namespace"},"params":{},"i":0}}]}'></span></li>
11030 <li><span about="#mwt17" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"NAMESPACENUMBER","function":"namespacenumber"},"params":{},"i":0}}]}'>0</span></li>
11031 <li><span about="#mwt18" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"TALKSPACE","function":"talkspace"},"params":{},"i":0}}]}'>Talk</span></li>
11032 <li><span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"TALKSPACEE","function":"talkspacee"},"params":{},"i":0}}]}'>Talk</span></li>
11033 <li><span about="#mwt20" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SUBJECTSPACE","function":"subjectspace"},"params":{},"i":0}}]}'></span></li>
11034 <li><span about="#mwt21" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SUBJECTSPACEE","function":"subjectspacee"},"params":{},"i":0}}]}'></span></li>
11035 <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>
11036 !! end
11037 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11038
11039 !! test
11040 HTML Hex character encoding (spells the word "JavaScript")
11041 !! options
11042 parsoid=wt2html,wt2wt,html2html
11043 !! wikitext
11044 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11045 !! html/php
11046 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11047 </p>
11048 !! html/parsoid
11049 <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>
11050 !! end
11051
11052 !! test
11053 HTML Hex character encoding bogus encoding (T28437 regression check)
11054 !! wikitext
11055 &#xsee;&#XSEE;
11056 !! html
11057 <p>&amp;#xsee;&amp;#XSEE;
11058 </p>
11059 !! end
11060
11061 !! test
11062 HTML Hex character encoding mixed case
11063 !! options
11064 parsoid=wt2html,wt2wt,html2html
11065 !! wikitext
11066 &#xEE;&#Xee;
11067 !! html/php
11068 <p>&#xee;&#xee;
11069 </p>
11070 !! html/parsoid
11071 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
11072 !! end
11073
11074 # See: https://www.w3.org/TR/html5/syntax.html#character-references
11075 # Note that U+000C (form feed) is not a valid XML character, so
11076 # it is banned even though allowed in HTML5.
11077 # Note there are also weird legacy numeric entities which are mapped
11078 # elsewhere; see T113194
11079 !! test
11080 Illegal character references (T106578, T113194)
11081 !! options
11082 parsoid={ "modes": ["wt2html","html2html"], "normalizePhp": true }
11083 !! wikitext
11084 ; Null: &#00;
11085 ; FF: &#xC;
11086 ; CR: &#xD;
11087 ; Control (low): &#8;
11088 ; Control (high): &#x7F; &#x9F;
11089 ; Unsupported legacy: &#128; &#130; &#131; &#150; &#159;
11090 ; Surrogate: &#xD83D;&#xDCA9;
11091 ; Invalid characters: &#xfffe; &#xffff;
11092 ; This is an okay astral character: &#x1F4A9;
11093 ; This is an okay multi-codepoint HTML5 entity: &acE;
11094 ; This are valid wikitext-specific entities: &רלמ; &رلم;
11095 ; Highest valid characters: &#x10fffd; &#x10fffe; &#x10ffff;
11096 !! html
11097 <dl><dt>Null</dt>
11098 <dd>&amp;#00;</dd>
11099 <dt>FF</dt>
11100 <dd>&amp;#xC;</dd>
11101 <dt>CR</dt>
11102 <dd>&amp;#xD;</dd>
11103 <dt>Control (low)</dt>
11104 <dd>&amp;#8;</dd>
11105 <dt>Control (high)</dt>
11106 <dd>&amp;#x7F; &amp;#x9F;</dd>
11107 <dt>Unsupported legacy</dt>
11108 <dd>&amp;#128; &amp;#130; &amp;#131; &amp;#150; &amp;#159;</dd>
11109 <dt>Surrogate</dt>
11110 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
11111 <dt>Invalid characters</dt>
11112 <dd>&amp;#xfffe; &amp;#xffff;</dd>
11113 <dt>This is an okay astral character</dt>
11114 <dd>&#x1f4a9;</dd>
11115 <dt>This is an okay multi-codepoint HTML5 entity</dt>
11116 <dd>&#8766;&#819;</dd>
11117 <dt>This are valid wikitext-specific entities</dt>
11118 <dd>&#8207; &#8207;</dd>
11119 <dt>Highest valid characters</dt>
11120 <dd>&#x10fffd; &#x10fffe; &#x10ffff;</dd></dl>
11121 !! end
11122
11123 !! test
11124 Another italics / bold test
11125 !! options
11126 parsoid=wt2html
11127 !! wikitext
11128 ''' ''x'
11129 !! html/*
11130 <pre>'<i> </i>x'
11131 </pre>
11132 !! end
11133
11134 !! test
11135 dt/dd/dl test
11136 !! wikitext
11137 :;;;::
11138 !! html
11139 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
11140 !! end
11141
11142 !! test
11143 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11144 !! wikitext
11145 <html><script>alert(1);</script></html>
11146 !! html
11147 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11148 </p>
11149 !! end
11150
11151 !! test
11152 HTML with raw HTML ($wgRawHtml==true)
11153 !! options
11154 wgRawHtml=1
11155 !! wikitext
11156 <html><script>alert(1);</script></html>
11157 !! html/php
11158 <p><script>alert(1);</script>
11159 </p>
11160 !! html/parsoid
11161 <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>
11162 !! end
11163
11164 !! test
11165 Empty tag w/ raw HTML ($wgRawHtml==true)
11166 !! options
11167 wgRawHtml=1
11168 !! wikitext
11169 <html />
11170 !! html/php
11171 <p class="mw-empty-elt">
11172 </p>
11173 !! html/parsoid
11174 <p><link typeof="mw:Extension/html" about="#mwt2" data-mw='{"name":"html","attrs":{}}'/></p>
11175 !! end
11176
11177
11178 !! article
11179 Subpage test
11180 !! text
11181 subpage
11182 !! end
11183
11184 !! article
11185 Subpage test/L1
11186 !! text
11187 subpage l1
11188 !! end
11189
11190 !! article
11191 Subpage test/L1/L2
11192 !! text
11193 subpage l2
11194 !! end
11195
11196 !! test
11197 Parents of subpages, one level up
11198 !! options
11199 subpage title=[[Subpage test/L1/L2/L3]]
11200 !! wikitext
11201 [[../|L2]]
11202 !! html/php
11203 <p><a href="/wiki/Subpage_test/L1/L2" title="Subpage test/L1/L2">L2</a>
11204 </p>
11205 !! html/parsoid
11206 <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>
11207 !! end
11208
11209 !! test
11210 Parents of subpages, one level up, not named
11211 !! options
11212 subpage title=[[Subpage test/L1/L2/L3]]
11213 !! wikitext
11214 [[../]]
11215 !! html/php
11216 <p><a href="/wiki/Subpage_test/L1/L2" title="Subpage test/L1/L2">Subpage test/L1/L2</a>
11217 </p>
11218 !! html/parsoid
11219 <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>
11220 !! end
11221
11222 !! test
11223 Parents of subpages, two levels up
11224 !! options
11225 subpage title=[[Subpage test/L1/L2/L3]]
11226 !! wikitext
11227 [[../../|L1]]2
11228
11229 [[../../|L1]]l
11230 !! html/php
11231 <p><a href="/wiki/Subpage_test/L1" title="Subpage test/L1">L1</a>2
11232 </p><p><a href="/wiki/Subpage_test/L1" title="Subpage test/L1">L1l</a>
11233 </p>
11234 !! html/parsoid
11235 <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>
11236
11237 <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>
11238 !! end
11239
11240 !! test
11241 Parents of subpages, two levels up, without trailing slash or name.
11242 !! options
11243 subpage title=[[Subpage test/L1/L2/L3]]
11244 !! wikitext
11245 [[../..]]
11246 !! html
11247 <p>[[../..]]
11248 </p>
11249 !! end
11250
11251 !! test
11252 Parents of subpages, two levels up, with lots of extra trailing slashes.
11253 !! options
11254 subpage title=[[Subpage test/L1/L2/L3]]
11255 !! wikitext
11256 [[../../////]]
11257 !! html/php
11258 <p><a href="/wiki/Subpage_test/L1" title="Subpage test/L1">Subpage test/L1</a>
11259 </p>
11260 !! html/parsoid
11261 <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>
11262 !! end
11263
11264 !! article
11265 Subpage test/L1/L2/L3Sibling
11266 !! text
11267 Sibling article
11268 !! endarticle
11269
11270 !! test
11271 Transclusion of a sibling page (one level up)
11272 !! options
11273 subpage title=[[Subpage test/L1/L2/L3]]
11274 !! wikitext
11275 {{../L3Sibling}}
11276 !! html
11277 <p>Sibling article
11278 </p>
11279 !! end
11280
11281 !! test
11282 Transclusion of a child page
11283 !! options
11284 subpage title=[[Subpage test/L1/L2]]
11285 !! wikitext
11286 {{/L3Sibling}}
11287 !! html
11288 <p>Sibling article
11289 </p>
11290 !! end
11291
11292 # This is wt2html only in Parsoid because we add <nowiki>
11293 # because of {{..}} and we don't expect to fix that to
11294 # eliminate the nowikis selective for {{..}} markup.
11295 !! test
11296 Non-transclusion because of too many up levels
11297 !! options
11298 subpage title=[[Subpage test/L1/L2/L3]]
11299 parsoid=wt2html
11300 !! wikitext
11301 {{../../../../More than parent}}
11302 !! html/php
11303 <p>{{../../../../More than parent}}
11304 </p>
11305 !! html/parsoid
11306 <p>{{../../../../More than parent}}</p>
11307 !! end
11308
11309 !! test
11310 Definition list code coverage
11311 !! options
11312 parsoid=wt2html,html2html
11313 !! wikitext
11314 ;title :def
11315 ;title :def
11316 ;title:def
11317 !! html/php
11318 <dl><dt>title</dt>
11319 <dd>def</dd>
11320 <dt>title</dt>
11321 <dd>def</dd>
11322 <dt>title</dt>
11323 <dd>def</dd></dl>
11324 !! html/parsoid
11325 <dl><dt>title </dt><dd>def</dd>
11326 <dt>title </dt><dd>def</dd>
11327 <dt>title</dt><dd>def</dd></dl>
11328 !! end
11329
11330 !! test
11331 Don't fall for the self-closing div
11332 !! wikitext
11333 <div>hello world</div/>
11334 !! html
11335 <div>hello world</div>
11336 !! end
11337
11338 !! test
11339 MSGNW magic word
11340 !! wikitext
11341 {{MSGNW:msg}}
11342 !! html/php
11343 <p>&#91;&#91;:Template:Msg&#93;&#93;
11344 </p>
11345 !! end
11346
11347 !! test
11348 RAW magic word
11349 !! wikitext
11350 {{RAW:QUERTY}}
11351 !! html/php
11352 <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>
11353 </p>
11354 !! html/parsoid+integrated
11355 <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>
11356 !! end
11357
11358 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11359 !! test
11360 Always escape literal '>' in output, not just after '<'
11361 !! wikitext
11362 ><>
11363 !! html
11364 <p>&gt;&lt;&gt;
11365 </p>
11366 !! end
11367
11368 !! test
11369 Template caching
11370 !! wikitext
11371 {{Test}}
11372 {{Test}}
11373 !! html
11374 <p>This is a test template
11375 This is a test template
11376 </p>
11377 !! end
11378
11379 !! test
11380 anchorencode
11381 !! config
11382 wgFragmentMode=[ "html5", "legacy" ]
11383 !! wikitext
11384 {{anchorencode:foo bar©#%n}}
11385 !! html/php
11386 <p>foo_bar©#%n
11387 </p>
11388 !! html/parsoid
11389 <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>
11390 !! end
11391
11392 !! test
11393 anchorencode (legacy)
11394 !! config
11395 wgFragmentMode=[ "legacy" ]
11396 !! wikitext
11397 {{anchorencode:foo bar©#%n}}
11398 !! html/php
11399 <p>foo_bar.C2.A9.23.25n
11400 </p>
11401 !! end
11402
11403 !! test
11404 anchorencode trims spaces
11405 !! config
11406 wgFragmentMode=[ "html5", "legacy" ]
11407 !! wikitext
11408 {{anchorencode: __pretty__please__}}
11409 !! html/php
11410 <p>pretty_please
11411 </p>
11412 !! html/parsoid
11413 <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>
11414 !! end
11415
11416 !! test
11417 anchorencode deals with links
11418 !! config
11419 wgFragmentMode=[ "html5", "legacy" ]
11420 !! wikitext
11421 {{anchorencode: [[hello|world]] [[hi]]}}
11422 !! html/php
11423 <p>world_hi
11424 </p>
11425 !! html/parsoid
11426 <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>
11427 !! end
11428
11429 !! test
11430 anchorencode deals with templates
11431 !! config
11432 wgFragmentMode=[ "html5", "legacy" ]
11433 !! wikitext
11434 {{anchorencode: {{Foo}} x}}
11435 !! html/php
11436 <p>FOO_x
11437 </p>
11438 !! html/parsoid
11439 <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>
11440 !! end
11441
11442 !! test
11443 anchorencode encodes like the TOC generator: (T20431)
11444 !! config
11445 wgFragmentMode=[ "html5", "legacy" ]
11446 wgParserEnableLegacyHeadingDOM=false
11447 !! wikitext
11448 ===_ +:.3A%3A _ &&amp;]] x===
11449 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
11450
11451 __NOEDITSECTION__
11452 !! html/php
11453 <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>
11454 <p>+:.3A%253A_&amp;&amp;&#93;&#93;_x
11455 </p><p><br />
11456 </p>
11457 !! html/parsoid+standalone
11458 <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>
11459 <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>
11460 <meta property="mw:PageProp/noeditsection"/>
11461 !! html/parsoid+integrated
11462 <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>
11463 <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>
11464 <meta property="mw:PageProp/noeditsection"/>
11465 !! end
11466
11467 !! test
11468 anchorencode encodes like the TOC generator: (T20431) (legacy)
11469 !! config
11470 wgFragmentMode=[ "legacy" ]
11471 wgParserEnableLegacyHeadingDOM=false
11472 !! wikitext
11473 ===_ +:.3A%3A&&amp;]]===
11474 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11475 __NOEDITSECTION__
11476 !! html/php
11477 <div class="mw-heading mw-heading3"><h3 id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</h3></div>
11478 <p>.2B:.3A.253A.26.26.5D.5D
11479 </p>
11480 !! end
11481
11482 !! test
11483 T8200: blockquotes and paragraph formatting
11484 !! wikitext
11485 <blockquote>
11486 foo
11487 </blockquote>
11488
11489 bar
11490
11491 baz
11492 !! html
11493 <blockquote>
11494 <p>foo
11495 </p>
11496 </blockquote>
11497 <p>bar
11498 </p>
11499 <pre>baz
11500 </pre>
11501 !! end
11502
11503 !! test
11504 T10293: Use of center tag ruins paragraph formatting
11505 !! wikitext
11506 <center>
11507 foo
11508 </center>
11509
11510 bar
11511
11512 baz
11513 !! html
11514 <center>
11515 <p>foo
11516 </p>
11517 </center>
11518 <p>bar
11519 </p>
11520 <pre>baz
11521 </pre>
11522 !! end
11523
11524 !!test
11525 Parsing of overlapping (improperly nested) inline html tags
11526 !! wikitext
11527 <span><s>x</span></s>
11528 !! html
11529 <p><span><s>x</s></span>
11530 </p>
11531 !!end
11532
11533 !! test
11534 T2529: Uncovered bullet
11535 !! wikitext
11536 *Foo {{bullet}}
11537 !! html/php
11538 <ul><li>Foo</li>
11539 <li>Bar</li></ul>
11540 !! html/parsoid
11541 <ul><li>Foo</li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'>
11542 </span><li about="#mwt1">Bar</li></ul>
11543 !! end
11544
11545 !! test
11546 T2529: Uncovered bullet in a deeply nested list
11547 !! wikitext
11548 *******Foo {{bullet}}
11549 !! html/php
11550 <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>
11551 <li>Bar</li></ul>
11552 !! html/parsoid
11553 <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}}]}'>
11554 </span><li about="#mwt1">Bar</li></ul>
11555 !! end
11556
11557 !! test
11558 T2529: Uncovered table already at line-start
11559 !! wikitext
11560 x
11561
11562 {{table}}
11563 y
11564 !! html/php
11565 <p>x
11566 </p>
11567 <table>
11568 <tbody><tr>
11569 <td>1</td>
11570 <td>2
11571 </td></tr>
11572 <tr>
11573 <td>3</td>
11574 <td>4
11575 </td></tr></tbody></table>
11576 <p>y
11577 </p>
11578 !! html/parsoid
11579 <p>x</p>
11580
11581 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"table","href":"./Template:Table"},"params":{},"i":0}}]}'>
11582 <tbody><tr><td>1</td><td>2</td></tr>
11583 <tr>
11584 <td>3</td><td>4</td></tr>
11585 </tbody></table>
11586 <p>y</p>
11587 !! end
11588
11589 !! test
11590 T2529: Uncovered bullet in parser function result
11591 !! wikitext
11592 *Foo{{lc:{{bullet}} }}
11593 !! html/php
11594 <ul><li>Foo</li>
11595 <li>bar</li></ul>
11596 !! html/parsoid+integrated
11597 <ul><li>Foo</li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"lc:{{bullet}} ","function":"lc"},"params":{},"i":0}}]}'>
11598 </span><li about="#mwt1">bar</li></ul>
11599 !! end
11600
11601 !! test
11602 T7678: Double-parsed template argument
11603 !! wikitext
11604 {{lc:{{{1}}}|hello}}
11605 !! html
11606 <p>{{{1}}}
11607 </p>
11608 !! end
11609
11610 ## wt2html only, since the bare {{ will get escaped when serializing
11611 !! test
11612 T7678: Double-parsed template invocation
11613 !! options
11614 parsoid=wt2html
11615 !! wikitext
11616 {{lc:{{paramtest {{!}} param = hello }} }}
11617 !! html/php
11618 <p>{{paramtest | param = hello }}
11619 </p>
11620 !! html/parsoid+integrated
11621 <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>
11622 !! end
11623
11624 !! test
11625 Case insensitivity of parser functions for non-ASCII characters (T10143)
11626 !! options
11627 language=cs
11628 title=[[Main Page]]
11629 !! wikitext
11630 {{PRVNÍVELKÉ:ěščř}}
11631 {{prvnívelké:ěščř}}
11632 {{PRVNÍMALÉ:ěščř}}
11633 {{prvnímalé:ěščř}}
11634 {{MALÁ:ěščř}}
11635 {{malá:ěščř}}
11636 {{VELKÁ:ěščř}}
11637 {{velká:ěščř}}
11638 !! html
11639 <p>Ěščř
11640 Ěščř
11641 ěščř
11642 ěščř
11643 ěščř
11644 ěščř
11645 ĚŠČŘ
11646 ĚŠČŘ
11647 </p>
11648 !! end
11649
11650 !! test
11651 Paragraphs inside divs (no extra line breaks)
11652 !! wikitext
11653 <div>Line one
11654
11655 Line two</div>
11656 !! html
11657 <div>Line one
11658 Line two</div>
11659 !! end
11660
11661 !! test
11662 Paragraphs inside divs (extra line break on open)
11663 !! wikitext
11664 <div>
11665 Line one
11666
11667 Line two</div>
11668 !! html
11669 <div>
11670 <p>Line one
11671 </p>
11672 Line two</div>
11673 !! end
11674
11675 !! test
11676 Paragraphs inside divs (extra line break on close)
11677 !! wikitext
11678 <div>Line one
11679
11680 Line two
11681 </div>
11682 !! html
11683 <div>Line one
11684 <p>Line two
11685 </p>
11686 </div>
11687 !! end
11688
11689 !! test
11690 Paragraphs inside divs (extra line break on open and close)
11691 !! wikitext
11692 <div>
11693 Line one
11694
11695 Line two
11696 </div>
11697 !! html
11698 <div>
11699 <p>Line one
11700 </p><p>Line two
11701 </p>
11702 </div>
11703 !! end
11704
11705 # doBlockLevels screws up this output and Remex cleans up as much as it can.
11706 !! test
11707 Nesting tags, paragraphs on lines which begin with <div>
11708 !! wikitext
11709 <div></div><strong>A
11710 B</strong>
11711 !! html/php
11712 <div></div><p><strong>A
11713 </strong></p><strong></strong><p><strong>B</strong>
11714 </p>
11715 !! html/parsoid
11716 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
11717 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
11718 !! end
11719
11720 # T8200: <blockquote> should behave like <div> with respect to line breaks
11721 !! test
11722 T8200: paragraphs inside blockquotes (no extra line breaks)
11723 !! wikitext
11724 <blockquote>Line one
11725
11726 Line two</blockquote>
11727 !! html
11728 <blockquote><p>Line one
11729 Line two</p></blockquote>
11730 !! end
11731
11732 !! test
11733 T8200: paragraphs inside blockquotes (extra line break on open)
11734 !! wikitext
11735 <blockquote>
11736 Line one
11737
11738 Line two</blockquote>
11739 !! html
11740 <blockquote>
11741 <p>Line one
11742 </p><p>
11743 Line two</p></blockquote>
11744 !! end
11745
11746 !! test
11747 T8200: paragraphs inside blockquotes (extra line break on close)
11748 !! wikitext
11749 <blockquote>Line one
11750
11751 Line two
11752 </blockquote>
11753 !! html
11754 <blockquote><p>Line one
11755 </p><p>Line two
11756 </p>
11757 </blockquote>
11758 !! end
11759
11760 !! test
11761 T8200: paragraphs inside blockquotes (extra line break on open and close)
11762 !! wikitext
11763 <blockquote>
11764 Line one
11765
11766 Line two
11767 </blockquote>
11768 !! html
11769 <blockquote>
11770 <p>Line one
11771 </p><p>Line two
11772 </p>
11773 </blockquote>
11774 !! end
11775
11776 ## This is a corner case interaction between the paragraph wrapping in the
11777 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
11778 ## some tags which close paragraphs (and thus prevent wrapping on their line),
11779 ## of which "div" is one, but do p-wrapping inside them. These are referred
11780 ## to as "never suppressing". Remex, for its part, doesn't traverse into
11781 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
11782 !! test
11783 Paragraphs inside blockquotes/divs (no extra line breaks)
11784 !! wikitext
11785 <blockquote><div>Line one
11786
11787 Line two</div></blockquote>
11788 !! html
11789 <blockquote><div>Line one
11790 Line two</div></blockquote>
11791 !! end
11792
11793 !! test
11794 Paragraphs inside blockquotes/divs (extra line break on open)
11795 !! wikitext
11796 <blockquote><div>
11797 Line one
11798
11799 Line two</div></blockquote>
11800 !! html
11801 <blockquote><div>
11802 <p>Line one
11803 </p>
11804 Line two</div></blockquote>
11805 !! end
11806
11807 !! test
11808 Paragraphs inside blockquotes/divs (extra line break on close)
11809 !! wikitext
11810 <blockquote><div>Line one
11811
11812 Line two
11813 </div></blockquote>
11814 !! html
11815 <blockquote><div>Line one
11816 <p>Line two
11817 </p>
11818 </div></blockquote>
11819 !! end
11820
11821 !! test
11822 Paragraphs inside blockquotes/divs (extra line break on open and close)
11823 !! wikitext
11824 <blockquote><div>
11825 Line one
11826
11827 Line two
11828 </div></blockquote>
11829 !! html
11830 <blockquote><div>
11831 <p>Line one
11832 </p><p>Line two
11833 </p>
11834 </div></blockquote>
11835 !! end
11836
11837 !! test
11838 Interwiki links trounced by handleExternalLinks after early LinkHolderArray expansion
11839 !! options
11840 wgLinkHolderBatchSize=0
11841 !! wikitext
11842 [[meatball:1]]
11843 [[meatball:2]]
11844 [[meatball:3]]
11845 !! html
11846 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
11847 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
11848 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
11849 </p>
11850 !! end
11851
11852 !! test
11853 T17196: localised external link numbers
11854 !! options
11855 language=fa
11856 !! wikitext
11857 [http://en.wikipedia.org/]
11858 !! html/php
11859 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
11860 </p>
11861 !! html/parsoid
11862 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/" class="external autonumber"></a></p>
11863 !! end
11864
11865 !! test
11866 Multibyte character in padleft
11867 !! wikitext
11868 {{padleft:-Hello|7|Æ}}
11869 !! html/php
11870 <p>Æ-Hello
11871 </p>
11872 !! html/parsoid
11873 <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>
11874 !! end
11875
11876 !! test
11877 Multibyte character in padright
11878 !! wikitext
11879 {{padright:Hello-|7|Æ}}
11880 !! html/php
11881 <p>Hello-Æ
11882 </p>
11883 !! html/parsoid
11884 <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>
11885 !! end
11886
11887 !!test
11888 formatdate parser function
11889 !! wikitext
11890 {{#formatdate:2009-03-24}}
11891 !! html/php
11892 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
11893 </p>
11894 !! html/parsoid+integrated
11895 <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>
11896 !! end
11897
11898 !!test
11899 formatdate parser function, with default format
11900 !! wikitext
11901 {{#formatdate:2009-03-24|mdy}}
11902 !! html/php
11903 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
11904 </p>
11905 !! html/parsoid+integrated
11906 <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>
11907 !! end
11908
11909 !! test
11910 Spacing of numbers in formatted dates
11911 !! wikitext
11912 {{#formatdate:January 15}}
11913 !! html/php
11914 <p><span class="mw-formatted-date" title="01-15">January 15</span>
11915 </p>
11916 !! html/parsoid+integrated
11917 <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>
11918 !! end
11919
11920 !! test
11921 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
11922 !! options
11923 language=nl title=[[MediaWiki:Common.css]]
11924 !! wikitext
11925 {{#formatdate:2009-03-24|dmy}}
11926 !! html/php
11927 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
11928 </p>
11929 !! html/parsoid+integrated
11930 <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>
11931 !! end
11932
11933 !! test
11934 formatdate with invalid month
11935 !! wikitext
11936 {{#formatdate:2019-22-22|dmy}}
11937 !! html/php
11938 <p>2019-22-22
11939 </p>
11940 !! html/parsoid+integrated
11941 <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>
11942 !! end
11943
11944 !! test
11945 formatdate: dots in month name do not match any char (T220563)
11946 !! options
11947 language=de
11948 !! wikitext
11949 {{#formatdate:jun. 3|dmy}}
11950 {{#formatdate:junx 3|dmy}}
11951 !! html/php
11952 <p><span class="mw-formatted-date" title="06-03">3 Juni</span>
11953 junx 3
11954 </p>
11955 !! html/parsoid+integrated
11956 <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>
11957 <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>
11958 !! end
11959
11960 !! test
11961 formatdate uses correct capitalisation in French
11962 !! options
11963 language=fr
11964 !! wikitext
11965 {{#formatdate:Juin 3|dmy}}
11966 !! html/php
11967 <p><span class="mw-formatted-date" title="06-03">3 juin</span>
11968 </p>
11969 !! html/parsoid+integrated
11970 <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>
11971 !! end
11972
11973 !! test
11974 formatdate uses correct capitalisation in English
11975 !! wikitext
11976 {{#formatdate:june 3|dmy}}
11977 !! html/php
11978 <p><span class="mw-formatted-date" title="06-03">3 June</span>
11979 </p>
11980 !! html/parsoid+integrated
11981 <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>
11982 !! end
11983
11984 !! test
11985 formatdate formats ISO year 0 as 1 BC
11986 !! wikitext
11987 {{#formatdate:-0001-12-31|mdy}}
11988 {{#formatdate:0000-12-31|mdy}}
11989 {{#formatdate:0001-12-31|mdy}}
11990 !! html/php
11991 <p><span class="mw-formatted-date" title="-0001-12-31">December 31, 2 BC</span>
11992 <span class="mw-formatted-date" title="0000-12-31">December 31, 1 BC</span>
11993 <span class="mw-formatted-date" title="0001-12-31">December 31, 1</span>
11994 </p>
11995 !! html/parsoid+integrated
11996 <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>
11997 !! end
11998
11999 #
12000 #
12001 #
12002
12003 #
12004 # Edit comments
12005 #
12006
12007 !! test
12008 Edit comment with link
12009 !! options
12010 comment
12011 !! wikitext
12012 I like the [[Main Page]] a lot
12013 !! html/php
12014 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12015 !!end
12016
12017 !! test
12018 Edit comment with link and link text
12019 !! options
12020 comment
12021 !! wikitext
12022 I like the [[Main Page|best pages]] a lot
12023 !! html/php
12024 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12025 !!end
12026
12027 !! test
12028 Edit comment with link and link text with suffix
12029 !! options
12030 comment
12031 !! wikitext
12032 I like the [[Main Page|best page]]s a lot
12033 !! html/php
12034 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12035 !!end
12036
12037 !! test
12038 Edit comment with section link (non-local, eg in history list)
12039 !! options
12040 comment title=[[Main Page]]
12041 !! wikitext
12042 /* External links */ removed bogus entries
12043 !! html/php
12044 <span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→<bdi dir="ltr">External links</bdi></a>: </span> removed bogus entries
12045 !!end
12046
12047 !! test
12048 Edit comment with section link and text before it (non-local, eg in history list)
12049 !! options
12050 comment title=[[Main Page]]
12051 !! wikitext
12052 pre-comment text /* External links */ removed bogus entries
12053 !! html/php
12054 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
12055 !!end
12056
12057 !! test
12058 Edit comment with section link (local, eg in diff view)
12059 !! options
12060 comment local title=[[Main Page]]
12061 !! wikitext
12062 /* External links */ removed bogus entries
12063 !! html/php
12064 <span class="autocomment"><a href="#External_links">→<bdi dir="ltr">External links</bdi></a>: </span> removed bogus entries
12065 !!end
12066
12067 !! test
12068 Edit comment with section link that has a link in it
12069 !! options
12070 comment local title=[[Main Page]]
12071 !! wikitext
12072 /* [[A link]] */
12073 !! html/php
12074 <span class="autocomment"><a href="#A_link">→<bdi dir="ltr">&#91;&#91;A link&#93;&#93;</bdi></a></span>
12075 !! end
12076
12077 !! test
12078 Edit comment with section link that has a template in it
12079 !! options
12080 comment local title=[[Main Page]]
12081 !! wikitext
12082 /* {{foobar|param}} */
12083 !! html/php
12084 <span class="autocomment"><a href="#.7B.7Bfoobar.7Cparam.7D.7D">→<bdi dir="ltr">{{foobar|param}}</bdi></a></span>
12085 !! end
12086
12087 !! test
12088 Edit comment with subpage link (T16080)
12089 !! options
12090 comment
12091 subpage
12092 title=[[Subpage test]]
12093 !! wikitext
12094 Poked at a [[/subpage]] here...
12095 !! html/php
12096 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12097 !!end
12098
12099 !! test
12100 Edit comment with subpage link and link text (T16080)
12101 !! options
12102 comment
12103 subpage
12104 title=[[Subpage test]]
12105 !! wikitext
12106 Poked at a [[/subpage|neat little page]] here...
12107 !! html/php
12108 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12109 !!end
12110
12111 !! test
12112 Edit comment with bogus subpage link in non-subpage NS (T16080)
12113 !! options
12114 comment
12115 title=[[Subpage test]]
12116 !! wikitext
12117 Poked at a [[/subpage]] here...
12118 !! html/php
12119 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...
12120 !!end
12121
12122 !! test
12123 Edit comment with bare anchor link (local, as on diff)
12124 !! options
12125 comment
12126 local
12127 title=[[Main Page]]
12128 !! wikitext
12129 [[#section]]
12130 !! html/php
12131 <a href="#section">#section</a>
12132 !! end
12133
12134 !! test
12135 Edit comment with bare anchor link (non-local, as on history)
12136 !! options
12137 comment
12138 title=[[Main Page]]
12139 !! wikitext
12140 [[#section]]
12141 !! html/php
12142 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12143 !! end
12144
12145 !! test
12146 Anchor starting with underscore
12147 !! options
12148 title=[[Foo]]
12149 !! wikitext
12150 [[#_ref|One]]
12151 !! html/php
12152 <p><a href="#_ref">One</a>
12153 </p>
12154 !! html/parsoid
12155 <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>
12156 !! end
12157
12158 !! test
12159 Id starting with underscore
12160 !! wikitext
12161 <div id="_ref"></div>
12162 !! html/*
12163 <div id="&#95;ref"></div>
12164 !! end
12165
12166 !! test
12167 Edit comment with link with more than one pipe (T99346)
12168 !! options
12169 comment
12170 !! wikitext
12171 [[Main Page|Many|pipes]]
12172 !! html/php
12173 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
12174 !! end
12175
12176 !! test
12177 Complex edit comment with link with more than one pipe (T99346)
12178 !! options
12179 comment
12180 !! wikitext
12181 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
12182 !! html/php
12183 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;
12184 !! end
12185
12186 !! test
12187 Space normalisation on autocomment (T24784)
12188 !! options
12189 comment
12190 title=[[Main Page]]
12191 !! wikitext
12192 /* __hello__world__ */
12193 !! html/php
12194 <span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→<bdi dir="ltr">__hello__world__</bdi></a></span>
12195 !! end
12196
12197 !! test
12198 percent-encoding and + signs in comments (T28410)
12199 !! options
12200 comment
12201 !! wikitext
12202 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12203 !! html/php
12204 <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>
12205 !! end
12206
12207 !! test
12208 Verify that displaytitle works (T24501) no displaytitle
12209 !! options
12210 showtitle
12211 !! config
12212 wgAllowDisplayTitle=true
12213 wgRestrictDisplayTitle=false
12214 !! wikitext
12215 this is not the title
12216 !! metadata
12217 <span class="mw-page-title-main">Parser test</span>
12218 !! html
12219 <p>this is not the title
12220 </p>
12221 !! end
12222
12223 !! test
12224 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
12225 !! options
12226 showtitle
12227 title=[[Screen]]
12228 !! config
12229 wgAllowDisplayTitle=true
12230 wgRestrictDisplayTitle=false
12231 !! wikitext
12232 this is not the title
12233 {{DISPLAYTITLE:whatever}}
12234 !! metadata
12235 whatever
12236 !! html/php
12237 <p>this is not the title
12238 </p>
12239 !! html/parsoid+integrated
12240 <p>this is not the title</p>
12241 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:whatever","function":"displaytitle"},"params":{},"i":0}}]}'></span>
12242 !! end
12243
12244 !! test
12245 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
12246 !! options
12247 showtitle
12248 title=[[Screen]]
12249 !! config
12250 wgAllowDisplayTitle=true
12251 wgRestrictDisplayTitle=true
12252 !! wikitext
12253 this is not the title
12254 {{DISPLAYTITLE:whatever}}
12255 !! metadata
12256 <span class="mw-page-title-main">Screen</span>
12257 !! html/php
12258 <p>this is not the title
12259 </p>
12260 !! html/parsoid+integrated
12261 <p>this is not the title</p>
12262 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:whatever","function":"displaytitle"},"params":{},"i":0}}]}'></span>
12263 !! end
12264
12265 !! test
12266 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
12267 !! options
12268 showtitle
12269 title=[[Screen]]
12270 !! config
12271 wgAllowDisplayTitle=true
12272 wgRestrictDisplayTitle=true
12273 !! wikitext
12274 this is not the title
12275 {{DISPLAYTITLE:screen}}
12276 !! metadata
12277 screen
12278 !! html/php
12279 <p>this is not the title
12280 </p>
12281 !! html/parsoid+integrated
12282 <p>this is not the title</p>
12283 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:screen","function":"displaytitle"},"params":{},"i":0}}]}'></span>
12284 !! end
12285
12286 !! test
12287 Verify that displaytitle works (T24501) AllowDisplayTitle=false
12288 !! options
12289 showtitle
12290 title=[[Screen]]
12291 !! config
12292 wgAllowDisplayTitle=false
12293 !! wikitext
12294 this is not the title
12295 {{DISPLAYTITLE:screen}}
12296 !! metadata
12297 <span class="mw-page-title-main">Screen</span>
12298 !! html/php
12299 <p>this is not the title
12300 <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>
12301 </p>
12302 !! html/parsoid+integrated
12303 <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>
12304 !! end
12305
12306 !! test
12307 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
12308 !! options
12309 showtitle
12310 title=[[Screen]]
12311 !! config
12312 wgAllowDisplayTitle=false
12313 !! wikitext
12314 this is not the title
12315 !! metadata
12316 <span class="mw-page-title-main">Screen</span>
12317 !! html/php
12318 <p>this is not the title
12319 </p>
12320 !! html/parsoid+integrated
12321 <p>this is not the title</p>
12322 !! end
12323
12324 !! test
12325 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
12326 !! options
12327 showtitle
12328 title=[[Screen]]
12329 !! config
12330 wgAllowDisplayTitle=true
12331 wgRestrictDisplayTitle=true
12332 !! wikitext
12333 this is not the title
12334 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
12335 !! metadata
12336 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
12337 !! html/php
12338 <p>this is not the title
12339 </p>
12340 !! html/parsoid+integrated
12341 <p>this is not the title</p>
12342 <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>
12343 !! end
12344
12345 !! test
12346 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
12347 !! options
12348 showtitle
12349 title=[[Screen]]
12350 !! config
12351 wgAllowDisplayTitle=true
12352 wgRestrictDisplayTitle=true
12353 !! wikitext
12354 this is not the title
12355 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
12356 !! metadata
12357 <span style="color: red;">s</span>creen
12358 !! html/php
12359 <p>this is not the title
12360 </p>
12361 !! html/parsoid+integrated
12362 <p>this is not the title</p>
12363 <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>
12364 !! end
12365
12366 !! test
12367 Verify that displaytitle encodes & to &amp; (T291985)
12368 !! options
12369 showtitle
12370 title=[[Art&copy]]
12371 !! config
12372 wgAllowDisplayTitle=true
12373 wgRestrictDisplayTitle=true
12374 !! wikitext
12375 this is not the title
12376 {{DISPLAYTITLE:art&copy}}
12377 !! metadata
12378 art&amp;copy
12379 !! html/php
12380 <p>this is not the title
12381 </p>
12382 !! html/parsoid+integrated
12383 <p>this is not the title</p>
12384 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:art&amp;copy","function":"displaytitle"},"params":{},"i":0}}]}'></span>
12385 !! end
12386
12387 !! test
12388 Verify that displaytitle encodes &amp; to &amp; (T291985)
12389 !! options
12390 showtitle
12391 title=[[Art&copy]]
12392 !! config
12393 wgAllowDisplayTitle=true
12394 wgRestrictDisplayTitle=true
12395 !! wikitext
12396 this is not the title
12397 {{DISPLAYTITLE:art&amp;copy}}
12398 !! metadata
12399 art&amp;copy
12400 !! html/php
12401 <p>this is not the title
12402 </p>
12403 !! html/parsoid+integrated
12404 <p>this is not the title</p>
12405 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"DISPLAYTITLE:art&amp;amp;copy","function":"displaytitle"},"params":{},"i":0}}]}'></span>
12406 !! end
12407
12408 !! test
12409 Verify that without displaytitle the title encodes & to &amp; (T291985)
12410 !! options
12411 showtitle
12412 title=[[Art&copy]]
12413 !! config
12414 wgAllowDisplayTitle=true
12415 wgRestrictDisplayTitle=true
12416 !! wikitext
12417 this is not the title
12418 !! metadata
12419 <span class="mw-page-title-main">Art&amp;copy</span>
12420 !! html/php
12421 <p>this is not the title
12422 </p>
12423 !! html/parsoid+integrated
12424 <p>this is not the title</p>
12425 !! end
12426
12427 !! test
12428 preload: check <noinclude> and <includeonly>
12429 !! options
12430 preload
12431 !! wikitext
12432 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12433 !! html/php
12434 Hello kind world.
12435 !! end
12436
12437 !! test
12438 preload: check <onlyinclude>
12439 !! options
12440 preload
12441 !! wikitext
12442 Goodbye <onlyinclude>Hello world</onlyinclude>
12443 !! html/php
12444 Hello world
12445 !! end
12446
12447 !! test
12448 preload: can pass tags through if we want to
12449 !! options
12450 preload
12451 !! wikitext
12452 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12453 !! html/php
12454 <includeonly>Hello world</includeonly>
12455 !! end
12456
12457 !! test
12458 preload: check that it doesn't try to do tricks
12459 !! options
12460 preload
12461 !! wikitext
12462 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12463 !! html/php
12464 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12465 !! end
12466
12467 !! test
12468 Play a bit with r67090 and T5158
12469 !! wikitext
12470 <div style="width:50% !important">&nbsp;</div>
12471 <div style="width:50%&nbsp;!important">&nbsp;</div>
12472 <div style="width:50%&#160;!important">&nbsp;</div>
12473 <div style="border : solid;">&nbsp;</div>
12474 !! html/php
12475 <div style="width:50% !important">&#160;</div>
12476 <div style="width:50%&#160;!important">&#160;</div>
12477 <div style="width:50%&#160;!important">&#160;</div>
12478 <div style="border : solid;">&#160;</div>
12479 !! html/parsoid
12480 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
12481 <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>
12482 <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>
12483 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
12484 !! end
12485
12486 !! test
12487 French spaces in wikitext
12488 !! wikitext
12489 foo ! bar ? bat 50 % is less than 75 %.
12490
12491 Hello : this ; is « something ‹ else › again »
12492 !! html/php
12493 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
12494 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
12495 </p>
12496 !! html/parsoid
12497 <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>
12498
12499 <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>
12500 !! end
12501
12502 !! test
12503 Corner case: french spaces in definition list
12504 !! options
12505 parsoid=wt2html,html2html
12506 !! wikitext
12507 ;foo : bar
12508 !! html
12509 <dl><dt>foo</dt>
12510 <dd>bar</dd></dl>
12511 !! end
12512
12513 !! test
12514 T5158: Test for French spaces in attributes
12515 !! wikitext
12516 <br style=" clear : both ; " />
12517 !! html/php
12518 <p><br style="clear : both ;" />
12519 </p>
12520 !! end
12521
12522 # This test relies on the fact that image captions are processed
12523 # as independent document fragments.
12524 !! test
12525 Displayspace processing on embedded fragments
12526 !! options
12527 parsoid=wt2html
12528 !! wikitext
12529 [[File:Foobar.jpg|« test »]]
12530 !! html/parsoid
12531 <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>
12532 !! end
12533
12534 !! test
12535 HTML5 data attributes
12536 !! wikitext
12537 <span data-foo="bar">Baz</span>
12538 <p data-abc-def_hij="">Quuz</p>
12539 !! html/php
12540 <p><span data-foo="bar">Baz</span>
12541 </p>
12542 <p>Quuz</p>
12543 !! html/parsoid
12544 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
12545 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
12546 !! end
12547
12548 !! test
12549 Strip reserved data attributes
12550 !! wikitext
12551 <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>
12552 !! html/php
12553 <div data-ok="fred" data-object-id="123">d</div>
12554 !! html/parsoid
12555 <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>
12556 !! end
12557
12558 !! test
12559 percent-encoding and + signs in internal links (T28410)
12560 !! config
12561 wgParserEnableLegacyMediaDOM=false
12562 !! wikitext
12563 [[User:+%]] [[Page+title%]]
12564 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12565 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
12566 [[%33%45]] [[%33%45+]]
12567 !! html/php
12568 <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>
12569 <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>
12570 <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>
12571 <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>
12572 </p>
12573 !! html/parsoid
12574 <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>
12575 <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>
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="./+?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>
12577 <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>
12578 !! end
12579
12580 !! test
12581 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12582 !! wikitext
12583 Text&apos;s been normalized?
12584 !! html
12585 <p>Text&#39;s been normalized?
12586 </p>
12587 !! end
12588
12589 !! test
12590 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12591 !! wikitext
12592 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12593 !! html
12594 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12595 </p>
12596 !! end
12597
12598 !! test
12599 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12600 !! wikitext
12601 [http://www.example.org/ ideograms]
12602 !! html
12603 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12604 </p>
12605 !! end
12606
12607 !! test
12608 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12609 !! wikitext
12610 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12611 !! html
12612 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12613 </p>
12614 !! end
12615
12616 !! article
12617 MediaWiki:loop1
12618 !! text
12619 {{Identical|A}}
12620 !! endarticle
12621
12622 !! article
12623 MediaWiki:loop2
12624 !! text
12625 {{Identical|B}}
12626 !! endarticle
12627
12628 !! article
12629 Template:Identical
12630 !! text
12631 {{int:loop1}}
12632 {{int:loop2}}
12633 !! endarticle
12634
12635 !! test
12636 T33098 Template which includes system messages which includes the template
12637 !! wikitext
12638 {{Identical}}
12639 !! html/php
12640 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12641 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12642 </p>
12643 !! html/parsoid+integrated
12644 <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">
12645 </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>
12646 !! end
12647
12648 !! test
12649 T33490 Turkish: ucfirst 'blah'
12650 !! options
12651 language=tr
12652 !! wikitext
12653 {{ucfirst:blah}}
12654 !! html
12655 <p>Blah
12656 </p>
12657 !! end
12658
12659 !! test
12660 T33490 Turkish: ucfirst 'ix'
12661 !! options
12662 language=tr
12663 !! wikitext
12664 {{ucfirst:ix}}
12665 !! html
12666 <p>İx
12667 </p>
12668 !! end
12669
12670 !! test
12671 T33490 Turkish: lcfirst 'BLAH'
12672 !! options
12673 language=tr
12674 !! wikitext
12675 {{lcfirst:BLAH}}
12676 !! html
12677 <p>bLAH
12678 </p>
12679 !! end
12680
12681 !! test
12682 T33490 Turkish: ucfırst (with a dotless i)
12683 !! options
12684 language=tr
12685 !! wikitext
12686 {{ucfırst:blah}}
12687 !! html/php
12688 <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>
12689 </p>
12690 !! html/parsoid
12691 <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>
12692 !! end
12693
12694 !! test
12695 T33490 ucfırst (with a dotless i) with English language
12696 !! options
12697 language=en
12698 !! wikitext
12699 {{ucfırst:blah}}
12700 !! html/php
12701 <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>
12702 </p>
12703 !! html/parsoid
12704 <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>
12705 !! end
12706
12707 !! article
12708 MediaWiki:T34057
12709 !! text
12710 == {{int:ok}} ==
12711 !! endarticle
12712
12713 !! test
12714 T34057: Title needed when expanding <h> nodes.
12715 !! options
12716 title=[[Main Page]]
12717 !! config
12718 wgParserEnableLegacyHeadingDOM=false
12719 !! wikitext
12720 {{int:T34057}}
12721 !! html/php
12722 <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>
12723 !! html/parsoid+integrated
12724 <h2 about="#mwt1" typeof="mw:Transclusion" id="OK" data-mw='{"parts":[{"template":{"target":{"wt":"int:T34057","function":"int"},"params":{},"i":0}}]}'>OK</h2>
12725 !! end
12726
12727 !! test
12728 Title needed when expanding templates.
12729 !! options
12730 title=[[Main Page]]
12731 !! wikitext
12732 {{Template with pagename}}
12733 !! html/php
12734 <p>This is Main Page.
12735 </p>
12736 !! html/parsoid
12737 <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>
12738 !! end
12739
12740 !! test
12741 Strip marker in urlencode
12742 !! wikitext
12743 {{urlencode:x<nowiki/>y}}
12744 {{urlencode:x<nowiki/>y|wiki}}
12745 {{urlencode:x<nowiki/>y|path}}
12746 {{urlencode:x<pre id="one">two</pre>y}}
12747 !! html/php
12748 <p>xy
12749 xy
12750 xy
12751 xy
12752 </p>
12753 !! end
12754
12755 !! test
12756 Strip marker in lc
12757 !! wikitext
12758 {{lc:x<nowiki/>y}}
12759 !! html/php
12760 <p>xy
12761 </p>
12762 !! html/parsoid+integrated
12763 <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>
12764 !! end
12765
12766 !! test
12767 Strip marker in uc
12768 !! wikitext
12769 {{uc:x<nowiki/>y}}
12770 !! html/php
12771 <p>XY
12772 </p>
12773 !! html/parsoid+integrated
12774 <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>
12775 !! end
12776
12777 !! test
12778 Strip marker in formatNum
12779 !! wikitext
12780 {{formatnum:1<nowiki/>2}}
12781 {{formatnum:1<nowiki/>2|R}}
12782 !! html/php
12783 <p>12
12784 12
12785 </p>
12786 !! html/parsoid
12787 <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>
12788 !! end
12789
12790 !! test
12791 Check noCommafy in formatNum
12792 !! options
12793 language=be-tarask
12794 !! wikitext
12795 {{formatnum:123456.78}}
12796 {{formatnum:123456.78|NOSEP}}
12797 !! html/php
12798 <p>123&#160;456,78
12799 123456.78
12800 </p>
12801 !! html/parsoid+integrated
12802 <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>
12803 <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>
12804 !! end
12805
12806 !! test
12807 Wrong option for formatNum (T58199)
12808 !! wikitext
12809 {{formatnum:1,234.56|Random}}
12810 {{formatnum:1,234.56|EVERYTHING}}
12811 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
12812 !! html/php
12813 <p>1,234.56
12814 1,234.56
12815 1,234.56
12816 </p>
12817 !! html/parsoid+integrated
12818 <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>
12819 <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>
12820 <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>
12821 !! end
12822
12823 !! test
12824 Strip marker in grammar
12825 !! options
12826 language=fi
12827 !! wikitext
12828 {{grammar:elative|foo<nowiki/>bar}}
12829 !! html/php
12830 <p>foobarista
12831 </p>
12832 !! html/parsoid+integrated
12833 <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>
12834 !! end
12835
12836 !! test
12837 Strip marker in padleft
12838 !! wikitext
12839 {{padleft:|2|x<nowiki/>y}}
12840 !! html
12841 <p>xy
12842 </p>
12843 !! end
12844
12845 !! test
12846 Strip marker in padright
12847 !! wikitext
12848 {{padright:|2|x<nowiki/>y}}
12849 !! html
12850 <p>xy
12851 </p>
12852 !! end
12853
12854 !! test
12855 Strip marker in anchorencode
12856 !! wikitext
12857 {{anchorencode:x<nowiki/>y}}
12858 !! html/php
12859 <p>xy
12860 </p>
12861 !! html/parsoid
12862 <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>
12863 !! end
12864
12865 !! test
12866 new support for bdi element (T33817)
12867 !! wikitext
12868 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12869 !! html
12870 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12871 !! end
12872
12873 !! test
12874 Ignore pipe between table row attributes
12875 !! wikitext
12876 {|
12877 |quux
12878 |- id=foo | style='color: red'
12879 |bar
12880 |}
12881 !! html
12882 <table>
12883 <tbody><tr>
12884 <td>quux
12885 </td></tr>
12886 <tr id="foo" style="color: red">
12887 <td>bar
12888 </td></tr></tbody></table>
12889 !! end
12890
12891 !! test
12892 Language parser function (autonym)
12893 !! wikitext
12894 {{#language:ar}}
12895 !! html/php
12896 <p>العربية
12897 </p>
12898 !! html/parsoid+integrated
12899 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#language:ar","function":"language"},"params":{},"i":0}}]}'>العربية</span></p>
12900 !! end
12901
12902 !! test
12903 Language parser function (case-insensitive)
12904 !! wikitext
12905 {{#language:AR}}
12906 !! html/php
12907 <p>العربية
12908 </p>
12909 !! html/parsoid+integrated
12910 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#language:AR","function":"language"},"params":{},"i":0}}]}'>العربية</span></p>
12911 !! end
12912
12913 !! test
12914 Language parser function (non-autonym)
12915 !! wikitext
12916 {{#language:aR|En}}
12917 !! html/php
12918 <p>Arabic
12919 </p>
12920 !! html/parsoid+integrated
12921 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#language:aR","function":"language"},"params":{"1":{"wt":"En"}},"i":0}}]}'>Arabic</span></p>
12922 !! end
12923
12924 !! test
12925 Language parser function (bcp-47 codes)
12926 !! wikitext
12927 {{#language:de-x-formal|en-simple}}
12928 !! html/php
12929 <p>German (formal address)
12930 </p>
12931 !! html/parsoid+integrated
12932 <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>
12933 !! end
12934
12935 !! test
12936 Language parser function (target language)
12937 !! options
12938 language=ar
12939 !! wikitext
12940 {{#language}} / {{#language:}}
12941 !! html/php
12942 <p>العربية / العربية
12943 </p>
12944 !! html/parsoid+integrated
12945 <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>
12946 !! end
12947
12948 !! test
12949 Language parser function (target language, non-autonym)
12950 !! options
12951 language=ar
12952 !! wikitext
12953 {{#language:|en}}
12954 !! html/php
12955 <p>Arabic
12956 </p>
12957 !! html/parsoid+integrated
12958 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#language:","function":"language"},"params":{"1":{"wt":"en"}},"i":0}}]}'>Arabic</span></p>
12959 !! end
12960
12961 !! test
12962 Dir parser function (valid codes)
12963 !! wikitext
12964 Persian: {{#dir:fa}}
12965
12966 English: {{#dir:en}}
12967
12968 Persian (with space): {{#dir: fa}}
12969
12970 Tajik: {{#dir:tg}}
12971
12972 The string 'egl' is a valid internal code; however when used as a
12973 BCP-47 code it refers to the internal code 'eml'. Unfortunately,
12974 both of these have ltr directionality which makes this test case
12975 less useful than it could be.
12976
12977 Ambiguous BCP-47 code:
12978 ;Directionality of internal code 'egl':{{#dir:egl}}
12979 ;Directionality of internal code 'eml':{{#dir:egl|bcp47}} == {{#dir:eml}}
12980 !! html/php
12981 <p>Persian: rtl
12982 </p><p>English: ltr
12983 </p><p>Persian (with space): rtl
12984 </p><p>Tajik: ltr
12985 </p><p>The string 'egl' is a valid internal code; however when used as a
12986 BCP-47 code it refers to the internal code 'eml'. Unfortunately,
12987 both of these have ltr directionality which makes this test case
12988 less useful than it could be.
12989 </p><p>Ambiguous BCP-47 code:
12990 </p>
12991 <dl><dt>Directionality of internal code 'egl'</dt>
12992 <dd>ltr</dd>
12993 <dt>Directionality of internal code 'eml'</dt>
12994 <dd>ltr == ltr</dd></dl>
12995 !! html/parsoid+integrated
12996 <p>Persian: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:fa","function":"dir"},"params":{},"i":0}}]}'>rtl</span></p>
12997 <p>English: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:en","function":"dir"},"params":{},"i":0}}]}'>ltr</span></p>
12998 <p>Persian (with space): <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir: fa","function":"dir"},"params":{},"i":0}}]}'>rtl</span></p>
12999 <p>Tajik: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:tg","function":"dir"},"params":{},"i":0}}]}'>ltr</span></p>
13000 <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>
13001 <p>Ambiguous BCP-47 code:</p>
13002 <dl>
13003 <dt>Directionality of internal code 'egl'</dt>
13004 <dd><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:egl","function":"dir"},"params":{},"i":0}}]}'>ltr</span></dd>
13005 <dt>Directionality of internal code 'eml'</dt>
13006 <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>
13007 </dl>
13008 !! end
13009
13010 !! test
13011 Dir parser function (target language)
13012 !! options
13013 language=fa
13014 cat
13015 !! metadata
13016 !! wikitext
13017 These are all equivalent:
13018
13019 {{#dir}} / {{#dir:}} / {{#dir:{{PAGELANGUAGE}}}}
13020 !! html/php
13021 <p>These are all equivalent:
13022 </p><p>rtl / rtl / rtl
13023 </p>
13024 !! html/parsoid+integrated
13025 <p>These are all equivalent:</p>
13026 <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>
13027 !! end
13028
13029 !! test
13030 Dir parser function (invalid code)
13031 !! options
13032 cat
13033 !! wikitext
13034 {{#dir:blah<blah}}
13035 !! metadata
13036 cat=Pages_with_invalid_language_codes sort=
13037 !! html/php
13038 <p>ltr
13039 </p>
13040 !! html/parsoid+integrated
13041 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#dir:blah&lt;blah","function":"dir"},"params":{},"i":0}}]}'>ltr</span></p>
13042 !! end
13043
13044 !! test
13045 Bcp47 parser function (valid codes)
13046 !! wikitext
13047 Serbian: {{#bcp47:sr-ec}}
13048
13049 Cantonese: {{#bcp47:zh-yue}}
13050
13051 Formal German (with space): {{#bcp47: de-formal}}
13052
13053 Simple English: {{#bcp47:simple}}
13054
13055 The string 'egl' is a valid internal code, distinct from the
13056 internal code 'eml'; however both map to the BCP-47 code 'egl'.
13057
13058 Ambiguous BCP-47 code:
13059 ;Internal code 'eml':{{#bcp47:eml}} == egl
13060 ;Internal code 'egl':{{#bcp47:egl}} == egl
13061 !! html/php
13062 <p>Serbian: sr-Cyrl
13063 </p><p>Cantonese: yue
13064 </p><p>Formal German (with space): de-x-formal
13065 </p><p>Simple English: en-simple
13066 </p><p>The string 'egl' is a valid internal code, distinct from the
13067 internal code 'eml'; however both map to the BCP-47 code 'egl'.
13068 </p><p>Ambiguous BCP-47 code:
13069 </p>
13070 <dl><dt>Internal code 'eml'</dt>
13071 <dd>egl == egl</dd>
13072 <dt>Internal code 'egl'</dt>
13073 <dd>egl == egl</dd></dl>
13074 !! html/parsoid+integrated
13075 <p>Serbian: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:sr-ec","function":"bcp47"},"params":{},"i":0}}]}'>sr-Cyrl</span></p>
13076 <p>Cantonese: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:zh-yue","function":"bcp47"},"params":{},"i":0}}]}'>yue</span></p>
13077 <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>
13078 <p>Simple English: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:simple","function":"bcp47"},"params":{},"i":0}}]}'>en-simple</span></p>
13079 <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>
13080 <p>Ambiguous BCP-47 code:</p>
13081 <dl>
13082 <dt>Internal code 'eml'</dt>
13083 <dd><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:eml","function":"bcp47"},"params":{},"i":0}}]}'>egl</span> == egl</dd>
13084 <dt>Internal code 'egl'</dt>
13085 <dd><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:egl","function":"bcp47"},"params":{},"i":0}}]}'>egl</span> == egl</dd>
13086 </dl>
13087 !! end
13088
13089 !! test
13090 Bcp47 parser function (target language)
13091 !! options
13092 language=sr-ec
13093 !! wikitext
13094 These are all equivalent:
13095
13096 {{#bcp47}} / {{#bcp47:}} / {{#bcp47:{{PAGELANGUAGE}}}}
13097 !! html/php
13098 <p>These are all equivalent:
13099 </p><p>sr-Cyrl / sr-Cyrl / sr-Cyrl
13100 </p>
13101 !! html/parsoid+integrated
13102 <p>These are all equivalent:</p>
13103 <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>
13104 !! end
13105
13106 # from https://commons.wikimedia.org/w/index.php?title=Template:BCP47&oldid=597081406
13107 !! test
13108 Bcp47 parser function (examples from Template:BCP47)
13109 !! wikitext
13110 Unaffected codes, for example:
13111 *{{#bcp47:en}} returns: "en"
13112 Changes required by BCP47, using standard codes:
13113 *{{#bcp47:als}} returns: "gsw"
13114 *{{#bcp47:fiu-vro}} returns: "vro"
13115 *{{#bcp47:simple}} returns: "en"
13116 *{{#bcp47:zh-classical}} returns: "lzh"
13117 *{{#bcp47:roa-rup}} returns: "rup"
13118 Changes required by BCP47, currently using private-use extensions:
13119 *{{#bcp47:nrm}} returns: "nrf"
13120 *{{#bcp47:roa-tara}} returns: "it-x-tara"
13121 Changes preferable with BCP47 for improved interoperability (not really violations):
13122 *{{#bcp47:be-x-old}} returns: "be-tarask"
13123 !! html/php
13124 <p>Unaffected codes, for example:
13125 </p>
13126 <ul><li>en returns: "en"</li></ul>
13127 <p>Changes required by BCP47, using standard codes:
13128 </p>
13129 <ul><li>gsw returns: "gsw"</li>
13130 <li>vro returns: "vro"</li>
13131 <li>en-simple returns: "en"</li>
13132 <li>lzh returns: "lzh"</li>
13133 <li>rup returns: "rup"</li></ul>
13134 <p>Changes required by BCP47, currently using private-use extensions:
13135 </p>
13136 <ul><li>nrf returns: "nrf"</li>
13137 <li>nap-x-tara returns: "it-x-tara"</li></ul>
13138 <p>Changes preferable with BCP47 for improved interoperability (not really violations):
13139 </p>
13140 <ul><li>be-tarask returns: "be-tarask"</li></ul>
13141 !! html/parsoid+integrated
13142 <p>Unaffected codes, for example:</p>
13143 <ul>
13144 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:en","function":"bcp47"},"params":{},"i":0}}]}'>en</span> returns: "en"</li>
13145 </ul>
13146 <p>Changes required by BCP47, using standard codes:</p>
13147 <ul>
13148 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:als","function":"bcp47"},"params":{},"i":0}}]}'>gsw</span> returns: "gsw"</li>
13149 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:fiu-vro","function":"bcp47"},"params":{},"i":0}}]}'>vro</span> returns: "vro"</li>
13150 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:simple","function":"bcp47"},"params":{},"i":0}}]}'>en-simple</span> returns: "en"</li>
13151 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:zh-classical","function":"bcp47"},"params":{},"i":0}}]}'>lzh</span> returns: "lzh"</li>
13152 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:roa-rup","function":"bcp47"},"params":{},"i":0}}]}'>rup</span> returns: "rup"</li>
13153 </ul>
13154 <p>Changes required by BCP47, currently using private-use extensions:</p>
13155 <ul>
13156 <li><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#bcp47:nrm","function":"bcp47"},"params":{},"i":0}}]}'>nrf</span> returns: "nrf"</li>
13157 <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>
13158 </ul>
13159 <p>Changes preferable with BCP47 for improved interoperability (not really violations):</p>
13160 <ul>
13161 <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>
13162 </ul>
13163 !! end
13164
13165 !!test
13166 Padleft and padright (default 0-padding)
13167 !! wikitext
13168 {{padleft:xyz|5}}
13169 {{padright:xyz|5}}
13170 !! html/php
13171 <p>00xyz
13172 xyz00
13173 </p>
13174 !! html/parsoid
13175 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
13176 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
13177 !! end
13178
13179 !!test
13180 Padleft and padright (partial fill)
13181 !! wikitext
13182 {{padleft:xyz|6|ab}}
13183 {{padright:xyz|6|ab}}
13184 !! html/php
13185 <p>abaxyz
13186 xyzaba
13187 </p>
13188 !! html/parsoid
13189 <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>
13190 <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>
13191 !! end
13192
13193 !!test
13194 Padleft and padright as substr
13195 !! wikitext
13196 {{padleft:|3|abcde}}
13197 {{padright:|3|abcde}}
13198 !! html/php
13199 <p>abc
13200 abc
13201 </p>
13202 !! html/parsoid
13203 <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>
13204 <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>
13205 !! end
13206
13207 !! test
13208 Padleft and padright with non-numerical length (T180403)
13209 !! wikitext
13210 {{padleft:abcdef|junk}}
13211 {{padright:abcdef|junk}}
13212 !! html/php
13213 <p>abcdef
13214 abcdef
13215 </p>
13216 !! end
13217
13218 !!test
13219 Special parser function
13220 !! wikitext
13221 {{#special:RandomPage}}
13222 {{#special:BaDtItLe}}
13223 {{#special:Foobar}}
13224 !! html/php
13225 <p>Special:Random
13226 Special:Badtitle
13227 Special:Foobar
13228 </p>
13229 !! html/parsoid
13230 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#special:RandomPage","function":"special"},"params":{},"i":0}}]}'>Special:Random</span>
13231 <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#special:BaDtItLe","function":"special"},"params":{},"i":0}}]}'>Special:Badtitle</span>
13232 <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#special:Foobar","function":"special"},"params":{},"i":0}}]}'>Special:Foobar</span></p>
13233 !! end
13234
13235 # {{=}} will be converted to a parser function which expands to `=`
13236 # If you have it defined as a Template that expands to `=` that's ok;
13237 # and using it explicitly as {{Template:=}} (regardless of what it
13238 # expands to) is also ok and will not generate a tracking category.
13239 # T91154
13240 #
13241 # FIXME: Parsoid doesn't yet support this magic word natively, so standalone
13242 # mode will fail this test.
13243 !! test
13244 Using {{=}} when it expands to "=" should not create a tracking category
13245 !! wikitext
13246 This uses {{=}} and {{Template:=}}.
13247 !! html/php
13248 <p>This uses = and =.
13249 </p>
13250 !! html/parsoid
13251 <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>
13252 !! end
13253
13254 # Repeat the test, looking at categories. Note: none should be emitted!
13255 !! test
13256 Using {{=}} when it expands to "=" should not create a tracking category (cat)
13257 !! options
13258 cat
13259 !! wikitext
13260 This uses {{=}} and {{Template:=}}.
13261 !! html/php
13262 <p>This uses = and =.
13263 </p>
13264 !! end
13265
13266 !!test
13267 T36939 - Case insensitive link parsing ([HttP://])
13268 !! wikitext
13269 [HttP://MediaWiki.Org/]
13270 !! html/php
13271 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13272 </p>
13273 !! html/parsoid
13274 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/" class="external autonumber"></a></p>
13275 !! end
13276
13277 !!test
13278 T36939 - Case insensitive link parsing ([HttP:// title])
13279 !! wikitext
13280 [HttP://MediaWiki.Org/ MediaWiki]
13281 !! html
13282 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13283 </p>
13284 !! end
13285
13286 !!test
13287 T36939 - Case insensitive link parsing (HttP://)
13288 !! wikitext
13289 HttP://MediaWiki.Org/
13290 !! html/php
13291 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13292 </p>
13293 !! html/parsoid
13294 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/" class="external free">HttP://MediaWiki.Org/</a></p>
13295 !! end
13296
13297
13298 ###
13299 ### Parsoid-specific tests
13300 ### Parsoid-PHP parser incompatibilities
13301 ###
13302 !!test
13303 1. SOL-sensitive wikitext tokens as template-args
13304 !! options
13305 parsoid=wt2html,wt2wt
13306 !! wikitext
13307 {{1x|*a}}
13308 {{1x|#a}}
13309 {{1x|:a}}
13310 !! html/php
13311 <ul><li>a</li></ul>
13312 <ol><li>a</li></ol>
13313 <dl><dd>a</dd></dl>
13314 !! html/parsoid
13315 <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>
13316 <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>
13317 <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>
13318 !!end
13319
13320 #### -----------------------------------------------------------------
13321 #### Parsoid-specific functionality tests
13322 #### -----------------------------------------------------------------
13323
13324 ## Just a regression test
13325 !! test
13326 Wikilink with only closing tag in target
13327 !! options
13328 parsoid=wt2html
13329 !! wikitext
13330 [[Test|</span>]]
13331 !! html/parsoid
13332 <p><a rel="mw:WikiLink" href="./Test" title="Test" data-parsoid='{"stx":"piped","a":{"href":"./Test"},"sa":{"href":"Test"}}'></a></p>
13333 !! end
13334
13335 #### ----------------------------------------------------------------
13336 #### Parsoid-only testing of Parsoid's impl of LST
13337 #### Not implemented yet, see
13338 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
13339 #### ----------------------------------------------------------------
13340
13341 ## We still need to support serializing the older format while content is stored.
13342 !! test
13343 LST Sections: Backwards compatibility
13344 !! options
13345 parsoid={
13346 "suppressErrors": true,
13347 "modes": ["html2wt"]
13348 }
13349 !! wikitext
13350 <section begin="2011-05-16" />
13351 <section end="2014-04-10 (MW 1.23wmf22)" />
13352 !! html/parsoid
13353 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
13354 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
13355 !! end
13356
13357 !! test
13358 LST Sections: Newfangled approach
13359 !! wikitext
13360 <section begin="2011-05-16" />
13361 <section end="2014-04-10 (MW 1.23wmf22)" />
13362 !! html/parsoid
13363 <p><link typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}' />
13364 <link typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}' /></p>
13365 !! html/parsoid+integrated
13366 <p>&lt;section begin="2011-05-16" /> &lt;section end="2014-04-10 (MW 1.23wmf22)" /></p>
13367 !! end
13368
13369 !! test
13370 LST Sections: Fostering
13371 !! options
13372 parsoid=wt2html
13373 !! wikitext
13374 {|
13375 <section name="testing"/>
13376 | 123
13377 |}
13378 !! html/parsoid
13379 <link typeof="mw:Extension/section" about="#mwt2" data-parsoid='{"fostered":true}' data-mw='{"name":"section","attrs":{"name":"testing"}}'/><table>
13380
13381 <tbody><tr><td>123
13382 </td></tr></tbody></table>
13383 !! html/parsoid+integrated
13384 <p>&lt;section name="testing"/></p>
13385 <table>
13386 <tbody>
13387 <tr>
13388 <td>123</td>
13389 </tr>
13390 </tbody>
13391 </table>
13392 !! end
13393
13394 #--------- Test stripping of empty nodes in template content ----------
13395
13396 !! test
13397 Empty LI and TR nodes should be stripped from template content
13398 !! options
13399 parsoid=wt2html,wt2wt
13400 !! wikitext
13401 {{EmptyLITest}}
13402 {{EmptyTRTest}}
13403 !! html/parsoid
13404 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'><li>a</li>
13405
13406
13407 <li>b</li></ul>
13408 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
13409 <tbody>
13410 <tr>
13411 <td>foo</td></tr>
13412
13413 <tr>
13414 <td>bar</td></tr>
13415 </tbody></table>
13416 !! end
13417
13418 !! test
13419 Empty LI and TR nodes should not be stripped from top-level content
13420 !! wikitext
13421 *a
13422 *
13423 *b
13424
13425 {|
13426 |-
13427 |-
13428 |foo
13429 |}
13430 !! html/parsoid
13431 <ul>
13432 <li>a</li>
13433 <li class='mw-empty-elt'></li>
13434 <li>b</li>
13435 </ul>
13436 <table>
13437 <tbody>
13438 <tr class='mw-empty-elt'></tr>
13439 <tr>
13440 <td>foo</td>
13441 </tr>
13442 </tbody>
13443 </table>
13444 !! end
13445
13446 !! test
13447 Empty TR nodes should not be stripped if they have any attributes set
13448 !! wikitext
13449 {{EmptyTRWithHTMLAttrTest}}
13450 !! html/parsoid
13451 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
13452 <tr align='center'></tr>
13453 <tr><td>foo</td></tr>
13454 <tr align='center'></tr>
13455 <tr><td>bar</td></tr>
13456 </table>
13457 !! end
13458
13459 !! test
13460
13461 Tag-like HTML structures are passed through as text
13462 !! wikitext
13463 <x y>
13464
13465 <x.y>
13466
13467 <x-y>
13468
13469 1>2
13470
13471 x<y
13472
13473 a>b
13474
13475 1<d e>f
13476 !! html
13477 <p>&lt;x y&gt;
13478 </p><p>&lt;x.y&gt;
13479 </p><p>&lt;x-y&gt;
13480 </p><p>1&gt;2
13481 </p><p>x&lt;y
13482 </p><p>a&gt;b
13483 </p><p>1&lt;d e&gt;f
13484 </p>
13485 !! end
13486
13487 !! test
13488 HTML tag with necessary entities in attributes
13489 !! wikitext
13490 <span title="&amp;amp;">foo</span>
13491 !! html
13492 <p><span title="&amp;amp;">foo</span>
13493 </p>
13494 !! end
13495
13496 !! test
13497 HTML tag with 'unnecessary' entity encoding in attributes
13498 !! wikitext
13499 <span title="&amp;">foo</span>
13500 !! html
13501 <p><span title="&amp;">foo</span>
13502 </p>
13503 !! end
13504
13505 !! test
13506 HTML tag with broken attribute value quoting
13507 !! options
13508 parsoid=wt2html,html2html
13509 !! wikitext
13510 <span title="Hello world>Foo</span>
13511 !! html/php
13512 <p><span title="Hello world">Foo</span>
13513 </p>
13514 !! html/parsoid
13515 <p><span title="Hello world">Foo</span></p>
13516 !! end
13517
13518 !! test
13519 Self-closed tag with broken attribute value quoting
13520 !! options
13521 parsoid=wt2html,html2html
13522 !! wikitext
13523 <div title="Hello world />Foo
13524 !! html
13525 <div title="Hello world">Foo</div>
13526 !! end
13527
13528 !! test
13529 Table with broken attribute value quoting
13530 !! options
13531 parsoid=wt2html,html2html
13532 !! wikitext
13533 {|
13534 | title="Hello world|Foo
13535 |}
13536 !! html/php
13537 <table>
13538 <tbody><tr>
13539 <td title="Hello world">Foo
13540 </td></tr></tbody></table>
13541 !! html/parsoid
13542 <table>
13543 <tr>
13544 <td title="Hello world">Foo
13545 </td></tr></table>
13546 !! end
13547
13548 !! test
13549 Table with broken attribute value quoting on consecutive lines
13550 !! options
13551 parsoid=wt2html,html2html
13552 !! wikitext
13553 {|
13554 | title="Hello world|Foo
13555 | style="color:red|Bar
13556 |}
13557 !! html/php
13558 <table>
13559 <tbody><tr>
13560 <td title="Hello world">Foo
13561 </td>
13562 <td style="color:red">Bar
13563 </td></tr></tbody></table>
13564 !! html/parsoid
13565 <table><tbody>
13566 <tr>
13567 <td title="Hello world">Foo
13568 </td><td style="color:red">Bar
13569 </td></tr></tbody></table>
13570 !! end
13571
13572 !!test
13573 Accept empty td cell attribute
13574 !! wikitext
13575 {|
13576 | align="center" |foo|| |
13577 |}
13578 !! html
13579 <table>
13580 <tbody><tr>
13581 <td align="center">foo</td>
13582 <td>
13583 </td></tr></tbody></table>
13584 !! end
13585
13586 !!test
13587 Non-empty attributes in th-cells
13588 !! wikitext
13589 {|
13590 !Foo!! style="color: red" |Bar
13591 |}
13592 !! html
13593 <table>
13594 <tbody><tr>
13595 <th>Foo</th>
13596 <th style="color: red">Bar
13597 </th></tr></tbody></table>
13598 !! end
13599
13600 !!test
13601 Accept empty attributes in th-cells
13602 !! wikitext
13603 {|
13604 !|foo!!|bar
13605 |}
13606 !! html
13607 <table>
13608 <tbody><tr>
13609 <th>foo</th>
13610 <th>bar
13611 </th></tr></tbody></table>
13612 !! end
13613
13614 !!test
13615 Empty table rows go away
13616 !! wikitext
13617 {|
13618 |Hello
13619 |there
13620 |- class="foo"
13621 |-
13622 |}
13623 !! html
13624 <table>
13625 <tbody><tr>
13626 <td>Hello
13627 </td>
13628 <td>there
13629 </td></tr>
13630
13631 </tbody></table>
13632 !! end
13633
13634 ###
13635 ### Parsoid-centric tests for testing RTing of inter-element separators
13636 ### Edge cases not tested by existing parser tests and specific to
13637 ### Parsoid-specific serialization strategies.
13638 ###
13639
13640 !!test
13641 RT-ed inter-element separators should be valid separators
13642 !! wikitext
13643 {|
13644 |- [[foo]]
13645 |}
13646 !! html/php
13647 <table>
13648
13649 </table>
13650 !! html/parsoid
13651 <table>
13652 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""}}'></tr>
13653 </tbody></table>
13654 !!end
13655
13656 # Parsoid-only test of a DOM pass
13657 !!test
13658 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
13659 !! wikitext
13660 {|
13661 |<small>foo
13662 bar
13663 |}
13664
13665 {|
13666 |<small>foo<small>
13667 |}
13668 !! html/parsoid
13669 <table>
13670 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
13671 <p>bar</p></small></td></tr>
13672 </tbody></table>
13673
13674 <table>
13675 <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>
13676 </tbody></table>
13677 !!end
13678
13679 # Note that the "style" attribute is really a template parameter here.
13680 # The = would have to be {{=}} if you wanted the literal.
13681 !!test
13682 Empty TD followed by TD with tpl-generated attribute
13683 !! wikitext
13684 {|
13685 |-
13686 |
13687 |{{1x|style='color:red'}}|foo
13688 |}
13689 !! html
13690 <table>
13691
13692 <tbody><tr>
13693 <td>
13694 </td>
13695 <td>foo
13696 </td></tr></tbody></table>
13697 !! end
13698
13699 !!test
13700 Indented table with an empty td
13701 !! wikitext
13702 {|
13703 |-
13704 |
13705 |foo
13706 |}
13707 !! html
13708 <table>
13709
13710 <tbody><tr>
13711 <td>
13712 </td>
13713 <td>foo
13714 </td></tr></tbody></table>
13715 !! end
13716
13717 !! test
13718 Indented table with blank lines in between (T85627)
13719 !! wikitext
13720 {|
13721 |foo
13722
13723
13724 |}
13725 !! html/php
13726 <table>
13727 <tbody><tr>
13728 <td>foo
13729 <p><br />
13730 </p>
13731 </td></tr></tbody></table>
13732 !! html/parsoid
13733 <table>
13734 <tbody><tr><td>foo
13735 <p>
13736 <br /></p></td></tr>
13737 </tbody></table>
13738 !! end
13739
13740 !!test
13741 Indented block & table
13742 !! wikitext
13743 <div>foo</div>
13744 {|
13745 |foo
13746 |}
13747 !! html/php
13748 <div>foo</div>
13749 <table>
13750 <tbody><tr>
13751 <td>foo
13752 </td></tr></tbody></table>
13753 !! html/parsoid
13754 <div data-parsoid='{"stx":"html"}'>foo</div>
13755 <table><tbody>
13756 <tr data-parsoid='{"autoInsertedStart":true}'><td data-parsoid='{}'>foo</td></tr>
13757 </tbody></table>
13758 !!end
13759
13760 !! test
13761 Indent and comment before table row
13762 !! wikitext
13763 {|
13764 <!--hi-->|-
13765 |there
13766 |}
13767 !! html/php
13768 <table>
13769
13770 <tbody><tr>
13771 <td>there
13772 </td></tr></tbody></table>
13773 !! html/parsoid
13774 <table>
13775 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-"}'>
13776 <td data-parsoid='{}'> there</td></tr>
13777 </tbody></table>
13778 !! end
13779
13780 # PHP parser omits empty TR
13781 !!test
13782 Empty TR followed by a template-generated TR
13783 !! wikitext
13784 {|
13785 |-
13786 {{1x|<tr><td>foo</td></tr>}}
13787 |}
13788 !! html/php
13789 <table>
13790
13791 <tbody><tr><td>foo</td></tr>
13792 </tbody></table>
13793 !! html/parsoid
13794 <table>
13795 <tbody>
13796 <tr class='mw-empty-elt'></tr>
13797 <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}}]}'>
13798 <td>foo</td></tr>
13799 </tbody></table>
13800 !!end
13801
13802 ## PHP and parsoid output differ for this; as usual PHP omits empty
13803 ## elements, and since it strips the comments the TR is empty.
13804 !!test
13805 Empty TR followed by mixed-ws-comment line should RT correctly
13806 !! wikitext
13807 {|
13808 |-
13809 <!--c-->
13810 |-
13811 <!--c--> <!--d-->
13812 |}
13813 !! html/php
13814 <table>
13815
13816
13817 </table>
13818 !! html/parsoid
13819 <table>
13820 <tbody>
13821 <tr class='mw-empty-elt'></tr>
13822 <!--c-->
13823 <tr class="mw-empty-elt">
13824 <!--c--> </tr><!--d-->
13825 </tbody></table>
13826 !! end
13827
13828 !!test
13829 Multi-line image caption generated by templates with/without trailing newlines
13830 !! wikitext
13831 [[File:Foobar.jpg|thumb|300x300px|foo\n{{1x|A}}\n{{1x|B}}\n{{1x|C}}]]
13832 [[File:Foobar.jpg|thumb|300x300px|foo\n{{1x|A}}\n{{1x|B}}\n{{1x|C}}\n\n]]
13833 !! html/parsoid
13834 <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>
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="#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>
13836 !! end
13837
13838 !! test
13839 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
13840 !! options
13841 parsoid=html2wt
13842 !! html/parsoid
13843 <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>
13844
13845 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
13846 !! wikitext
13847 <includeonly>foo</includeonly>
13848 new para
13849
13850 [[Category:Foo]]
13851
13852 = new heading =
13853 !! end
13854
13855 ## PHP emits broken html for this, and since this is primarily
13856 ## a Parsoid serializer test, marking this Parsoid only
13857 !! test
13858 Improperly nested inline or quotes tags with whitespace in between
13859 !! options
13860 parsoid=html2wt
13861 !! html/parsoid
13862 <p><span> <s>x</s></span><s> </s>
13863 <b> <i>x</i></b><i> </i>
13864 </p>
13865 !! wikitext
13866 <span> <s>x</s></span><s> </s>
13867 ''' ''x'''''
13868 !! end
13869
13870 !!test
13871 Encapsulate protected attributes from wt
13872 !! wikitext
13873 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
13874
13875 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
13876 |ok
13877 |}
13878 !! html/parsoid
13879 <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>
13880
13881 <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">
13882 <tbody><tr><td data-parsoid='{}'>ok</td></tr>
13883 </tbody></table>
13884 !!end
13885
13886 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
13887 ## Having nested or stray pre tags results in the attempt to add duplicates,
13888 ## causing an assertion fail. This test tries to prevent that situation.
13889 !! test
13890 Ensure ParagraphWrapper can deal with stray closing pre tags
13891 !! options
13892 parsoid=wt2html
13893 !! wikitext
13894 plain text</pre>
13895 !! html/parsoid
13896 <p>plain text</p>
13897 !! end
13898
13899 ## Remex doesn't account for fostered content.
13900 !! test
13901 1. Ensure fostered text content is wrapped in element nodes
13902 !! options
13903 parsoid=wt2html
13904 !! wikitext
13905 <table>hi</table><table>ho</table>
13906 !! html/php
13907 hi<table></table>ho<table></table>
13908 !! html/parsoid
13909 <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>
13910 !! end
13911
13912 ## Remex doesn't account for fostered content.
13913 !! test
13914 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
13915 !! options
13916 parsoid=wt2html,wt2wt
13917 !! wikitext
13918 <table>
13919 <tr> || ||
13920 <td> a
13921 </table>
13922 !! html/php
13923 || ||
13924 <table>
13925 <tbody><tr><td> a
13926 </td></tr></tbody></table>
13927 !! html/parsoid
13928 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
13929 <table data-parsoid='{"stx":"html"}'>
13930 <tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'> a
13931 </td></tr></tbody></table>
13932 !! end
13933
13934 ## Remex doesn't account for fostered content.
13935 !! test
13936 Encapsulation properly handles null DSR information from foster box
13937 !! options
13938 parsoid=wt2html,wt2wt
13939 !! wikitext
13940 {{1x|<table>foo<tr><td>bar</td></tr></table>}}
13941 !! html/parsoid
13942 <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>
13943 !! end
13944
13945 ## Remex doesn't account for fostered content.
13946 !! test
13947 1. Encapsulate foster-parented transclusion content
13948 !! options
13949 parsoid=wt2wt,wt2html
13950 !! wikitext
13951 <table>{{1x|foo<tr><td>bar</td></tr>}}</table>
13952 !! html/php
13953 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
13954 !! html/parsoid
13955 <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>
13956 !! end
13957
13958 !! test
13959 2. Encapsulate foster-parented transclusion content
13960 !! options
13961 parsoid=wt2wt,wt2html
13962 !! wikitext
13963 <table><div>{{1x|foo}}</div><tr><td>bar</td></tr></table>
13964 !! html/parsoid
13965 <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>
13966 <table>
13967 <tbody>
13968 <tr>
13969 <td>bar</td>
13970 </tr>
13971 </tbody>
13972 </table>
13973 !! end
13974
13975 !! test
13976 3. Encapsulate foster-parented transclusion content
13977 !! options
13978 parsoid=wt2wt,wt2html
13979 !! wikitext
13980 <table><div><p>{{1x|foo</p></div><tr><td>}}bar</td></tr></table>
13981 !! html/parsoid
13982 <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;]}">
13983 <p>foo</p>
13984 </div>
13985 <table>
13986 <tbody>
13987 <tr>
13988 <td>bar</td>
13989 </tr>
13990 </tbody>
13991 </table>
13992 !! end
13993
13994 !! test
13995 4. Encapsulate foster-parented transclusion content
13996 !! options
13997 parsoid=wt2wt,wt2html
13998 !! wikitext
13999 <table><div><p>{{1x|foo</p></div><tr><td>}}bar</td></tr></table>
14000 !! html/parsoid
14001 <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;]}">
14002 <p>foo</p>
14003 </div>
14004 <table>
14005 <tbody>
14006 <tr>
14007 <td>bar</td>
14008 </tr>
14009 </tbody>
14010 </table>
14011 !! end
14012
14013 ## Remex doesn't account for fostered content.
14014 !! test
14015 5. Encapsulate foster-parented transclusion content
14016 !!options
14017 parsoid=wt2wt,wt2html
14018 !! wikitext
14019 <table><tr><td><div><p>{{1x|foo</p></div></td>foo}}</tr></table>
14020 !! html/php
14021 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
14022 !! html/parsoid
14023 <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>
14024 !! end
14025
14026 ## Remex doesn't account for fostered content.
14027 !! test
14028 6. Encapsulate foster-parented transclusion content
14029 !! options
14030 parsoid=wt2wt,wt2html
14031 !! wikitext
14032 <table><tr><td><div><p>{{1x|foo</p></div></td>foo</tr></table>}}<p>ok</p>
14033 !! html/php
14034 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
14035 !! html/parsoid
14036 <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>
14037 !! end
14038
14039 !! test
14040 7. Encapsulate foster-parented transclusion content
14041 !!options
14042 parsoid=wt2wt,wt2html
14043 !! wikitext
14044 <table>{{1x|<p>foo</p>}}<td>bar</td></table>
14045 !! html/parsoid
14046 <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>
14047 <table>
14048 <tbody>
14049 <tr>
14050 <td>bar</td>
14051 </tr>
14052 </tbody>
14053 </table>
14054 !! end
14055
14056 ## Remex doesn't account for fostered content.
14057 # Note that the wt is broken on purpose: the = should be {{=}} if you
14058 # don't want it to be a template parameter key.
14059 !! test
14060 8. Encapsulate foster-parented transclusion content
14061 !! options
14062 parsoid=wt2wt,wt2html
14063 !! wikitext
14064 {{1x|a
14065 }}{|{{1x|style='color:red'}}
14066 |-
14067 |b
14068 |}
14069 !! html/php
14070 <p>a
14071 </p>
14072 <table>
14073
14074 <tbody><tr>
14075 <td>b
14076 </td></tr></tbody></table>
14077 !! html/parsoid
14078 <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">
14079 </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">
14080 <tbody><tr>
14081 <td>b
14082 </td></tr></tbody></table>
14083 !! end
14084
14085 ## Remex doesn't account for fostered content.
14086 !! test
14087 9. Encapsulate foster-parented transclusion content
14088 !!options
14089 parsoid=wt2wt,wt2html
14090 !! wikitext
14091 <table>{{1x|hi</table>hello}}
14092 !! html/php
14093 hi<table></table><p>hello</p>
14094 !! html/parsoid
14095 <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>
14096 !! end
14097
14098 !! test
14099 Table in fosterable position
14100 !!options
14101 parsoid=wt2html
14102 !! wikitext
14103 {{OpenTable}}
14104 <div>
14105 {|
14106 |}
14107 </div>
14108 |}
14109 !! html/parsoid
14110 <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":[[]]}'>
14111 </div><span about="#mwt1">
14112 </span>
14113 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
14114
14115 <table>
14116 </table>
14117 !! end
14118
14119 # Parsoid only for T66747
14120 # (Also core doesn't define {{#if}} in default install)
14121 !! test
14122 Properly encapsulate empty-content transclusions in fosterable positions
14123 !! wikitext
14124 <table>
14125 {{#if:|
14126 <td>foo</td>
14127 }}
14128 </table>
14129 !! html/parsoid
14130 <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"}]]}'>
14131
14132 </table>
14133 !! end
14134
14135 ## No longer captures its original intention
14136 !! test
14137 Always encapsulate foster box when template range is expanded to table
14138 !! options
14139 disabled
14140 parsoid=wt2wt
14141 !! wikitext
14142 {|
14143 hello
14144 {{OpenTable}}
14145 |}
14146 !! html/parsoid
14147 !! end
14148
14149 !! test
14150 T115289: Unclosed table
14151 !! wikitext
14152 {{1x|<table>}}<!--c-->[[Category:Two]]
14153 !! html/parsoid
14154 <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>
14155 !! end
14156
14157 !! test
14158 T115289: Don't migrate newlines out of tables with fostered content
14159 !! wikitext
14160 <table><td></td>{{1x|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
14161 !! html/parsoid
14162 <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>
14163 !! end
14164
14165 !! test
14166 T73074: More fostering fun
14167 !! wikitext
14168 <table><td></td>{{1x|<tr>}}<!--c-->[[Category:Two]]
14169 !! html/parsoid
14170 <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>
14171 !! end
14172
14173 ## Regression test for Parsoid's template wrapping of fostered content
14174 !! test
14175 Fostered content with a dom fragment token starting with a transclusion
14176 !! options
14177 parsoid=wt2html
14178 !! wikitext
14179 {|
14180 [[File:Foobar.jpg|right|{{1x|<div>123</div>}}]]
14181 |}
14182 !! html/parsoid
14183 <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>
14184
14185 </table>
14186 !! end
14187
14188 !! article
14189 Template:Tr
14190 !! text
14191 |-
14192 !! end
14193
14194 !! test
14195 1. Template wrapping shouldn't ignore fostered content
14196 !! options
14197 parsoid=wt2wt
14198 !! wikitext
14199 {|
14200 {{tr}}
14201 {{1x|
14202 }}
14203
14204 hiho
14205 !! html/parsoid
14206 !! end
14207
14208 !! test
14209 2. Template wrapping shouldn't ignore fostered content
14210 !! options
14211 parsoid=wt2wt
14212 !! wikitext
14213 {|
14214 {{tr}}
14215 {{1x|
14216 }}
14217
14218 hiho
14219 !! html/parsoid
14220 !! end
14221
14222 !!test
14223 Support <object> element with .data attribute
14224 !!options
14225 parsoid=html2wt
14226 !! html/parsoid
14227 <object data="test.swf"></object>
14228 !! wikitext
14229 <object data="test.swf"></object>
14230 !!end
14231
14232 !! test
14233 T72867: Don't block XML namespace declaration
14234 !! wikitext
14235 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
14236 !! html/php
14237 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
14238 </p>
14239 !! html/parsoid
14240 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
14241 !! end
14242
14243 # -----------------------------------------------------------------
14244 # The following section of tests are primarily to spec requirements
14245 # around Parsoid's serialization (old, new, edited content)
14246 #
14247 # All these tests are marked Parsoid html2wt and html2html only
14248 # ----------------------------------------------------------------
14249
14250 !! test
14251 Ignore rel attribute in a-tags during serialization to url-links
14252 !! options
14253 parsoid=html2wt
14254 !! html/parsoid
14255 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
14256 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
14257 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
14258 !! wikitext
14259 http://en.wikipedia.org/wiki/Foobar
14260 http://en.wikipedia.org/wiki/Foobar
14261 http://en.wikipedia.org/wiki/Foobar
14262 !! end
14263
14264 # 'mi' is a localinterwiki prefix as well as a language
14265 !! test
14266 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
14267 !! options
14268 parsoid=html2wt
14269 !! html/parsoid
14270 <p><a rel="mw:ExtLink" href="http://example.org/wiki/Foo">Foo</a></p>
14271 !! wikitext
14272 [[Foo]]
14273 !! end
14274
14275 !! test
14276 Parsoid should accept interwiki shortcuts
14277 !! options
14278 parsoid=html2wt
14279 !! html/parsoid
14280 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
14281 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
14282 <a href='./fr:Foo'>Foo</a></p>
14283 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
14284 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
14285 <a href='fr%3AFoo'>Foo</a></p>
14286 <p><a href='FR%3AFoo'>Foo</a>
14287 <a href='./FR:Foo'>Foo</a></p>
14288 !! wikitext
14289 [[:fr:Foo|Foo]]
14290 [[:fr:Foo|Foo]]
14291 [[:fr:Foo|Foo]]
14292
14293 [[:fr:Foo|Foo]]
14294 [[:fr:Foo|Foo]]
14295 [[:fr:Foo|Foo]]
14296
14297 [[:fr:Foo|Foo]]
14298 [[:fr:Foo|Foo]]
14299 !! end
14300
14301 !! test
14302 Parsoid should not accept invalid interwiki shortcuts
14303 !! options
14304 parsoid=html2wt
14305 !! html/parsoid
14306 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
14307 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
14308 <a href='news:Foo'>Foo</a></p>
14309 !! wikitext
14310 [news:Foo Foo]
14311 [news:Foo Foo]
14312 [news:Foo Foo]
14313 !! end
14314
14315 # See T93839
14316 !! test
14317 New wikilinks should be serialized properly
14318 !! options
14319 parsoid=html2wt
14320 !! html/parsoid
14321 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
14322 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
14323 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
14324 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
14325 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
14326 !! wikitext
14327 [[Foo]]
14328 [[Foo]]
14329 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
14330 http://en.wikipedia.org/wiki/Foo
14331 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
14332 !! end
14333
14334 !! test
14335 New wiki links (href variations)
14336 !! options
14337 parsoid=html2wt
14338 !! html/parsoid
14339 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
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="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
14343 !! wikitext
14344 [[Foo_bar]]
14345 [[Foo_bar]]
14346 [[Foo_bar]]
14347 [[Toxine bactérienne]]
14348 !! end
14349
14350 !! test
14351 New wiki links (content string variations)
14352 !! options
14353 parsoid=html2wt
14354 !! html/parsoid
14355 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
14356 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
14357 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
14358 !! wikitext
14359 [[Foo_bar]]
14360 [[Foo bar]]
14361 [[Foo_bar|./Foo_bar]]
14362 !! end
14363
14364 !! test
14365 New category links (href variations)
14366 !! options
14367 parsoid=html2wt
14368 !! html/parsoid
14369 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
14370 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
14371 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
14372 !! wikitext
14373 [[Category:Toxine bactérienne]]
14374 [[Category:Toxine bactérienne]]
14375 [[Category:Toxine bactérienne]]
14376 !! end
14377
14378 !! test
14379 New sol transparent links don't need indent-pre nowiki protection
14380 !! options
14381 parsoid=html2wt
14382 language=de
14383 !! html/parsoid
14384 <link rel="mw:PageProp/redirect" href="./Main_Page">
14385 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
14386 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
14387 !! wikitext
14388 #WEITERLEITUNG [[Main Page]]
14389 <!-- this is good --> [[Category:Good]]
14390 <!-- this is great --> [[Kategorie:Great]]
14391 !! end
14392
14393 !! test
14394 New interlanguage links (href variations)
14395 !! options
14396 parsoid=html2wt
14397 !! html/parsoid
14398 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
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%C3%A9rienne" />
14401 !! wikitext
14402 [[es:Toxine bactérienne]]
14403 [[es:Toxine_bactérienne]]
14404 [[es:Toxine_bactérienne]]
14405 !! end
14406
14407 # Regression test for T219023
14408 !! test
14409 Emit simple non-piped link where possible
14410 !! options
14411 parsoid=html2wt
14412 !! html/parsoid
14413 <a rel='mw:WikiLink' href='./VisualEditor'>VisualEditor</a>
14414 <a rel='mw:WikiLink' href='./VisualEditor'>visualEditor</a>
14415 <a rel='mw:WikiLink' href='./VisualEditor link'>VisualEditor link</a>
14416 <a rel='mw:WikiLink' href='./VisualEditor link'>visualEditor link</a>
14417 !! wikitext
14418 [[VisualEditor]]
14419 [[visualEditor]]
14420 [[VisualEditor link]]
14421 [[visualEditor link]]
14422 !! end
14423
14424 !! test
14425 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
14426 !! options
14427 parsoid=html2wt
14428 !! html/parsoid
14429 <ul>
14430 <li><p>foo</p></li>
14431 </ul>
14432 !! wikitext
14433 * foo
14434 !! end
14435
14436 !! test
14437 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
14438 !! options
14439 parsoid=html2wt
14440 !! html/parsoid
14441 <ul> <li>foo</li></ul>
14442 !! wikitext
14443 * foo
14444 !! end
14445
14446 !! test
14447 Don't strip leading whitespace when handling indent-pre suppressing tags
14448 !! options
14449 parsoid=html2wt
14450 !! html/parsoid
14451 <table>
14452 <tr><td> indented row</td></tr>
14453 </table>
14454 <blockquote><p>
14455 <b>This is very bold of you!</b>
14456 </p>
14457 <table><tr><td>
14458 indented cell (no pre-wrapping!)
14459 </td></tr></table>
14460 </blockquote>
14461 <p>foo</p>
14462 <div>bar</div>
14463 !! wikitext
14464 {|
14465 | indented row
14466 |}
14467 <blockquote>
14468 '''This is very bold of you!'''
14469
14470 {|
14471 |
14472 indented cell (no pre-wrapping!)
14473 |}
14474 </blockquote>
14475 foo
14476 <div>bar</div>
14477 !! end
14478
14479 !! test
14480 Strip leading whitespace when handling indent-pre inducing tags
14481 !! options
14482 parsoid=html2wt
14483 !! html/parsoid
14484 <p>foo</p>
14485 <span>bar</span>
14486
14487 <span>foo2
14488 </span>bar2
14489
14490 <div>foo</div>
14491 <span>bar</span>
14492
14493 <div>
14494 <span>foo</span>
14495 </div>
14496 !! wikitext
14497 foo
14498
14499 <span>bar</span>
14500
14501 <span>foo2
14502 </span>bar2
14503
14504 <div>foo</div>
14505 <span>bar</span>
14506
14507 <div>
14508 <span>foo</span>
14509 </div>
14510 !! end
14511
14512 !! test
14513 Lists: Dont insert newlines in a serialized list item.
14514 !! options
14515 parsoid=html2wt
14516 !! html/parsoid
14517 <ul><li>a<br>b</li><li>c</li></ul>
14518 !! wikitext
14519 * a<br />b
14520 * c
14521 !! end
14522
14523 !! test
14524 Headings: Force sol-transparent links and behavior switches to serialize before/after
14525 !! options
14526 parsoid={
14527 "modes": ["html2wt"]
14528 }
14529 !! html/parsoid
14530 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
14531 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
14532
14533 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
14534 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
14535
14536 <h2><meta property="mw:PageProp/toc" /> ok</h2>
14537 !! wikitext
14538 == hello there ==
14539 [[Category:A1]]
14540 [[Category:A2]]
14541
14542 == hi pal ==
14543
14544 <!--foo--> [[Category:A3]]
14545
14546 == how goes it ==
14547
14548 == it goes well ==
14549 [[Category:A4]] <!--bar-->
14550
14551 __TOC__
14552
14553 == ok ==
14554 !! end
14555
14556 !! test
14557 Headings: Don't hoist metas that come from templates
14558 !! options
14559 parsoid={
14560 "modes": ["html2wt"]
14561 }
14562 !! html/parsoid
14563 <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>
14564 !! wikitext
14565 == {{1x|foo [[Category:Foo]]}} ==
14566 !! end
14567
14568 !! test
14569 Parsoid: Serialize positional parameters with = in them as named parameter
14570 !! options
14571 parsoid=html2wt
14572 !! html/parsoid
14573 <p about="#mwt1" typeof="mw:Transclusion"
14574 data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
14575
14576 <p about="#mwt1" typeof="mw:Transclusion"
14577 data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
14578
14579 <!--Orig params with data-parsoid has heuristics for handling = chars-->
14580 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
14581 <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>
14582 !! wikitext
14583 {{1x|1=f=oo}}
14584
14585 {{1x|1=f=oo|2=bar}}
14586
14587 <!--Orig params with data-parsoid has heuristics for handling = chars-->
14588 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
14589 {{1x|<nowiki>f=oo</nowiki>|bar}}
14590 !! end
14591
14592 !! test
14593 Parsoid: Serialize positional parameters with = in extlink as named parameter
14594 !! options
14595 parsoid=html2wt
14596 !! html/parsoid
14597 <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>
14598 !! wikitext
14599 {{1x|1=http://stuff?is=ok}}
14600 !! end
14601
14602 !! test
14603 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
14604 !! options
14605 parsoid=html2wt
14606 !! html/parsoid
14607 <div>a<p>b</p></div>
14608 <div>a
14609 <p>b</p></div>
14610 <div>
14611 a
14612 <p>b</p></div>
14613 !! wikitext
14614 <div>a
14615 b
14616 </div>
14617 <div>a
14618 b
14619 </div>
14620 <div>
14621 a
14622
14623 b
14624 </div>
14625 !! end
14626
14627 !! test
14628 Substrings resembling wikitext in hrefs should not get nowiki escapes
14629 !! options
14630 parsoid=html2wt
14631 !! html/parsoid
14632 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
14633 !! wikitext
14634 [[Foo''bar''baz]]
14635 !! end
14636
14637 !! test
14638 Enforce single-line context in the serializer
14639 !! options
14640 parsoid=html2wt
14641 !! html/parsoid
14642 <h2>testing
14643 123</h2>
14644
14645 <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">
14646 </span><span about="#mwt1">you</span> </h2>
14647
14648 <h2> foo <span about="#mwt2" typeof="mw:Extension/spantag" data-mw='{"name":"spantag","body":{"extsrc":"hello\nthere"},"attrs":{}}'>hello
14649 there</span> </h2>
14650
14651 <ul><li>asd
14652 sdf</li></ul>
14653
14654 <ul><li>foo
14655 bar
14656 baz</li>
14657 <li>foo <b>bar</b>
14658 baz</li></ul>
14659
14660 <dl><dt>hi
14661 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
14662 ho</dd></dl>
14663
14664 <dl><dd> <table>
14665 <tbody><tr><td> ha
14666 ha
14667 ha</td></tr>
14668 </tbody></table></dd></dl>
14669 !! wikitext
14670 == testing 123 ==
14671
14672 == hi {{bogus|there
14673 you}} ==
14674
14675 == foo <spantag>hello
14676 there</spantag> ==
14677
14678 * asd sdf
14679
14680 * foo bar baz
14681 * foo '''bar''' baz
14682
14683 ; hi ho : hi ho
14684
14685 : {|
14686 | ha
14687 ha
14688 ha
14689 |}
14690 !! end
14691
14692 # Note that core parser doesn't like newlines in wikilinks in headings.
14693 # But, Parsoid handles it just fine. We'll consider this acceptable divergence.
14694 # We can change behavior if this becomes a real problem (ex: VE users start
14695 # adding newlines in links in headings which then breaks rendering when rendered
14696 # outside of Parsoid, or breaks section editing code). Eventually Parsoid will
14697 # core parser everywhere and this inconsistency will go away.
14698 !! test
14699 Ignore single-line context for wikilinks
14700 !! options
14701 parsoid=html2wt
14702 !! html/parsoid
14703 <ul><li><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect">
14704 bar</a></li></ul>
14705 <h2><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect">
14706 bar</a></h2>
14707 <ul><li><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect">bar
14708 <span style="background-color:green;
14709 color:blue" data-parsoid='{"stx":"html"}'>x</span></a></li></ul>
14710 !! wikitext
14711 * [[Foo|
14712 bar]]
14713
14714 == [[Foo|
14715 bar]] ==
14716
14717 * [[Foo|bar
14718 <span style="background-color:green;
14719 color:blue">x</span>]]
14720 !! end
14721
14722 !! test
14723 Selser: Ignore single-line context for wikilinks
14724 !! options
14725 parsoid={
14726 "modes": ["selser"],
14727 "selser": "noauto",
14728 "changes": [
14729 [ "ul > li ", "append", "<ul><li>foo</li></ul>" ]
14730 ]
14731 }
14732 !! wikitext
14733 * [[Foo|
14734 bar]]
14735 !! wikitext/edited
14736 * [[Foo|
14737 bar]]
14738 ** foo
14739 !! end
14740
14741 !! test
14742 Serialize new displayspace spans
14743 !! options
14744 parsoid=html2wt
14745 !! html/parsoid
14746 <p>foo<span typeof="mw:DisplaySpace"> </span>: bar</p>
14747
14748 <p>foo<span typeof="mw:DisplaySpace"> </span>: bar</p>
14749
14750 <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>
14751
14752 <a href="http://example.com">«<span typeof="mw:DisplaySpace">&nsbp;</span>Tour Eiffel<span typeof="mw:DisplaySpace">&nsbp;</span>»</a>
14753
14754 Hello<span typeof="mw:DisplaySpace">&nbsp;</span>World!
14755
14756 <ul>
14757 <li><span typeof="mw:DisplaySpace">&nbsp;</span>Foo</li>
14758 </ul>
14759 !! wikitext
14760 foo : bar
14761
14762 foo : bar
14763
14764 <spantag>foo : bar</spantag>ok
14765
14766 [http://example.com « Tour Eiffel »]
14767
14768 Hello World!
14769
14770 * Foo
14771 !! end
14772
14773
14774 #-----------------------
14775 # Tag minimization tests
14776 #-----------------------
14777
14778 !! test
14779 1. I/B quote minimization: wikitext-only tags should be combined
14780 !! options
14781 parsoid=html2wt
14782 !! html/parsoid
14783 <p><i>A</i><i>B</i></p>
14784 <p><b>A</b><b>B</b></p>
14785 <p><i>A</i><b><i>B</i></b></p>
14786 <p><b>A</b><i><b>B</b></i></p>
14787 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
14788 <p><i><b>A</b></i><i><b>B</b></i></p>
14789 <p><i><b>A</b></i><b><i>B</i></b></p>
14790 <p><b><i>A</i></b><i><b>B</b></i></p>
14791 !! wikitext
14792 ''AB''
14793
14794 '''AB'''
14795
14796 ''A'''B'''''
14797
14798 '''A''B'''''
14799
14800 '''A''BC''D'''
14801
14802 '''''AB'''''
14803
14804 '''''AB'''''
14805
14806 '''''AB'''''
14807 !! end
14808
14809 !! test
14810 2. I/B quote minimization: wikitext and html tags should not be combined
14811 !! options
14812 parsoid=html2wt
14813 !! html/parsoid
14814 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
14815 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
14816 !! wikitext
14817 ''A''<i>B</i>
14818
14819 ''A''<nowiki/>'''<i>B</i>'''
14820 !! end
14821
14822 !! test
14823 3. I/B quote minimization: templated content stops minimization
14824 !! options
14825 parsoid=html2wt
14826 !! html/parsoid
14827 <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>
14828 <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>
14829 !! wikitext
14830 ''A''{{1x|''B''}}
14831
14832 ''A''{{1x|'''''B'''''}}
14833 !! end
14834
14835 !! test
14836 4. I/B quote minimization: new content should be mimimized with adjacent old content
14837 !! options
14838 parsoid=html2wt
14839 !! html/parsoid
14840 <p><i>A</i><i>B</i></p>
14841 <p><b>A</b><b>B</b></p>
14842 <p><i>A</i><b><i>B</i></b></p>
14843 !! wikitext
14844 ''AB''
14845
14846 '''AB'''
14847
14848 ''A'''B'''''
14849 !! end
14850
14851 !! test
14852 5a. Merge adjacent quote nodes if they've been edited
14853 !! options
14854 parsoid={
14855 "modes": ["wt2wt", "selser"],
14856 "changes": [
14857 ["p", "contents", "remove", ":contains('b')"]
14858 ]
14859 }
14860 !! wikitext
14861 ''a''b''c''
14862 !! wikitext/edited
14863 ''ac''
14864 !! end
14865
14866 !! test
14867 5b. Merge adjacent quote nodes if they've been edited
14868 !! options
14869 parsoid={
14870 "modes": ["wt2wt", "selser"],
14871 "changes": [
14872 ["#x", "remove"]
14873 ]
14874 }
14875 !! wikitext
14876 ''a''<span id="x">b</span>''c''
14877 !! wikitext/edited
14878 ''ac''
14879 !! end
14880
14881 !! test
14882 1. Merge adjacent link nodes as long as at least one element is new
14883 !! options
14884 parsoid={
14885 "modes": ["html2wt"]
14886 }
14887 !! html/parsoid
14888 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
14889 <a data-parsoid="{}" 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 data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
14891 !! wikitext
14892 [[Football]]
14893 [[Football]]
14894 [[Football|Foot]][[Football|ball]]
14895 !! end
14896
14897 !! test
14898 2. Merge adjacent link nodes and enable additional normalizations
14899 !! options
14900 parsoid={
14901 "modes": ["html2wt"]
14902 }
14903 !! html/parsoid
14904 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
14905 !! wikitext
14906 ''[[Football]]''
14907 !! end
14908
14909 !! test
14910 1. Move format tags outside of WikiLink
14911 !! options
14912 parsoid={
14913 "modes": ["html2wt"]
14914 }
14915 !! html/parsoid
14916 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
14917 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
14918 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
14919 !! wikitext
14920 ''[[Football]]''
14921 '''''[[Football]]'''''
14922 <u>'''''[[Football]]'''''</u>
14923 !! end
14924
14925 !! test
14926 2. Move format tags outside of WikiLink with mergable A tags
14927 !! options
14928 parsoid={
14929 "modes": ["html2wt"]
14930 }
14931 !! html/parsoid
14932 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
14933 !! wikitext
14934 '''''[[Football]]'''''
14935 !! end
14936
14937 !! test
14938 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
14939 !! options
14940 parsoid={
14941 "modes": ["html2wt"]
14942 }
14943 !! html/parsoid
14944 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
14945 !! wikitext
14946 <font color="red"><u>'''[[Foo]]'''</u></font>
14947 !! end
14948
14949 !! test
14950 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
14951 !! options
14952 parsoid={
14953 "modes": ["html2wt"]
14954 }
14955 !! html/parsoid
14956 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
14957 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
14958 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
14959 !! wikitext
14960 [[Foo|<font color="red">Foo</font>]]
14961 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
14962 [[Foo|<span class="Bar">Foo</span>]]
14963 !! end
14964
14965 !! test
14966 5. T194083 Regression test: Manual edit test to move format tags outside wikilinks
14967 !! options
14968 parsoid={
14969 "modes": ["selser"],
14970 "changes": [
14971 ["a", "html", "<i>Foo</i>"]
14972 ]
14973 }
14974 !! wikitext
14975 [[Foo]]
14976 !! wikitext/edited
14977 ''[[Foo]]''
14978 !! end
14979
14980 !! test
14981 6. Regression test: Manual edit test to ensure diff markers are not lost
14982 !! options
14983 parsoid={
14984 "modes": ["selser"],
14985 "changes": [
14986 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
14987 ]
14988 }
14989 !! wikitext
14990 ''Foo''
14991 !! wikitext/edited
14992 ''[[Foo]]''
14993 !! end
14994
14995 !! test
14996 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
14997 !! options
14998 parsoid={
14999 "modes": ["selser"],
15000 "changes": [
15001 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
15002 ]
15003 }
15004 !! wikitext
15005 <div>placeholder</div>
15006 !! wikitext/edited
15007 <div>placeholder</div>
15008 [[Foo]] , placeholder
15009 !! end
15010
15011 ## No sort-key or templated sort-key
15012 !! test
15013 T192913 Regression test: 1. html2wt of links should not trip on parser functions found in target
15014 !! options
15015 parsoid
15016 !! wikitext
15017 [[Category:Bugs-{{#if:blah|Regression|None}}]]
15018 [[Category:Bugs-{{#if:blah|Regression|None}}|{{#if:blah|2020|None}}-#fragment]]
15019 !! html/parsoid
15020 <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>"}]]}'/>
15021 <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"}]]}'/>
15022 !! end
15023
15024 ## Untemplated sort-key (wt2html data-mw is missing sort-key information!)
15025 !! test
15026 T192913 Regression test: 2. html2wt of links should not trip on parser functions found in target (2)
15027 !! options
15028 parsoid
15029 !! wikitext
15030 [[Category:Bugs-{{#if:blah|Regression|None}}|fragment]]
15031 [[Category:Bugs-{{#if:blah|Regression|None}}-{{#if:blah|2020|None}}|fragment]]
15032 !! html/parsoid
15033 <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>"}]]}'/>
15034 <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>"}]]}'/>
15035 !! end
15036
15037 #------------------------------
15038 # End of tag minimization tests
15039 #------------------------------
15040
15041 !!test
15042 T56262: New entities
15043 !! options
15044 parsoid=html2wt
15045 !! html/parsoid
15046 <span typeof="mw:Entity">&nbsp;</span>
15047 !! wikitext
15048 &nbsp;
15049 !! end
15050
15051 !! test
15052 Consecutive <pre>s should not get merged
15053 !! options
15054 parsoid=html2wt,html2html
15055 !! html/parsoid
15056 <pre>a</pre><pre>b</pre>
15057
15058 <pre>c
15059 </pre><pre>
15060 d</pre>
15061
15062 <pre>e
15063
15064 </pre><pre>
15065
15066 f</pre>
15067 !! wikitext
15068 a
15069
15070 b
15071
15072 c
15073
15074 d
15075
15076 e
15077
15078
15079
15080 f
15081 !! end
15082
15083 !! test
15084 WTS of autolinks with trailing/surrounding context
15085 !! options
15086 parsoid=html2wt
15087 !! html/parsoid
15088 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
15089 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
15090 <p><b><a href="http://cscott.net">http://cscott.net</a></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>x</b></p>
15093 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
15094 !! wikitext
15095 http://cscott.net'''foo'''
15096
15097 http://cscott.net<b>foo</b>
15098
15099 '''http://cscott.net'''
15100
15101 '''http://cscott.net '''
15102
15103 '''http://cscott.net<nowiki/>x'''
15104
15105 http://cscott.net<nowiki/>x
15106 !! end
15107
15108 !! test
15109 WTS of autolinks with nowikis (round-trip)
15110 !! wikitext
15111 x<nowiki/>http://cscott.net<nowiki/>x
15112 !! html/parsoid
15113 <p>x<a rel="mw:ExtLink" href="http://cscott.net" class="external free">http://cscott.net</a>x</p>
15114 !! end
15115
15116 # this is the "easy" test because it leaves in place all the
15117 # data-parsoid information indicating this is an autolink
15118 !! test
15119 WTS of autolinks with escapes (editing)
15120 !! options
15121 parsoid={
15122 "modes": ["wt2wt"],
15123 "changes": [
15124 [ "span", "remove" ]
15125 ]
15126 }
15127 !! wikitext
15128 x<nowiki/>http://cscott.net<nowiki/>x
15129 !! wikitext/edited
15130 x<nowiki/>http://cscott.net<nowiki/>x
15131 !! end
15132
15133 !! test
15134 WTS of edited autolink-like text (T103364)
15135 !! options
15136 parsoid={
15137 "modes": ["wt2wt"],
15138 "changes": [
15139 [ "span[typeof]", "removeAttr", "typeof" ]
15140 ]
15141 }
15142 !! wikitext
15143 Not a link: <nowiki>http://example.com</nowiki>.
15144 !! wikitext/edited
15145 Not a link: <span><nowiki>http://example.com</nowiki></span>.
15146 !! end
15147
15148 !! test
15149 WTS of newly-authored autolink-like text (T103364)
15150 !! options
15151 parsoid=html2wt
15152 !! html/parsoid
15153 <p>http://example.com is not a link.</p>
15154 !! wikitext
15155 <nowiki>http://example.com</nowiki> is not a link.
15156 !! end
15157
15158 !! test
15159 WTS of autolink-like text after an autolink (T108563)
15160 !! options
15161 parsoid=html2wt
15162 !! html/parsoid
15163 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
15164 !! wikitext
15165 http://example.com <nowiki>http://example.com</nowiki> is not a link.
15166 !! end
15167
15168 !! test
15169 WTS of an autolink surrounded by square brackets (T220018)
15170 !! options
15171 parsoid=html2wt
15172 !! html/parsoid
15173 <p>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]</p>
15174 !! wikitext
15175 <nowiki>[</nowiki>http://example.com]
15176 !! end
15177
15178 !! test
15179 WTS of edited autolink surrounded by square brackets (T220018)
15180 !! options
15181 parsoid={
15182 "modes": ["wt2wt"],
15183 "changes": [
15184 [ "a", "before", "[" ],
15185 [ "a", "after", "]" ]
15186 ]
15187 }
15188 !! wikitext
15189 http://example.com
15190 !! wikitext/edited
15191 <nowiki>[</nowiki>http://example.com]
15192 !! end
15193
15194 !! test
15195 WTS of an external link surrounded by square brackets (T220018)
15196 !! options
15197 parsoid=html2wt
15198 !! html/parsoid
15199 <p>[<a rel="mw:ExtLink" href="http://example.com">foo</a>]</p>
15200 !! wikitext
15201 <nowiki>[</nowiki>[http://example.com foo]]
15202 !! end
15203
15204 !! test
15205 WTS of edited external link surrounded by square brackets (T220018)
15206 !! options
15207 parsoid={
15208 "modes": ["wt2wt"],
15209 "changes": [
15210 [ "a", "before", "[" ],
15211 [ "a", "after", "]" ]
15212 ]
15213 }
15214 !! wikitext
15215 [http://example.com foo]
15216 !! wikitext/edited
15217 <nowiki>[</nowiki>[http://example.com foo]]
15218 !! end
15219
15220 !! test
15221 Edited Redirect link should emit a non-piped wikitext link
15222 !! options
15223 parsoid=html2wt
15224 !! html/parsoid
15225 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
15226 !! wikitext
15227 #REDIRECT [[Bar]]
15228 !! end
15229
15230 !! test
15231 T75121: Infer extension name from typeOf if data-mw is not present
15232 !! options
15233 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
15234 !! html/parsoid
15235 <div typeOf="mw:Extension/foo"></div>
15236 !! wikitext
15237 <foo />
15238 !! end
15239
15240 # Note that the <p> wrapping isn't present in PHP parser output
15241 # The important thing for this test is that P-wrapping doesn't
15242 # interfere with the <nowiki> protection for leading - in <td>
15243 # (which isn't necessary for <th>).
15244 !! test
15245 T88318: p-wrapped dash in table.
15246 !! options
15247 parsoid=html2wt,wt2wt
15248 !! html/parsoid
15249 <table><tbody>
15250 <tr><th><p>-</p></th><th><p>- </p></th></tr>
15251 <tr><td><p>-</p></td><td><p>- </p></td></tr>
15252 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
15253 </tbody></table>
15254 !! wikitext
15255 {|
15256 !-
15257 !-
15258 |-
15259 |<nowiki>-</nowiki>
15260 |<nowiki>- </nowiki>
15261 |-
15262 |<small>-</small>
15263 |<br />
15264 -
15265 |<br />-
15266 |}
15267 !! html/php
15268 <table>
15269 <tbody><tr>
15270 <th>-
15271 </th>
15272 <th>-
15273 </th></tr>
15274 <tr>
15275 <td>-
15276 </td>
15277 <td>-
15278 </td></tr>
15279 <tr>
15280 <td><small>-</small>
15281 </td>
15282 <td><br />
15283 <p>-
15284 </p>
15285 </td>
15286 <td><br />-
15287 </td></tr></tbody></table>
15288 !! end
15289
15290 !! test
15291 T149209: WTS: Handle newlines in table cells properly
15292 !! options
15293 parsoid=html2wt
15294 !! html/parsoid
15295 <table>
15296 <tbody>
15297 <tr><td>a
15298 b
15299 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
15300 <tr><td><p>x</p>
15301 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
15302 </tbody></table>
15303 <table>
15304 <tbody>
15305 <tr><th>a
15306 b
15307 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
15308 <tr><th><p>x</h>
15309 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
15310 </tbody></table>
15311 !! wikitext
15312 {|
15313 |a
15314 b
15315 |c
15316 |-
15317 |x
15318 {{!}}y
15319 |}
15320 {|
15321 !a
15322 b
15323 !c
15324 |-
15325 !x
15326 !y
15327 |}
15328 !! end
15329
15330 !! test
15331 T149209: Selser: Handle newlines in table cells properly
15332 !! options
15333 parsoid={
15334 "modes": ["selser"],
15335 "changes": [
15336 [ "#h1", "html", "a\nb\n" ],
15337 [ "#h2", "html", "a\nb\n" ],
15338 [ "#c1", "html", "a\nb\n" ],
15339 [ "#c2", "html", "<p>a</p>" ],
15340 [ "#c3", "html", "<p>a</p>" ],
15341 [ "#c4", "html", "edit-me<p>a</p>" ]
15342 ]
15343 }
15344 !! wikitext
15345 {|
15346 ! id="h1" |edit-me!!1
15347 |-
15348 ! id="h2" |edit-me||2
15349 |-
15350 | id="c1" |edit-me||3
15351 |-
15352 | id="c2" |edit-me||4
15353 |-
15354 | id="c3" |edit-me||p||q||r
15355 |-
15356 | id="c4" |edit-me||p||q||r
15357 |}
15358 !! wikitext/edited
15359 {|
15360 ! id="h1" |a
15361 b
15362 !1
15363 |-
15364 ! id="h2" |a
15365 b
15366 !2
15367 |-
15368 | id="c1" |a
15369 b
15370 |3
15371 |-
15372 | id="c2" |a
15373 |4
15374 |-
15375 | id="c3" |a
15376 |p||q||r
15377 |-
15378 | id="c4" |edit-me
15379 a
15380 |p||q||r
15381 |}
15382 !! end
15383
15384 !! test
15385 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
15386 !! options
15387 parsoid=html2wt
15388 !! html/parsoid
15389 <table id='mwAb'>
15390 <td id='mwAc'>foo</td>
15391 <td id='serialize-this'>bar</td>
15392 </table>
15393 !! wikitext
15394 {|
15395 |foo
15396 | id="serialize-this" |bar
15397 |}
15398 !! end
15399
15400 !! test
15401 Parsoid-like element ids should not be serialized to wikitext unless shadowed
15402 !! options
15403 parsoid=html2wt
15404 !! html/parsoid
15405 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
15406 !! wikitext
15407 <div id="hello">ok</div>
15408 !! end
15409
15410 !!test
15411 Testing serialization after deletion of table cells
15412 !!options
15413 parsoid={
15414 "modes": ["wt2wt", "selser"],
15415 "changes": [
15416 ["#x", "remove"]
15417 ]
15418 }
15419 !!wikitext
15420 {|
15421 !h1 !!h2 !!h3
15422 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
15423 |}
15424 !! wikitext/edited
15425 {|
15426 !h1!!h2!!h3
15427 |c2|||c3
15428 |}
15429 !!end
15430
15431 !! test
15432 Testing selser after addition of new row before first row (T125419)
15433 !! options
15434 parsoid={
15435 "modes": ["wt2wt", "selser"],
15436 "changes": [
15437 [ "tr", "before", "<tr><td>X</td></tr>" ]
15438 ]
15439 }
15440 !! wikitext
15441 {|
15442 |a
15443 |}
15444 !! wikitext/edited
15445 {|
15446 |X
15447 |-
15448 |a
15449 |}
15450 !! end
15451
15452 !! test
15453 Serialize new table rows in a HTML table using HTML tags
15454 !! options
15455 parsoid={
15456 "modes": ["wt2wt", "selser"],
15457 "changes": [
15458 [ "tr", "before", "<tr><td>X</td></tr>" ]
15459 ]
15460 }
15461 !! wikitext
15462 <table><tr><td>a</td></tr></table>
15463 !! wikitext/edited
15464 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
15465 !! end
15466
15467 !! test
15468 Serialize new table cells in a HTML row using HTML tags
15469 !! options
15470 parsoid={
15471 "modes": ["wt2wt", "selser"],
15472 "changes": [
15473 [ "td", "before", "<td>X</td>" ]
15474 ]
15475 }
15476 !! wikitext
15477 <table><tr><td>a</td></tr></table>
15478 !! wikitext/edited
15479 <table><tr><td>X</td><td>a</td></tr></table>
15480 !! end
15481
15482 !! test
15483 Serialize wikitext list items as HTML list items when embedded in a HTML list
15484 !! options
15485 parsoid=html2wt
15486 !! html/parsoid
15487 <ul data-parsoid='{"stx": "html"}'>
15488 <li data-parsoid='{}'>a</li>
15489 <li>b</li>
15490 </ul>
15491 !! wikitext
15492 <ul>
15493 <li>a</li>
15494 <li>b</li>
15495 </ul>
15496 !! html/php
15497 <ul>
15498 <li>a</li>
15499 <li>b</li>
15500 </ul>
15501 !! end
15502
15503 # Nested list should be inside <li>, that is
15504 # <ul><li>foo<ul>..</ul></li></ul> instead of
15505 # <ul><li>foo</li><ul>..</ul></ul>
15506 # See https://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list
15507 !! test
15508 Wikitext lists can be nested inside HTML lists
15509 !! options
15510 parsoid=html2wt
15511 !! html/parsoid
15512 <ul data-parsoid='{"stx": "html"}'>
15513 <li data-parsoid='{"stx": "html"}'>a
15514 <ul><li>b</li></ul>
15515 </li>
15516 </ul>
15517
15518 <ul data-parsoid='{"stx": "html"}'>
15519 <li>x
15520 <ul><li>y</li></ul>
15521 </li>
15522 </ul>
15523 !! wikitext
15524 <ul>
15525 <li>a
15526 * b
15527 </li>
15528 </ul>
15529
15530 <ul>
15531 <li>x
15532 * y
15533 </li>
15534 </ul>
15535 !! html/php
15536 <ul>
15537 <li>a
15538 <ul><li>b</li></ul>
15539 </li>
15540 </ul>
15541 <ul>
15542 <li>x
15543 <ul><li>y</li></ul>
15544 </li>
15545 </ul>
15546 !! end
15547
15548 !! test
15549 WTS change modes
15550 !! options
15551 parsoid={
15552 "modes": ["wt2wt"],
15553 "changes": [
15554 [ "#xyz", "before", "<b>before</b> stuff " ],
15555 [ "#xyz", "after", " stuff <i>after</i>" ],
15556 [ "#xyz", "html", "x <b>y</b> z" ]
15557 ]
15558 }
15559 !! wikitext
15560 <span id="xyz">hello</span>
15561 !! wikitext/edited
15562 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
15563 !! end
15564
15565 !! test
15566 Never serialize a-tag as html, regardless of what data-parsoid has to say
15567 !! options
15568 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
15569 !! html/parsoid
15570 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
15571 !! wikitext
15572 [[Foo]]
15573 !! end
15574
15575 ## SSS FIXME: This is broken output nevertheless.
15576 ## What might be a reasonable non-broken output for this?
15577 ## This is an edge case unlikely to be seen in production
15578 ## that I am not wasting more time on this right now.
15579 !! test
15580 Never serialize a-tag as html, no matter what attributes it has
15581 !! options
15582 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
15583 !! html/parsoid
15584 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
15585 !! wikitext
15586 [http://boo.org http://boohoo.org]
15587 !! end
15588
15589 # Misnested is an indication that selser can reuse the source but these have
15590 # shown to sneak through on occasion. See T101768.
15591 # The original wikitext here is: [http://test.com [[one]] two three]
15592 !! test
15593 Strip span tags added to mark misnested links
15594 !! options
15595 parsoid=html2wt
15596 !! html/parsoid
15597 <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>
15598 !! wikitext
15599 [http://test.com][[one]] two three
15600 !! end
15601
15602 !! test
15603 Catch regression when unpacking misnested links
15604 !! options
15605 parsoid=wt2html
15606 !! wikitext
15607 {{1x|hi}}[http://example.com [[ho]]]
15608 !! html/parsoid
15609 <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>
15610 !! end
15611
15612 !! test
15613 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
15614 !! options
15615 parsoid=html2wt
15616 !! html/parsoid
15617 <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|}"]}'>
15618 <tbody><tr><td>d
15619 </td></tr>
15620 </tbody></table>
15621 !! wikitext
15622 {{1x|a}}
15623 {|{{1x|c
15624 {{!}}d
15625 }}
15626 |}
15627 !! end
15628
15629 ## This test verifies the presence and computation of this attribute indirectly
15630 ## by making an edit and ensuring that the serialization is correct (which it would be
15631 ## only if firstWikitextNode is properly set).
15632 !! test
15633 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
15634 !! options
15635 parsoid= {
15636 "modes": ["wt2wt"],
15637 "changes": [
15638 [ "div#x", "remove" ],
15639 [ "div", "before", "<div>new</div>" ]
15640 ]
15641 }
15642 !! wikitext
15643 <div id="x">foo</div>
15644 {|
15645 {{1x|<div>boo</div>
15646 {{!}}b}}
15647 |c
15648 |}
15649 !! wikitext/edited
15650
15651 <div>new</div>
15652 {|
15653 {{1x|<div>boo</div>
15654 {{!}}b}}
15655 |c
15656 |}
15657 !! end
15658
15659 # --------------------------------------------
15660 # Tests spec'ing wikitext serialization norms |
15661 # --------------------------------------------
15662
15663 !! test
15664 Serialize multi-line indent-pre starting with wikitext syntax
15665 !! options
15666 parsoid=html2wt
15667 !! html/parsoid
15668 <pre>* 1
15669 ** 2
15670 * 3</pre>
15671 !! wikitext
15672 * 1
15673 ** 2
15674 * 3
15675 !! end
15676
15677 !! test
15678 1. Categories should always be serialized on their own line
15679 !! options
15680 parsoid=html2wt
15681 !! html/parsoid
15682 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
15683 !! wikitext
15684 foo
15685 [[Category:Foo]]
15686 bar
15687 !! end
15688
15689 !! test
15690 2. Categories that are part of templates should not introduce a line break
15691 !! wikitext
15692 foo {{1x|<span>bar</span> [[Category:baz]]}} bar
15693 !! html/parsoid
15694 <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>
15695 !! end
15696
15697 # Careful while editing these next 2 tests. There are \u200f characters
15698 # before and after the <link> tags in the HTML and following some
15699 # of the categories in wikitext
15700 # Do not remove these characters in edits.
15701 #
15702 # As part of the serialization, these bidi characters will get stripped.
15703 !! test
15704 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
15705 !! options
15706 parsoid={
15707 "modes": ["html2wt"]
15708 }
15709 !! html/parsoid
15710 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
15711 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
15712 !! wikitext
15713 [[קטגוריה:טקסים]]
15714 [[קטגוריה: שיטות משפט]]
15715 !! end
15716
15717 !! test
15718 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
15719 !! options
15720 parsoid={
15721 "modes": ["html2wt"]
15722 }
15723 !! html/parsoid
15724 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
15725 !! wikitext
15726 [[קטגוריה:טקסים]]
15727 ‏y
15728 !! end
15729
15730 !! test
15731 Lists: Add space after bullets
15732 !! options
15733 parsoid=html2wt
15734 !! html/parsoid
15735 <ul>
15736 <li>foo</li>
15737 <li> bar</li>
15738 <li><span> baz</span></li>
15739 </ul>
15740 !! wikitext
15741 * foo
15742 * bar
15743 * <span> baz</span>
15744 !! end
15745
15746 !! test
15747 1. Headings: Add space before/after == (T53744)
15748 !! options
15749 parsoid=html2wt
15750 !! html/parsoid
15751 <h2>foo</h2>
15752 <h2> bar</h2>
15753 <h2>baz </h2>
15754 <h2><span> baz</span></h2>
15755 !! wikitext
15756 == foo ==
15757
15758 == bar ==
15759
15760 == baz ==
15761
15762 == <span> baz</span> ==
15763 !! end
15764
15765 !! test
15766 2. Headings: Add space before/after == even after hoisted content
15767 !! options
15768 parsoid={
15769 "modes": ["html2wt"]
15770 }
15771 !! html/parsoid
15772 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
15773 !! wikitext
15774 [[Category:A2]]
15775
15776 == ok ==
15777 !! end
15778
15779 !! test
15780 1. Headings: suppress newly created empty headings
15781 !! options
15782 parsoid={
15783 "modes": ["html2wt"]
15784 }
15785 !! html/parsoid
15786 <h2></h2>
15787 !! wikitext
15788 !! end
15789
15790 !! test
15791 2. Headings: suppress empty headings on edits
15792 !! options
15793 parsoid={
15794 "modes": ["selser"],
15795 "changes": [
15796 [ "#x", "remove"]
15797 ]
15798 }
15799 !! wikitext
15800 ==<span id="x">foo</span>==
15801 !! wikitext/edited
15802 !! end
15803
15804 !! test
15805 Headings: Replace <br/> with a single whitespace char
15806 !! options
15807 parsoid={
15808 "modes": ["html2wt"]
15809 }
15810 !! html/parsoid
15811 <h2>foo<br/>bar</h2>
15812 <h2>foo <span><br/>bar</span> baz</h2>
15813 !! wikitext
15814 == foo bar ==
15815
15816 == foo <span> bar</span> baz ==
15817 !! end
15818
15819 !! test
15820 1. WT Quote Tags: suppress newly created empty style tags
15821 !! options
15822 parsoid={
15823 "modes": ["html2wt"]
15824 }
15825 !! html/parsoid
15826 <i></i><b></b>
15827 !! wikitext
15828 !! end
15829
15830 !! test
15831 2. WT Quote Tags: suppress empty style tags on edits
15832 !! options
15833 parsoid={
15834 "modes": ["selser"],
15835 "changes": [
15836 [ "#x", "remove"]
15837 ]
15838 }
15839 !! wikitext
15840 '''<span id="x">foo</span>'''
15841 !! wikitext/edited
15842 !! end
15843
15844 !! test
15845 1. Anchors: suppress newly created empty anchors
15846 !! options
15847 parsoid={
15848 "modes": ["html2wt"]
15849 }
15850 !! html/parsoid
15851 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
15852 !! wikitext
15853 !! end
15854
15855 !! test
15856 2. Anchors: suppress empty anchors on edits
15857 !! options
15858 parsoid={
15859 "modes": ["selser"],
15860 "changes": [
15861 [ "#x", "remove"]
15862 ]
15863 }
15864 !! wikitext
15865 [[Test|<span id="x">foo</span>]]
15866 !! wikitext/edited
15867 !! end
15868
15869 !! test
15870 3a. Anchors: do not suppress numbered extlinks
15871 !! options
15872 parsoid={
15873 "modes": ["wt2wt"]
15874 }
15875 !! wikitext
15876 [http://foo.com]
15877 !! html/parsoid
15878 <a rel="mw:ExtLink" href="http://foo.com"></a>
15879 !! end
15880
15881 !! test
15882 3b. Anchors: do not suppress numbered extlinks
15883 !! options
15884 parsoid={
15885 "modes": ["wt2wt"],
15886 "changes": [
15887 [ "#x", "remove"]
15888 ]
15889 }
15890 !! wikitext
15891 [http://foo.com <span id="x">foo</span>]
15892 !! wikitext/edited
15893 [http://foo.com]
15894 !! end
15895
15896 !!test
15897 Normalizations should be restricted to edited content
15898 !!options
15899 parsoid={
15900 "modes": ["selser"],
15901 "changes": [
15902 [ "h1", "before", "<i></i>"]
15903 ]
15904 }
15905 !!wikitext
15906 a
15907 = =
15908 b
15909 !!wikitext/edited
15910 a
15911 = =
15912 b
15913 !!end
15914
15915 !! test
15916 1. Multiple normalizations (html2wt)
15917 !! options
15918 parsoid={
15919 "modes": ["html2wt"]
15920 }
15921 !! html/parsoid
15922 <h2><i></i></h2>
15923 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
15924 </a><b><i></i></b>x</p>
15925 !! wikitext
15926
15927 [[foo]]
15928 x
15929 !! end
15930
15931 !! test
15932 2. Multiple normalizations (selser)
15933 !! options
15934 parsoid={
15935 "modes": ["selser"],
15936 "changes": [
15937 [ "#x", "after", "<h1><i></i></h1>\n<p> bar<b></b></p>"]
15938 ]
15939 }
15940 !! wikitext
15941 <div id="x">foo</div>
15942 !! wikitext/edited
15943 <div id="x">foo</div>
15944 bar
15945 !! end
15946
15947 !! test
15948 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
15949 !! options
15950 parsoid={
15951 "modes": ["html2wt"]
15952 }
15953 !! html/parsoid
15954 <p> hi</p>
15955 <p> hello</p>
15956 !! wikitext
15957 hi
15958
15959 hello
15960 !! end
15961
15962 !! test
15963 2. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
15964 !! options
15965 parsoid={
15966 "modes": ["html2wt"]
15967 }
15968 !! html/parsoid
15969 <p>Foo
15970 bar
15971 baz</p>
15972
15973 <table><tr><td>Foo
15974 bar
15975 baz bang</td></tr></table>
15976
15977 <p><!--boo--> foo
15978 bar</p>
15979
15980 <p> foo
15981 bar<span>boo</span></p>
15982 !! wikitext
15983 Foo
15984 bar
15985 baz
15986
15987 {|
15988 |Foo
15989 bar
15990 baz bang
15991 |}
15992
15993 <!--boo-->foo
15994 bar
15995
15996 foo
15997 bar<span>boo</span>
15998 !! end
15999
16000 !! test
16001 3. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
16002 !! options
16003 parsoid={
16004 "modes": ["selser"],
16005 "changes": [
16006 [ "p", "html", " a\n b" ]
16007 ]
16008 }
16009 !! wikitext
16010 xyz
16011 !! wikitext/edited
16012 a
16013 b
16014 !! end
16015
16016 !! test
16017 New links that end in spaces
16018 !! options
16019 parsoid={
16020 "modes": ["html2wt"]
16021 }
16022 !! html/parsoid
16023 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
16024 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
16025 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
16026 !! wikitext
16027 [[Berlin]] is the capital of Germany.
16028
16029 [[Foo]] '''bar'''
16030
16031 [[Boston]] is a city.
16032 !! end
16033
16034 !! test
16035 1. Table cells with escapable prefixes
16036 !! options
16037 parsoid={
16038 "modes": ["html2wt"]
16039 }
16040 !! html/parsoid
16041 <table>
16042 <tr><td>a</td></tr>
16043 <tr><td>-</td></tr>
16044 <tr><td>+</td></tr>
16045 <tr><td>}</td></tr>
16046 </table>
16047 !! wikitext
16048 {|
16049 |a
16050 |-
16051 | -
16052 |-
16053 | +
16054 |-
16055 | }
16056 |}
16057 !! end
16058
16059 !! test
16060 2a. Table cells with escapable prefixes after edits
16061 !! options
16062 parsoid={
16063 "modes": ["selser"],
16064 "changes": [
16065 [ "table tbody tr:first-child td:first-child", "remove"]
16066 ]
16067 }
16068 !! wikitext
16069 {|
16070 |a||-
16071 |}
16072 !! wikitext/edited
16073 {|
16074 | -
16075 |}
16076 !! end
16077
16078 !! test
16079 2b. Table cells with escapable prefixes after edits
16080 !! options
16081 parsoid={
16082 "modes": ["selser"],
16083 "changes": [
16084 [ "table tbody tr:first-child td:first-child", "html", "-" ],
16085 [ "#x", "remove" ]
16086 ]
16087 }
16088 !! wikitext
16089 {|
16090 |pqr
16091 |<span id="x">foo</span>+
16092 |}
16093 !! wikitext/edited
16094 {|
16095 | -
16096 | +
16097 |}
16098 !! end
16099
16100 # FIXME: This test will fail because
16101 # normalization doesn't realize that the id attribute
16102 # will eliminate the escapable scenario
16103 !! test
16104 3a. Table cells without escapable prefixes after edits
16105 !! options
16106 parsoid={
16107 "modes": ["selser"],
16108 "changes": [
16109 [ "#x", "html", "-" ]
16110 ]
16111 }
16112 !! wikitext
16113 {|
16114 | id="x" |abcd
16115 |}
16116 !! wikitext/edited
16117 {|
16118 | id="x" |-
16119 |}
16120 !! end
16121
16122 ## This tests normalizer's ability to discriminate between
16123 ## cells having identical content.
16124 !! test
16125 3b. Table cells without escapable prefixes after edits
16126 !! options
16127 parsoid={
16128 "modes": ["selser"],
16129 "changes": [
16130 [ "td", "html", "-" ]
16131 ]
16132 }
16133 !! wikitext
16134 {|
16135 |a||b
16136 |}
16137 !! wikitext/edited
16138 {|
16139 | -||-
16140 |}
16141 !! end
16142
16143 ## This tests normalizer's ability to not be tripped by
16144 ## comments (and whitespace)
16145 !! test
16146 3c. Table cells without escapable prefixes after edits
16147 !! options
16148 parsoid={
16149 "modes": ["selser"],
16150 "changes": [
16151 [ "table tbody tr td:first-child", "remove" ]
16152 ]
16153 }
16154 !! wikitext
16155 {|
16156 |-
16157 <!--foo--> |a||-
16158 |}
16159 !! wikitext/edited
16160 {|
16161 |-
16162 <!--foo--> | -
16163 |}
16164 !! end
16165
16166 ## This tests normalizer's ability to handle HTML cells
16167 !! test
16168 3d. Table cells without escapable prefixes after edits
16169 !! options
16170 parsoid={
16171 "modes": ["selser"],
16172 "changes": [
16173 [ "td", "html", "-" ]
16174 ]
16175 }
16176 !! wikitext
16177 <table>
16178 <tr><td>a</td></tr>
16179 </table>
16180 !! wikitext/edited
16181 <table>
16182 <tr><td>-</td></tr>
16183 </table>
16184 !! end
16185
16186 ## T111151 Remove font elements without attributes
16187 !! test
16188 4. font tags without attributes should be dropped
16189 !! options
16190 parsoid={
16191 "modes": ["html2wt"]
16192 }
16193 !! html/parsoid
16194 <font>foo</font>
16195 <font><font>bar</font></font>
16196 <font class="x">boo</font>
16197 !! wikitext
16198 foo
16199 bar
16200 <font class="x">boo</font>
16201 !! end
16202
16203 !! test
16204 Normalize empty paragraphs to HTML form that html2wt expects
16205 !! options
16206 parsoid={
16207 "modes": ["html2wt"]
16208 }
16209 !! html/parsoid
16210 <div>1</div>
16211 <p>a</p><p></p><p>b</p>
16212 <div>2</div>
16213 <p>a</p>
16214 <p></p>
16215 <p>b</p>
16216 <div>3</div>
16217 <p>a</p>
16218 <p></p>
16219 <p></p>
16220 <p></p>
16221 <p></p>
16222 <p>b</p>
16223 <div>4</div>
16224 <p>a</p>
16225 <p></p>
16226 <div>foo</div>
16227 !! wikitext
16228 <div>1</div>
16229 a
16230
16231
16232 b
16233 <div>2</div>
16234 a
16235
16236
16237 b
16238 <div>3</div>
16239 a
16240
16241
16242
16243
16244
16245 b
16246 <div>4</div>
16247 a
16248
16249 <div>foo</div>
16250 !! html/php
16251 <div>1</div>
16252 <p>a
16253 </p><p><br />
16254 b
16255 </p>
16256 <div>2</div>
16257 <p>a
16258 </p><p><br />
16259 b
16260 </p>
16261 <div>3</div>
16262 <p>a
16263 </p><p><br />
16264 </p><p><br />
16265 </p><p>b
16266 </p>
16267 <div>4</div>
16268 <p>a
16269 </p>
16270 <div>foo</div>
16271 !! end
16272
16273 !! test
16274 Templated content should be skipped over by normalization
16275 !! options
16276 parsoid={
16277 "modes": ["html2wt"]
16278 }
16279 !! html/parsoid
16280 <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">
16281 </span><p about="#mwt2"></p><span about="#mwt2">
16282 </span>
16283 !! wikitext
16284 {{SomeTemplate1|boo}}{{SomeTemplate2|booboo}}
16285 !! end
16286
16287 !! test
16288 Escape DOM elements
16289 !! options
16290 parsoid=html2wt
16291 !! html/parsoid
16292 <nowiki><i>foo</i></nowiki>
16293 <noinclude><i>foo</i></noinclude>
16294 <includeonly><i>foo</i></includeonly>
16295 !! wikitext
16296 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
16297 &lt;noinclude&gt;''foo''&lt;/noinclude&gt;
16298 &lt;includeonly&gt;''foo''&lt;/includeonly&gt;
16299 !! end
16300
16301 !! test
16302 Don't escape pre elements that fail to parse as extension tags
16303 !! wikitext
16304 <pre>closed is extension tag, so everything is <span>text</span></pre>
16305 <pre>unclosed is not, so these are <span>tags</span>
16306 !! html/php
16307 <pre>closed is extension tag, so everything is &lt;span&gt;text&lt;/span&gt;</pre>
16308 <pre>unclosed is not, so these are <span>tags</span></pre>
16309 !! html/parsoid
16310 <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>
16311 <pre data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unclosed is not, so these are <span>tags</span></pre>
16312 !! end
16313
16314 !! test
16315 New list is serialized on newlines
16316 !! options
16317 parsoid=html2wt
16318 !! html/parsoid
16319 <p>The quick brown fox jumps over the lazy dog.</p><ul>
16320 <li>Yesterday</li>
16321 <li>Today</li>
16322 <li>Tomorrow</li>
16323 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
16324 !! wikitext
16325 The quick brown fox jumps over the lazy dog.
16326
16327 * Yesterday
16328 * Today
16329 * Tomorrow
16330
16331 The quick onyx goblin jumps over the lazy dwarf.
16332 !! end
16333
16334 !! test
16335 New lists in formatting elements serialized w/o newlines
16336 !! options
16337 parsoid=html2wt
16338 !! html/parsoid
16339 <small>
16340
16341 <ul>
16342 <li>123</li>
16343 </ul>
16344
16345 </small>
16346
16347 <small><ul><li>hi</li></ul></small>
16348 !! wikitext
16349 <small>
16350 * 123
16351 </small>
16352
16353 <small>
16354 * hi
16355 </small>
16356 !! end
16357
16358 !! test
16359 New list in table doesn't need newlines
16360 !! options
16361 parsoid=html2wt
16362 !! html/parsoid
16363 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
16364 !! wikitext
16365 {|
16366 |
16367 * test
16368 * 123
16369 |}
16370 !! end
16371
16372 !! test
16373 Newly inserted noinclude tags do not need newlines before/after
16374 !! html/parsoid
16375 <p>a<meta typeof="mw:Includes/NoInclude">b<meta typeof="mw:Includes/NoInclude/End">c</p>
16376 !! wikitext
16377 a<noinclude>b</noinclude>c
16378 !! end
16379
16380 # ---------------------------------------------------
16381 # End of tests spec'ing wikitext serialization norms |
16382 # ---------------------------------------------------
16383
16384 # T104032
16385 !! test
16386 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
16387 !! options
16388 parsoid=html2wt
16389 !! html/parsoid
16390 a<p>b</p>
16391 <b>c</b><p>d</p>
16392 <table><tr>
16393 <td>a<p>b</p></td>
16394 <td><b>c</b><p>d</p></td>
16395 </tr></table>
16396 !! wikitext
16397 a
16398
16399 b
16400
16401 '''c'''
16402
16403 d
16404 {|
16405 |a
16406 b
16407 |'''c'''
16408 d
16409 |}
16410 !! end
16411
16412 !! test
16413 Anchor without href scenarios
16414 !! options
16415 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
16416 !! html/parsoid
16417 <a class="bc"></a>
16418 <a class="no">dice</a>
16419 <a name="foo"></a>
16420 !! wikitext
16421
16422 dice
16423 <span name="foo"></span>
16424 !! end
16425
16426 !! test
16427 New transclusion added after a list should be serialized after the list
16428 !! options
16429 parsoid=html2wt
16430 !! html/parsoid
16431 <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>
16432 !! wikitext
16433 * a
16434 {{1x|foo}}
16435 !! end
16436
16437 ## FIXME: This test is less useful now that the leading space is normalized away
16438 !! test
16439 Only html p-tag is strong indent pre suppressing
16440 !! options
16441 parsoid=html2wt
16442 !! html/parsoid
16443 <p>test2<span>
16444 test3
16445 </span></p>
16446 !! wikitext
16447 test2<span>
16448 test3
16449 </span>
16450 !! end
16451
16452 # Clients like VE don't know about this property (T238721)
16453 !! test
16454 T238721: New transclusion without the "i" property for a template part should be handled properly
16455 !! options
16456 parsoid=html2wt
16457 !! html/parsoid
16458 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"}}}]}'>foo</span>
16459 !! wikitext
16460 {{1x}}
16461 !! end
16462
16463 # -----------------------------------------------------------------
16464 # End of section for Parsoid-only html2wt tests for serialization
16465 # of new content
16466 # -----------------------------------------------------------------
16467
16468 # -----------------------------------------------------------------
16469 # The following section of tests are primarily to spec behavior of
16470 # the selective serializer. All these tests have manual selser
16471 # changes. The automated selser changes for all tests handle the
16472 # wide variation of changes, but these tests here capture specs
16473 # deterministically.
16474 # ----------------------------------------------------------------
16475
16476 ## T90517
16477 !! test
16478 Selser: New comments should not be lost
16479 !! options
16480 parsoid={
16481 "modes": ["selser"],
16482 "changes": [
16483 [ "#a", "after", "<!--c1-->" ],
16484 [ "#b", "before", "<!--c2-->" ]
16485 ]
16486 }
16487 !! wikitext
16488 <span id="a">a</span>
16489
16490 <span id="b">b</span>
16491 !! wikitext/edited
16492 <span id="a">a</span><!--c1-->
16493
16494 <!--c2--><span id="b">b</span>
16495 !! end
16496
16497 ## T89383
16498 !! test
16499 Selser: Check for validity of DSR before using it
16500 !! options
16501 parsoid={
16502 "modes": ["selser"],
16503 "changes": [
16504 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
16505 ]
16506 }
16507 !! wikitext
16508 <span id="a">a</span>
16509 !! wikitext/edited
16510 {{DISPLAYTITLE:foo}}
16511 <span id="a">a</span>
16512 !! end
16513
16514 !! test
16515 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
16516 !! options
16517 parsoid={
16518 "modes": ["selser"],
16519 "changes": [
16520 [ "div:first-child", "text", "bar" ]
16521 ]
16522 }
16523 !! wikitext
16524 <div style="{{1x|color:red;}}%">foo</div>
16525 !! wikitext/edited
16526 <div style="{{1x|color:red;}}%">bar</div>
16527 !! end
16528
16529 !! test
16530 Empty LI (T49673)
16531 !! wikitext
16532 *a
16533 *
16534 *
16535 *b
16536 !! html
16537 <ul><li>a</li>
16538 <li class="mw-empty-elt"></li>
16539 <li class="mw-empty-elt"></li>
16540 <li>b</li></ul>
16541 !! end
16542
16543 !! test
16544 Empty list item with rendering transparent tag
16545 !! wikitext
16546 {{1x|*hmm
16547 *[[category:123]]}}
16548 !! html/php
16549 <ul><li>hmm</li>
16550 <li class="mw-empty-elt"></li></ul>
16551 !! html/parsoid
16552 <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>
16553 <li class="mw-empty-elt"><link rel="mw:PageProp/Category" href="./Category:123"/></li></ul>
16554 !! end
16555
16556 !! test
16557 unclosed internal link XSS (T137264)
16558 !! wikitext
16559 [[#%3Cscript%3Ealert(1)%3C/script%3E|
16560 !! html/php
16561 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
16562 </p>
16563 !! html/parsoid
16564 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
16565 !! end
16566
16567 !! test
16568 Validating that <style> isn't eaten by tidy (T167349)
16569 !! options
16570 styletag=1
16571 !! wikitext
16572 <div class="foo">
16573 <style>.foo::before { content: "<foo>"; }</style>
16574 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
16575 </div>
16576 !! html/php
16577 <div class="foo">
16578 <style>.foo::before { content: "<foo>"; }</style>
16579 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
16580 </div>
16581 !! html/parsoid
16582 <div class="foo">
16583 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
16584 <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>
16585 </div>
16586 !! end
16587
16588 ## Right now, Parsoid doesn't de-duplicate style tags.
16589 ## So, we shouldn't see link tags that need to bypass the sanitizer.
16590 ## In a followup patch, when we de-duplicate style tags and
16591 ## introduce link tags, we'll add a hook for link tags in
16592 ## the parser test runner script.
16593 !! test
16594 Validating that <style> isn't wrapped in a paragraph (T186965)
16595 !! options
16596 styletag=1
16597 !! wikitext
16598 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
16599
16600 <style>.foo::before { content: "<foo>"; }</style>
16601
16602 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
16603
16604 But if it's on a line with other content, let it be wrapped.
16605
16606 <style>.foo::before { content: "<foo>"; }</style> bar
16607
16608 foo <style>.foo::before { content: "<foo>"; }</style>
16609
16610 foo <style>.foo::before { content: "<foo>"; }</style> bar
16611
16612 And the same if we have non-paragraph-breaking whitespace
16613
16614 foo
16615 <style>.foo::before { content: "<foo>"; }</style>
16616 bar
16617 !! html/php
16618 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
16619 </p>
16620 <style>.foo::before { content: "<foo>"; }</style>
16621 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar" /><style>.foo::before { content: "<foo>"; }</style>
16622 <p>But if it's on a line with other content, let it be wrapped.
16623 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
16624 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
16625 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
16626 </p><p>And the same if we have non-paragraph-breaking whitespace
16627 </p><p>foo
16628 <style>.foo::before { content: "<foo>"; }</style>
16629 bar
16630 </p>
16631 !! html/parsoid
16632 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph</p>
16633
16634 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
16635
16636 <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>
16637
16638 <p>But if it's on a line with other content, let it be wrapped.</p>
16639
16640 <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>
16641
16642 <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>
16643
16644 <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>
16645
16646 <p>And the same if we have non-paragraph-breaking whitespace</p>
16647
16648 <p>foo
16649 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
16650 bar</p>
16651 !! end
16652
16653 !! test
16654 Validating that <link> isn't wrapped in a paragraph (T186965)
16655 !! options
16656 styletag=1
16657 !! wikitext
16658 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
16659
16660 <link rel="foo" href="bar"/>
16661
16662 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
16663
16664 But if it's on a line with other content, let it be wrapped.
16665
16666 <link rel="foo" href="bar"/> bar
16667
16668 foo <link rel="foo" href="bar"/>
16669
16670 foo <link rel="foo" href="bar"/> bar
16671
16672 And the same if we have non-paragraph-breaking whitespace
16673
16674 foo
16675 <link rel="foo" href="bar"/>
16676 bar
16677 !! html/php
16678 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
16679 </p>
16680 <link rel="foo" href="bar" />
16681 <link rel="foo" href="bar" /> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar" />
16682 <p>But if it's on a line with other content, let it be wrapped.
16683 </p><p><link rel="foo" href="bar" /> bar
16684 </p><p>foo <link rel="foo" href="bar" />
16685 </p><p>foo <link rel="foo" href="bar" /> bar
16686 </p><p>And the same if we have non-paragraph-breaking whitespace
16687 </p><p>foo
16688 <link rel="foo" href="bar" />
16689 bar
16690 </p>
16691 !! end
16692
16693 !! test
16694 Extension returning multiple nodes starting with a style tag roundtrips
16695 !! options
16696 wgRawHtml=1
16697 !! wikitext
16698 <table>
16699 {{1x|<html><style>.hi { color: red; }</style>
16700 </html>}}
16701 <tr><td class="hi">ho</td></tr>
16702 </table>
16703 !! html/parsoid
16704 <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">
16705 </span></p><table about="#mwt5" data-parsoid='{"stx":"html"}'>
16706
16707 <tbody><tr><td class="hi">ho</td></tr>
16708 </tbody></table>
16709 !! end
16710
16711 !! test
16712 Decoding of HTML entities in embedded HTML tags
16713 !! wikitext
16714 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
16715 !! html/php
16716 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tbody><tr><td>x</td></tr></tbody></table>
16717 !! html/parsoid
16718 <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>
16719 !! end
16720
16721 !! test
16722 T51672: Test for brackets in attributes of elements in external link texts
16723 !! wikitext
16724 [http://example.com/ link <span title="title with [brackets]">span</span>]
16725 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
16726
16727 !! html/php
16728 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
16729 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
16730 </p>
16731 !! html/parsoid
16732 <p><a rel="mw:ExtLink" href="http://example.com/" class="external text">link <span title="title with [brackets]">span</span></a>
16733 <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>
16734 !! end
16735
16736 !! test
16737 T72875: Test for brackets in attributes of elements in internal link texts
16738 !! wikitext
16739 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
16740 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
16741
16742 !! html/php
16743 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
16744 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
16745 </p>
16746 !! html/parsoid
16747 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
16748 <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>
16749 !! end
16750
16751 !! test
16752 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
16753 !! options
16754 parsoid={
16755 "modes": ["html2wt"]
16756 }
16757 !! html/parsoid
16758 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
16759 <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>
16760 !! wikitext
16761 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
16762 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
16763 !! end
16764
16765 !! test
16766 T199926: Hash only interwiki link
16767 !! config
16768 wgFragmentMode=[ "html5" ]
16769 !! wikitext
16770 [[meatball:Test#1/2]]
16771 [[gerrit:#/q/project:mediawiki/services/parsoid|Gerrit]]
16772 !! html/php
16773 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Test#1.2F2" class="extiw" title="meatball:Test">meatball:Test#1/2</a>
16774 <a href="https://gerrit.wikimedia.org/#/q/project:mediawiki/services/parsoid" class="extiw" title="gerrit:">Gerrit</a>
16775 </p>
16776 !! html/parsoid
16777 <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>
16778 <a rel="mw:WikiLink/Interwiki" href="https://gerrit.wikimedia.org/#/q/project:mediawiki/services/parsoid" class="extiw">Gerrit</a></p>
16779 !! end
16780
16781 !! test
16782 T179544: {{anchorencode:}} output should be always usable in links
16783 !! config
16784 wgFragmentMode=[ "html5" ]
16785 !! wikitext
16786 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
16787 !! html/php
16788 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
16789 </p>
16790 !! html/parsoid
16791 <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>
16792 !! end
16793 ##########################################################################
16794 # Tests demonstrating white-space insensitivity in input wikitext
16795 # for wikitext headings, wikitext list items, and wikitext table captions,
16796 # headings, and cells. HTML versions of the same should preserve whitespace.
16797 ##########################################################################
16798 !! test
16799 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
16800 !! options
16801 parsoid={
16802 "modes": ["wt2html"],
16803 "preserveIEW": true
16804 }
16805 !! config
16806 wgParserEnableLegacyHeadingDOM=false
16807 !! wikitext
16808 __NOTOC__
16809 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
16810 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
16811 == <!--Headings with fallback ids--> Личная жизнь ==
16812 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
16813 ; <!--term to define--> term : <!--term's definition--> definition
16814 {|
16815 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
16816 |-
16817 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
16818 |-
16819 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
16820 |-
16821 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
16822 |-
16823 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
16824 |}
16825 : {|
16826 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
16827 |} foo <!--c1-->
16828 !! html/php
16829 <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>
16830 <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>
16831 <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>
16832 <ul><li>List item</li></ul>
16833 <dl><dt>term</dt>
16834 <dd>definition</dd></dl>
16835 <table>
16836 <caption>Table Caption
16837 </caption>
16838 <tbody><tr>
16839 <th>Table Heading 1</th>
16840 <th>Table Heading 2
16841 </th></tr>
16842 <tr>
16843 <td>Table Cell 1</td>
16844 <td>Table Cell 2
16845 </td></tr>
16846 <tr>
16847 <td>class="foo"</td>
16848 <td>Table Cell 3
16849 </td></tr>
16850 <tr>
16851 <td>testing <a href="/wiki/One" title="One">two</a> | some content
16852 </td></tr></tbody></table>
16853 <dl><dd><table>
16854 <tbody><tr>
16855 <td>Table Cell 1</td>
16856 <td>Table Cell 2
16857 </td></tr></tbody></table> foo</dd></dl>
16858 !! html/parsoid
16859 <meta property="mw:PageProp/notoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
16860 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
16861 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
16862 <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>
16863 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
16864 <dl><dt><!--term to define-->term</dt><dd data-parsoid='{"stx":"row"}'><!--term's definition-->definition</dd></dl>
16865 <table>
16866 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
16867 <tbody><tr data-parsoid='{"startTagSrc":"|-"}'>
16868 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th data-parsoid='{"stx":"row"}'>Table Heading 2<!--c5--></th></tr>
16869 <tr data-parsoid='{"startTagSrc":"|-"}'>
16870 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td data-parsoid='{"stx":"row"}'>Table Cell 2<!--c5--></td></tr>
16871 <tr data-parsoid='{"startTagSrc":"|-"}'>
16872 <td>class="foo"</td><td data-parsoid='{"stx":"row"}'><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
16873 <tr data-parsoid='{"startTagSrc":"|-"}'>
16874 <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>
16875 </tbody></table>
16876 <dl><dd><table>
16877 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td data-parsoid='{"stx":"row"}'>Table Cell 2 <!--c5-->
16878 </td></tr></tbody></table> foo<!--c1--></dd></dl>
16879 !! end
16880
16881 # Looks like <caption> is not accepted in HTML
16882 !! test
16883 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
16884 !! options
16885 parsoid={
16886 "modes": ["wt2html"],
16887 "preserveIEW": true
16888 }
16889 !! config
16890 wgParserEnableLegacyHeadingDOM=false
16891 !! wikitext
16892 __NOTOC__
16893 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
16894 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
16895 <table>
16896 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
16897 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
16898 </table>
16899 !! html/php
16900 <div class="mw-heading mw-heading2"><h2 id="Heading"> Heading </h2></div>
16901 <ul><li> List item </li></ul>
16902 <table>
16903 <tbody><tr><th> Table Heading </th><th></th></tr>
16904 <tr><td> Table Cell </td><th></th></tr>
16905 </tbody></table>
16906 !! html/parsoid
16907 <meta property="mw:PageProp/notoc"/>
16908 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
16909 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
16910 <table>
16911 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
16912 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
16913 </tbody></table>
16914 !! end
16915
16916 !! test
16917 Do not trim whitespace in links and quotes
16918 !! options
16919 parsoid={
16920 "modes": ["wt2html"],
16921 "preserveIEW": true
16922 }
16923 !! wikitext
16924 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
16925 [[Foo| some text ]]
16926 !! html/php
16927 <p>foo <i> italic </i> and <b> bold </b>
16928 <a href="/wiki/Foo" title="Foo"> some text </a>
16929 </p>
16930 !! html/parsoid
16931 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
16932 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
16933 !! end
16934
16935 !! test
16936 Remove p tags surrounding a single element in a figcaption
16937 !! options
16938 parsoid=html2wt
16939 !! wikitext
16940 [[File:Foobar.jpg|right|200x200px|Caption]]
16941 !! html/parsoid
16942 <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>
16943 !! end
16944
16945 !! test
16946 Selser preserves lack of newline before list and allows newline after the list
16947 !! options
16948 parsoid={
16949 "modes": ["selser"],
16950 "changes": [
16951 [ "ul", "after", "<p>footer</p>" ]
16952 ]
16953 }
16954 !! wikitext
16955 header
16956 *foo
16957 *bar
16958 !! wikitext/edited
16959 header
16960 *foo
16961 *bar
16962 footer
16963 !! end
16964
16965 !! test
16966 Selser does not introduce newlines between unedited paragraph preceding the list
16967 !! options
16968 parsoid={
16969 "modes": ["selser"],
16970 "changes": [
16971 [ "table tbody tr td p:last-child", "empty" ]
16972 ]
16973 }
16974 !! wikitext
16975 {|
16976 |
16977 header
16978 *foo
16979 *bar
16980 footer
16981 |}
16982 !! wikitext/edited
16983 {|
16984 |
16985 header
16986 *foo
16987 *bar
16988
16989 |}
16990 !! end
16991
16992 !! test
16993 Selser does not introduce newlines between unedited paragraph following the list
16994 !! options
16995 parsoid={
16996 "modes": ["selser"],
16997 "changes": [
16998 [ "table tbody tr td p:first-child", "empty" ]
16999 ]
17000 }
17001 !! wikitext
17002 {|
17003 |
17004 header
17005 *foo
17006 *bar
17007 footer
17008 |}
17009 !! wikitext/edited
17010 {|
17011 |
17012 *foo
17013 *bar
17014 footer
17015 |}
17016 !! end
17017
17018 !! test
17019 Remove a list item but do not insert newline above list
17020 !! options
17021 parsoid={
17022 "modes": ["selser"],
17023 "changes": [
17024 [ "ul li:last-child", "remove" ]
17025 ]
17026 }
17027 !! wikitext
17028 header
17029 *foo
17030 *bar
17031 footer
17032 !! wikitext/edited
17033 header
17034 *foo
17035 footer
17036 !! end
17037
17038 !! test
17039 Spaced heading with element
17040 !! options
17041 parsoid={
17042 "modes": ["selser"],
17043 "changes": [
17044 ["#x", "attr", "class", "y"]
17045 ]
17046 }
17047 !! wikitext
17048 === hi <span id="x">hi</span> hi ho ===
17049 !! wikitext/edited
17050 === hi <span id="x" class="y">hi</span> hi ho ===
17051 !! end
17052
17053 !! test
17054 Allow tabindex 0
17055 !! wikitext
17056 <div tabindex="0">A</div>
17057 !! html
17058 <div tabindex="0">A</div>
17059 !! end
17060
17061 !! test
17062 Don't allow tabindex -1
17063 !! options
17064 parsoid=wt2html
17065 !! wikitext
17066 <div tabindex="-1">A</div>
17067 !! html
17068 <div>A</div>
17069 !! end
17070
17071 !! test
17072 Don't Allow tabindex > 0
17073 !! options
17074 parsoid=wt2html
17075 !! wikitext
17076 <div tabindex="3">A</div>
17077 !! html
17078 <div>A</div>
17079 !! end
17080
17081 !! test
17082 aside tag in extension HTML is not p-wrapped (T278565)
17083 !! wikitext
17084 <asidetag></asidetag>This is some article content.
17085 !! html/php
17086 <aside>Some aside content</aside><p>This is some article content.</p>
17087 !! html/parsoid
17088 <aside typeof="mw:Extension/asidetag" data-mw='{"name":"asidetag","attrs":{},"body":{"extsrc":""}}'>Some aside content</aside><p>This is some article content.</p>
17089 !! end
17090
17091 !! test
17092 aside tag is not allowed directly in wikitext (T278565)
17093 !! wikitext
17094 <aside>This aside tag in wikitext should be escaped</aside>
17095 !! html
17096 <p>&lt;aside&gt;This aside tag in wikitext should be escaped&lt;/aside&gt;
17097 </p>
17098 !! end
17099
17100 !! test
17101 Stripped tag in list
17102 !! options
17103 parsoid={
17104 "modes": ["selser"],
17105 "selser": "noauto",
17106 "changes": [
17107 ["dd", "append", "ho"]
17108 ]
17109 }
17110 !! wikitext
17111 :<i>hi</i></b>
17112 !! wikitext/edited
17113 :<i>hi</i></b>ho
17114 !! end
17115
17116 !! test
17117 Misnested link nested in span
17118 !! options
17119 parsoid={
17120 "modes": ["selser"],
17121 "selser": "noauto",
17122 "changes": [
17123 ["dd", "append", " ho"]
17124 ]
17125 }
17126 !! wikitext
17127 : [http://google.com <span>[[Lala]]:</span>ok]-hi
17128 !! wikitext/edited
17129 : [http://google.com <span>[[Lala]]:</span>ok]-hi ho
17130 !! end
17131
17132 ## From T290938, wrapper unmodified was prevented due to the auto-inserted end
17133 !! test
17134 Preserve the order invalid attributes
17135 !! options
17136 parsoid={
17137 "modes": ["selser"],
17138 "selser": "noauto",
17139 "changes": [
17140 ["div", "append", "ho"]
17141 ]
17142 }
17143 !! wikitext
17144 <div width="95%" style="border: 3px solid darkblue">hi
17145 !! wikitext/edited
17146 <div width="95%" style="border: 3px solid darkblue">hiho
17147 !! end