Sync up core repo with Parsoid

This now aligns with Parsoid commit 51baccc8741108a9e3f763f2c19c6ce6eda55ac4

Three tests needed to be disabled because they had dependencies on features
not included in core's CI:

* {{#if}} used in tests added by I71c38b42ac9bfb7137f2e34df70bdfa139abced7
  but only provided by the ParserFunctions extension
* <poem> used in tests added by I5a6356a82251881a5f841b36a7f26879fc611138
  but only provided by the Poem extension

In addition, the "multiline" part of the "Expansion of multi-line..."
parser tests seems to have been lost at some point.  My best guess is
that the definition of `Template:1x` initially included an extra
newline which was lost, maybe during an unrelated stripping of
leading/trailing whitespace in `!! article` clauses.  In any case,
these tests are no longer testing the thing they say they are.

These will be fixed in a follow up.

Change-Id: Ia9144634625f176fbea11f3d2ef4b21a5492e99b
This commit is contained in:
C. Scott Ananian 2024-02-21 13:25:30 -05:00
parent 260fc1b50f
commit 3cebc721bb
5 changed files with 384 additions and 279 deletions

View file

@ -100,7 +100,7 @@ wgFragmentMode=[ "html5", "legacy" ]
<a href="//en.wikipedia.org/wiki/Foo#Is_this_great?" class="extiw" title="en:Foo">en:Foo#Is this great?</a>
</p>
!! html/parsoid
<p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great?" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great?"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
<p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great?" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great?"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
<a rel="mw:WikiLink" href="./Foo#Is_this_great?" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great?"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
<a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" title="meatball:Foo" class="extiw" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a>
<a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo#Is_this_great?" title="en:Foo" class="extiw">en:Foo#Is this great?</a></p>
@ -206,7 +206,6 @@ parsoid=wt2html,wt2wt,html2html
<p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
!! end
# Parsoid does not mark self-links, by design.
!! test
Local interwiki link: self-link to current page
!! options
@ -218,7 +217,7 @@ parsoid=wt2html,wt2wt,html2html
<p><a class="mw-selflink selflink">local:Main Page</a>
</p>
!! html/parsoid
<p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
<p><a rel="mw:WikiLink" href="./Main_Page" class="mw-selflink selflink">local:Main Page</a></p>
!! end
!! test
@ -307,3 +306,37 @@ Interwiki link with colon escape after prefix
!! html/parsoid
<p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Category:Hello" title="meatball:Category:Hello" class="extiw" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Category:Hello"},"sa":{"href":"meatball::Category:Hello"},"isIW":true}'>meatball:Category:Hello</a></p>
!! end
!! test
Self-links and interwiki
!! options
title=[[Main Page]]
!! wikitext
[[local:Main Page]]
[[meatball:Main Page]]
[[mi:Main Page]]
[[local:Main Page#anchor]]
[[meatball:Main Page#anchor]]
!! html/php
<p><a class="mw-selflink selflink">local:Main Page</a>
</p><p><a href="http://www.usemod.com/cgi-bin/mb.pl?Main_Page" class="extiw" title="meatball:Main Page">meatball:Main Page</a>
</p><p><a class="mw-selflink selflink">mi:Main Page</a>
</p><p><a class="mw-selflink-fragment" href="#anchor">local:Main Page#anchor</a>
</p><p><a href="http://www.usemod.com/cgi-bin/mb.pl?Main_Page#anchor" class="extiw" title="meatball:Main Page">meatball:Main Page#anchor</a>
</p>
!! html/parsoid
<p><a rel="mw:WikiLink" href="./Main_Page" class="mw-selflink selflink" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"local:Main Page"}}'>local:Main Page</a></p>
<p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Main%20Page" title="meatball:Main Page" class="extiw" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Main%20Page"},"sa":{"href":"meatball:Main Page"},"isIW":true}'>meatball:Main Page</a></p>
<p><a rel="mw:WikiLink" href="./Main_Page" class="mw-selflink selflink" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"mi:Main Page"}}'>mi:Main Page</a></p>
<p><a rel="mw:WikiLink" href="./Main_Page#anchor" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#anchor"},"sa":{"href":"local:Main Page#anchor"}}'>local:Main Page#anchor</a></p>
<p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Main%20Page#anchor" title="meatball:Main Page" class="extiw" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Main%20Page#anchor"},"sa":{"href":"meatball:Main Page#anchor"},"isIW":true}'>meatball:Main Page#anchor</a></p>
!! end

View file

@ -193,13 +193,6 @@ Template:blank_param
{{{}}}
!! endarticle
!! article
Template:PartialTable
!! text
{|
|-
!! endarticle
## See T48811 for details
!! article
Template:mixed_attr_content_template
@ -288,6 +281,13 @@ File:Redirect to foobar.jpg
#REDIRECT[[File:Foobar.jpg]]
!! endarticle
# Use an entity in the name
!! article
Template:Foobar
!! text
foo
!! endarticle
###
### Basic tests
###
@ -1847,13 +1847,12 @@ Break on | in element attribute name in template
!! test
Don't break on | in extension attribute in template
!! wikitext
{{1x|<ref name="hi|ho">ha</ref>}}
<references />
{{1x|<tag name="hi|ho">ha</tag>}}
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-hi|ho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Parser_test#cite_note-hi|ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references" ><li about="#cite_note-hi|ho-1" id="cite_note-hi|ho-1"><a href="./Parser_test#cite_ref-hi|ho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi|ho-1" class="mw-reference-text">ha</span></li></ol></div>
<pre typeof="mw:Extension/tag mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;tag name=\"hi|ho\">ha&lt;/tag>"}},"i":0}}]}'>'ha'
array (
'name' => 'hi|ho',
)</pre>
!! end
###
@ -2258,7 +2257,7 @@ wgFragmentMode=[ "html5", "legacy" ]
<p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
</p>
!! html/parsoid
<p><a rel="mw:WikiLink" href="./Main_Page#&lt;" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#&lt;"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#>" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#>"},"sa":{"href":"%23%3e"}}'>#></a></p>
<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>
!! end
## Example for such a section: == < ==
@ -2576,7 +2575,6 @@ T2002: [[page|http://url/]] should link to page, not http://url/
<p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
!! end
# Parsoid does not mark self-links, by design.
!! test
T2337: Escaped self-links should be bold
!! options
@ -2587,7 +2585,7 @@ title=[[Bug462]]
<p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
</p>
!! html/parsoid
<p><a rel="mw:WikiLink" href="./Bug462" title="Bug462" data-parsoid='{"stx":"simple","a":{"href":"./Bug462"},"sa":{"href":"Bu&amp;#103;462"}}'>Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462" data-parsoid='{"stx":"simple","a":{"href":"./Bug462"},"sa":{"href":"Bug462"}}'>Bug462</a></p>
<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>
!! end
!! test
@ -2600,7 +2598,7 @@ title=[[Main Page]]
<p><a class="mw-selflink-fragment" href="#section">Main Page#section</a>
</p>
!! html/parsoid
<p><a rel="mw:WikiLink" href="./Main_Page#section" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#section"},"sa":{"href":"Main Page#section"}}'>Main Page#section</a></p>
<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>
!! end
@ -2614,7 +2612,7 @@ title=[[Main Page]]
<p><a class="mw-selflink-fragment" href="#section_with_spaces">Main Page#section with spaces</a>
</p>
!! html/parsoid
<p><a rel="mw:WikiLink" href="./Main_Page#section_with_spaces" title="Main Page" 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>
<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>
!! end
!! article
@ -2633,7 +2631,7 @@ title=[[0]]
<p><a class="mw-selflink selflink">0</a>
</p>
!! html/parsoid
<p><a rel="mw:WikiLink" href="./0" title="0" data-parsoid='{"stx":"simple","a":{"href":"./0"},"sa":{"href":"0"}}'>0</a></p>
<p><a rel="mw:WikiLink" href="./0" class="mw-selflink selflink" data-parsoid='{"stx":"simple","a":{"href":"./0"},"sa":{"href":"0"}}'>0</a></p>
!!end
!!test
@ -2845,7 +2843,7 @@ subpage
<p><a href="#a">b</a>
</p>
!! html/parsoid
<p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
<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>
!! end
!! test
@ -3543,16 +3541,21 @@ Nested lists 8 (multiple nesting transitions)
<li>boo</li></ul>
!! end
# XXX this test should be moved to citeParserTests, since it depends
# on the Cite extension, which is "built in" to Parsoid.
!! test
Nested lists 9 (extension interaction)
!! wikitext
*<references />
!! html/php-DISABLED
<ul><li class="mw-empty-elt"></li></ul>
*<tag />
!! html/php
<ul><li><pre></pre></li></ul>
<p>NULL
array (
)
</p>
!! html/parsoid
<ul><li data-parsoid='{}'><div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"></ol></div></li></ul>
<ul><li data-parsoid='{}'><pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{"dsr":[1,8,7,0]}' data-mw='{"name":"tag","attrs":{}}'>NULL
array (
)
</pre></li></ul>
!! end
!! test
@ -3893,6 +3896,9 @@ Parsoid: Test of whitespace serialization with Templated bullets
parsoid=wt2html
!! wikitext
* {{bullet}}
!! html/php
<ul><li class="mw-empty-elt"></li>
<li>Bar</li></ul>
!! html/parsoid
<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}}]}'>
</span><li about="#mwt1">Bar</li></ul>
@ -4257,6 +4263,21 @@ __proto__
### Templates
####
!! test
Template titles with entities in them
!! wikitext
*{{Foobar}}
*{{Foo&ndash;bar}}
!! html/php
<ul><li>foo</li>
<li>foo</li></ul>
!! html/parsoid
<ul>
<li data-parsoid="{}"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Foobar","href":"./Template:Foobar"},"params":{},"i":0}}]}'>foo</span></li>
<li data-parsoid="{}"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Foo&amp;ndash;bar","href":"./Template:Foobar"},"params":{},"i":0}}]}'>foo</span></li>
</ul>
!! end
!! test
Nonexistent template
!! wikitext
@ -4612,7 +4633,7 @@ Dummy article to suppress redlinks in tests
# See: T2553
!! test
Abort table cell attribute parsing on wikilink
Bail on table cell attribute parsing on wikilink
!! wikitext
{|
|testing [[one|two]] |three||four
@ -4647,24 +4668,17 @@ Dummy article to suppress redlinks in tests
## We don't care about Parsoid's output here as much as whether
## attribute parsing breaks because of a wikilink.
## Parsoid's standalone mode doesn't have a compliant ParserFunction extension
## Parsoid's standalone mode doesn't have a compliant {{#tag}} implementation
!! test
Don't abort table cell attribute parsing if wikilink is found in template arg
Don't bail on table cell attribute parsing if wikilink is found in template arg
!! wikitext
{|
|Test {{#tag:ref|One two "[[three]]" four}}
|Test {{#tag:spantag|One two "[[three]]" four}}
|}
!! html/parsoid+standalone
<table>
<tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
</tbody></table>
!! html/parsoid+integrated
<table>
<tbody><tr><td>Test <sup class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></td></tr>
<tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>Test <span typeof="mw:Extension/spantag mw:Transclusion" data-mw='{"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>
</tbody></table>
<div about="#mwt2" class="mw-references-wrap" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references">
<li id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</span></li>
</ol></div>
!! end
!! test
@ -5090,7 +5104,7 @@ T236868: Un-closed <noinclude> caused bad SourceRange length
|-</noinclude>
|}
!! html/parsoid
<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|- &amp;lt;noinclude>\n| A\n|-&lt;meta typeof=\"mw:Includes/NoInclude/End\" data-parsoid=&apos;{\"src\":\"&amp;lt;/noinclude>\",\"dsr\":[36,48,null,null]}&apos;/>"},{"html":""}]]}'>
<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":""}]]}'>
</table>
!! end
@ -5347,6 +5361,32 @@ Parsoid: Merge double tds in nested transclusion content (T52603)
</div>
!! end
!! article
Template:Temp?
!! text
temp {{{1}}}
!! endarticle
!! test
Template name with question mark
!! options
parsoid={
"modes": [ "selser", "wt2html", "html2wt" ],
"changes": [
["span", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"temp?\",\"href\":\"./Template:Temp%3F\"},\"params\":{\"1\":{\"wt\":\"456\"}},\"i\":0}}]}"]
]
}
!! wikitext
{{temp?|123}}
!! wikitext/edited
{{temp?|456}}
!! html/php
<p>temp 123
</p>
!! html/parsoid
<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>
!! end
###
### <includeonly> and <noinclude> in attributes
###
@ -6262,27 +6302,6 @@ Templates: Wiki Tables: 6. Templated tags, templated td-tags
</td></tr></tbody></table>
!! end
## This test case is very specific to Parsoid's internals
## and is hence only tested for Parsoid's code. Parsoid uses
## a <meta> marker tag for <ref> tags and they are expanded
## much later. We are verifying that this <meta> tag usage
## doesn't prevent foster parenting.
!! test
Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
!! wikitext
{{PartialTable}}<ref>foo</ref>
|}
<references />
!! html/parsoid
<p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'>
<sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p><table about="#mwt2">
<tbody>
</tbody></table>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol></div>
!! end
!!article
Template:UnclosedTableEndsWithTR
!!text
@ -6485,22 +6504,54 @@ Parser Functions: 2. Nested use (only outermost should be marked up)
</p>
!!end
## Note that the templates inside the references are not wrapped
## Note that the templates inside the extension tag are not wrapped
## and that the extsrc attributes in integrated mode are missing
## the nested template (FIXME!)
!! test
Template nested in extension tag in template
!! options
title=[[Main Page]]
language=zh
!! wikitext
{{1x|hi<ref>[[ho|{{1x|hi}}]]</ref>}}
{{1x|hi<ref>[http://test.com?q={{1x|ho}}]</ref>}}
{{1x|hi<ref>-{ho|{{1x|hi}}}-</ref>}}
<references />
{{1x|hi<span>[[ho|{{1x|hi}}]]</span>}}
{{1x|hi<spantag>[[ho|{{1x|hi}}]]</spantag>}}
{{1x|hi<spantag>[http://test.com?q={{1x|ho}}]</spantag>}}
{{1x|hi<spantag>-{ho|{{1x|hi}}}-</spantag>}}
!! html/php
<p>hi<span><a href="/wiki/Ho" title="Ho">hi</a></span>
hi<span><a href="/wiki/Ho" title="Ho">hi</a></span>
hi<span><a rel="nofollow" class="external autonumber" href="http://test.com?q=ho">[1]</a></span>
hi<span>hi</span>
</p>
!! html/parsoid
<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":"hi&lt;ref>[[ho|{{1x|hi}}]]&lt;/ref>"}},"i":0}}]}'>hi</span><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>[[ho|{{1x|hi}}]]&lt;/ref>"}' data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<span about="#mwt6" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi&lt;ref>[http://test.com?q={{1x|ho}}]&lt;/ref>"}},"i":0}}]}'>hi</span><sup about="#mwt6" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>[http://test.com?q={{1x|ho}}]&lt;/ref>"}' data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Main_Page#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
<span about="#mwt10" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi&lt;ref>-{ho|{{1x|hi}}}-&lt;/ref>"}},"i":0}}]}'>hi</span><sup about="#mwt10" class="mw-ref reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>-{ho|{{1x|hi}}}-&lt;/ref>"}' data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Main_Page#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt15" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"stx":"piped","a":{"href":"./Ho"},"sa":{"href":"ho"}}'>hi</a></span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"><a rel="mw:ExtLink nofollow" href="http://test.com?q=ho" class="external autonumber"></a></span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Main_Page#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text"><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["ho"],"t":"hi"}}' data-parsoid='{"fl":["ho"]}'></span></span></li></ol></div>
<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>
<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>
<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>
<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>
!! end
!! test
ParserTest <spantag> tag, using data-mw.body serialization shortcut
!! wikitext
Hello <spantag>'''world'''!</spantag>
!! html/php
<p>Hello <span><b>world</b>!</span>
</p>
!! html/parsoid
<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>
!! end
!! test
ParserTest <spantag> tag, without data-mw.body serialization shortcut
!! options
parsoid=html2wt
!! wikitext
Hello <spantag>'''world'''!</spantag>
!! html/php
<p>Hello <span><b>world</b>!</span>
</p>
!! html/parsoid
<p>Hello <span typeof="mw:Extension/spantag" data-mw='{"name":"spantag","attrs":{}}'><b>world</b>!</span></p>
!! end
!! test
@ -8483,11 +8534,29 @@ wgFragmentMode=[ "legacy" ]
Expansion of multi-line templates in attribute values (T8255)
!! wikitext
<div style="background: {{1x|#00FF00}}">-</div>
!! html
!! html/php
<div style="background: #00FF00">-</div>
!! html/parsoid
!! html/parsoid+integrated
<div style="background:
#00FF00" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"background: \n#00FF00"},"sa":{"style":"background: {{identity|#00FF00}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"background: &lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,44,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"identity\",\"href\":\"./Template:Identity\"},\"params\":{\"1\":{\"wt\":\"#00FF00\"}},\"i\":0}}]}&apos;>\n#00FF00&lt;/span>"}]]}'>-</div>
#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>
!! end
### FIXME ptsync 2024-02-21: "multi-line" part of these tests appears to
### have been lost at some point.
### FIXME ptsync 2024-02-21: {{#if}} is not defined for core tests, so
### this test should use a different parser function (maybe {{lc}}); marked
### html/php+disabled for now.
!! test
Expansion of multi-line parser-functions in attribute values (T8255)
!! wikitext
<div style="background: {{#if:1|#00FF00|#FF00FF}}">-</div>
!! html/php+disabled
<div style="background: #00FF00">-</div>
!! html/parsoid+integrated
<div style="background:
#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>
!! end
!! test
@ -8935,7 +9004,7 @@ wgFragmentMode=[ "html5", "legacy" ]
<p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
</p>
!! html/parsoid
<p><span id="æ:_v" data-parsoid='{"stx":"html","a":{"id":"æ:_v"},"sa":{"id":"æ: v"}}'>byte</span><a rel="mw:WikiLink" href="./Main_Page#æ:_v" data-parsoid='{"stx":"piped","a":{"href":"./Main_Page#æ:_v"},"sa":{"href":"#æ: v"}}'>backlink</a></p>
<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>
!! end
!! test
@ -9674,8 +9743,10 @@ Special page transclusion
!! html/php
<ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
</ul>
!! html/parsoid
<p><a rel="mw:WikiLink" href="./Special:PrefixIndex/Xyzzyx?action=edit&amp;redlink=1" title="Special:PrefixIndex/Xyzzyx" about="#mwt1" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./Special:PrefixIndex/Xyzzyx"},"sa":{"href":"Special:PrefixIndex/Xyzzyx"},"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"Special:Prefixindex/Xyzzyx","href":"./Special:PrefixIndex/Xyzzyx"},"params":{},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Special:PrefixIndex/Xyzzyx"]}}'>Special:PrefixIndex/Xyzzyx</a></p>
!! html/parsoid+integrated
<ul class="mw-prefixindex-list" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Special:Prefixindex/Xyzzyx","href":"./Special:PrefixIndex/Xyzzyx"},"params":{},"i":0}}]}'>
<li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
</ul>
!! end
!! test
@ -9688,9 +9759,13 @@ Special page transclusion twice (T7021)
</ul>
<ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
</ul>
!! html/parsoid
<p><a rel="mw:WikiLink" href="./Special:PrefixIndex/Xyzzyx?action=edit&amp;redlink=1" title="Special:PrefixIndex/Xyzzyx" about="#mwt1" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./Special:PrefixIndex/Xyzzyx"},"sa":{"href":"Special:PrefixIndex/Xyzzyx"},"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"Special:Prefixindex/Xyzzyx","href":"./Special:PrefixIndex/Xyzzyx"},"params":{},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Special:PrefixIndex/Xyzzyx"]}}'>Special:PrefixIndex/Xyzzyx</a>
<a rel="mw:WikiLink" href="./Special:PrefixIndex/Xyzzyx?action=edit&amp;redlink=1" title="Special:PrefixIndex/Xyzzyx" about="#mwt2" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./Special:PrefixIndex/Xyzzyx"},"sa":{"href":"Special:PrefixIndex/Xyzzyx"},"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"Special:Prefixindex/Xyzzyx","href":"./Special:PrefixIndex/Xyzzyx"},"params":{},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Special:PrefixIndex/Xyzzyx"]}}'>Special:PrefixIndex/Xyzzyx</a></p>
!! html/parsoid+integrated
<ul class="mw-prefixindex-list" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Special:Prefixindex/Xyzzyx","href":"./Special:PrefixIndex/Xyzzyx"},"params":{},"i":0}}]}'>
<li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
</ul>
<ul class="mw-prefixindex-list" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Special:Prefixindex/Xyzzyx","href":"./Special:PrefixIndex/Xyzzyx"},"params":{},"i":0}}]}'>
<li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
</ul>
!! end
!! test
@ -10625,9 +10700,7 @@ Special:Search page linking.
<p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
</p>
!! html/parsoid+integrated
<p><a rel="mw:WikiLink" href="./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>
!! html/parsoid+standalone
<p><a rel="mw:WikiLink" href="./Special:Search?action=edit&amp;redlink=1" title="Special:Search" about="#mwt1" typeof="mw:Transclusion mw:LocalizedAttrs" class="new" data-parsoid='{"stx":"simple","a":{"href":"./Special:Search"},"sa":{"href":"Special:Search"},"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"Special:search","href":"./Special:Search"},"params":{},"i":0}}]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Special:Search"]}}'>Special:Search</a></p>
<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>
!! end
!! test
@ -11563,10 +11636,6 @@ y
<p>y</p>
!! end
## FIXME: Parsoid & legacy parser results differ here.
## This will be fixed in integrated mode testing and standalone
## mode testing will be disabled on this test since parser functions
## aren't properly implemented in Parsoid for standalone testing.
!! test
T2529: Uncovered bullet in parser function result
!! wikitext
@ -11574,8 +11643,6 @@ T2529: Uncovered bullet in parser function result
!! html/php
<ul><li>Foo</li>
<li>bar</li></ul>
!! html/parsoid
<ul><li>Foo<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"lc:{{bullet}} ","function":"lc"},"params":{},"i":0}}]}'>bar </span></li></ul>
!! html/parsoid+integrated
<ul><li>Foo</li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"lc:{{bullet}} ","function":"lc"},"params":{},"i":0}}]}'>
</span><li about="#mwt1">bar</li></ul>
@ -12153,7 +12220,7 @@ title=[[Foo]]
<p><a href="#_ref">One</a>
</p>
!! html/parsoid
<p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
<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>
!! end
!! test
@ -13899,7 +13966,7 @@ T73074: More fostering fun
!! wikitext
<table><td></td>{{1x|<tr>}}<!--c-->[[Category:Two]]
!! html/parsoid
<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" 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>
<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>
!! end
## Regression test for Parsoid's template wrapping of fostered content
@ -13917,6 +13984,40 @@ parsoid=wt2html
</table>
!! end
!! article
Template:Tr
!! text
|-
!! end
!! test
1. Template wrapping shouldn't ignore fostered content
!! options
parsoid=wt2wt
!! wikitext
{|
{{tr}}
{{1x|
}}
hiho
!! html/parsoid
!! end
!! test
2. Template wrapping shouldn't ignore fostered content
!! options
parsoid=wt2wt
!! wikitext
{|
{{tr}}
{{1x|
}}
hiho
!! html/parsoid
!! end
!!test
Support <object> element with .data attribute
!!options
@ -14263,23 +14364,6 @@ parsoid={
== {{1x|foo [[Category:Foo]]}} ==
!! end
!! test
Headings: Category in ref isn't hoisted
!! options
parsoid={
"modes": ["html2wt"]
}
!! html/parsoid
<h2> foo <span about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
<ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">bar <link rel="mw:PageProp/Category" href="./Category:Baz" /> </span></li></ol>
!! wikitext
== foo <ref>bar
[[Category:Baz]] </ref> ==
<references />
!! end
!! test
Parsoid: Serialize positional parameters with = in them as named parameter
!! options
@ -14360,10 +14444,8 @@ parsoid=html2wt
<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">
</span><span about="#mwt1">you</span> </h2>
<h2> foo <span about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
<ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
there</span></li></ol>
<h2> foo <span about="#mwt2" typeof="mw:Extension/spantag" data-mw='{"name":"spantag","body":{"extsrc":"hello\nthere"},"attrs":{}}'>hello
there</span> </h2>
<ul><li>asd
sdf</li></ul>
@ -14389,10 +14471,8 @@ ha</td></tr>
== hi {{bogus|there
you}} ==
== foo <ref>hello
there</ref> ==
<references />
== foo <spantag>hello
there</spantag> ==
* asd sdf
@ -14466,7 +14546,7 @@ parsoid=html2wt
<p>foo<span typeof="mw:DisplaySpace"> </span>: bar</p>
<span typeof="mw:Extension/ref" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo<span typeof=\&quot;mw:DisplaySpace\&quot;>&amp;nbsp;</span>: bar&quot;}}"><sup>[1]</sup></span>ok</p>
<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>
<a href="http://example.com">«<span typeof="mw:DisplaySpace">&nsbp;</span>Tour Eiffel<span typeof="mw:DisplaySpace">&nsbp;</span>»</a>
@ -14480,7 +14560,7 @@ foo : bar
foo : bar
<ref>foo : bar</ref>ok
<spantag>foo : bar</spantag>ok
[http://example.com « Tour Eiffel »]
@ -15206,25 +15286,6 @@ parsoid=html2wt
<div id="hello">ok</div>
!! end
!! test
Testing serialization after deletion in references
!! options
parsoid={
"modes": ["wt2wt"],
"changes": [
["#x", "remove"]
]
}
!! wikitext
hi <ref><div id="x">ho</div></ref>
<references />
!! wikitext/edited
hi <ref></ref>
<references />
!! end
!!test
Testing serialization after deletion of table cells
!!options
@ -15427,14 +15488,6 @@ parsoid=wt2html
<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>
!! end
!! test
Catch regression when unpacking with trailing content
!! wikitext
{{1x|Foo <references/> bar}}
!! html/parsoid
<p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"Foo &lt;references/> bar"}},"i":0}}]}'>Foo </p><div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references" ></ol></div><p about="#mwt2"> bar</p>
!! end
!! test
Use data-parsoid.firstWikitextNode to compute newline constraints for template content
!! options
@ -16337,59 +16390,6 @@ parsoid={
<span id="a">a</span>
!! end
!! test
1. DOMDiff: Changes to <ref> content should be looked up using id
!! options
parsoid={
"modes": ["selser"],
"changes": [
["#X", "after", "bar"],
["#Y", "after", "baz"]
]
}
!! wikitext
X <ref><span id="X">foo</span></ref>
Y <ref name="a" />
<references>
<ref name="a"><span id="Y">foo</span></ref>
</references>
!! wikitext/edited
X <ref><span id="X">foo</span>bar</ref>
Y <ref name="a" />
<references>
<ref name="a"><span id="Y">foo</span>baz</ref>
</references>
!! end
!! test
2. DOMDiff: Changes to <ref> content should be looked up using id
!! options
parsoid={
"modes": ["selser"],
"changes": [
["#Z", "after", "bar"]
]
}
!! wikitext
A <ref>foo bar for a</ref>
B <ref group="X" name="b" />
<references />
<references group="X">
<ref name="b"><span id="Z">foo</span></ref>
</references>
!! wikitext/edited
A <ref>foo bar for a</ref>
B <ref group="X" name="b" />
<references />
<references group="X">
<ref name="b"><span id="Z">foo</span>bar</ref>
</references>
!! end
!! test
DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
!! options
@ -16586,8 +16586,8 @@ wgFragmentMode=[ "html5", "legacy" ]
<p><a href="#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
</p>
!! html/parsoid
<h2 id="A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E"><span id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE" typeof="mw:FallbackId" data-parsoid="{}"></span>A&amp;B<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>C<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp;D<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp;amp;E</h2>
<p><a rel="mw:WikiLink" href="./Parser_test#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E"},"sa":{"href":"#A&amp;B&amp;amp;C&amp;amp;amp;D&amp;amp;amp;amp;E"}}'>#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a></p>
<h2 id="A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E"><span id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE" typeof="mw:FallbackId"></span>A&amp;B<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>C<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp;D<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp;amp;E</h2>
<p><a rel="mw:WikiLink" href="./Parser_test#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E"},"sa":{"href":"#A&amp;B&amp;amp;C&amp;amp;amp;D&amp;amp;amp;amp;E"}}'>#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a></p>
!! end
!! test
@ -16671,12 +16671,12 @@ wgFragmentMode=[ "html5", "legacy" ]
<h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
<h2 id="Hey_&lt;_#_&quot;_>_%_:_'"><span id="Hey_.3C_.23_.22_.3E_.25_:_.27" typeof="mw:FallbackId"></span>Hey &lt; # " ><span typeof="mw:DisplaySpace"> </span>%<span typeof="mw:DisplaySpace"> </span>: '</h2>
<p><a rel="mw:WikiLink" href="./Parser_test#Foo_bar">#Foo bar</a> <a rel="mw:WikiLink" href="./Parser_test#foo_Bar">#foo Bar</a> <a rel="mw:WikiLink" href="./Parser_test#Тест">#Тест</a> <a rel="mw:WikiLink" href="./Parser_test#тест">#тест</a> <a rel="mw:WikiLink" href="./Parser_test#Hey_&lt;_#_&quot;_>_%_:_'" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Hey_&lt;_#_\"_>_%_:_&apos;"},"sa":{"href":"#Hey &lt; # \" > % : &apos;"}}'>#Hey &lt; # " ><span typeof="mw:DisplaySpace"> </span>%<span typeof="mw:DisplaySpace"> </span>: '</a></p>
<p><a rel="mw:WikiLink" href="./Parser_test#Foo_bar" class="mw-selflink-fragment">#Foo bar</a> <a rel="mw:WikiLink" href="./Parser_test#foo_Bar" class="mw-selflink-fragment">#foo Bar</a> <a rel="mw:WikiLink" href="./Parser_test#Тест" class="mw-selflink-fragment">#Тест</a> <a rel="mw:WikiLink" href="./Parser_test#тест" class="mw-selflink-fragment">#тест</a> <a rel="mw:WikiLink" href="./Parser_test#Hey_&lt;_#_&quot;_>_%_:_'" class="mw-selflink-fragment">#Hey &lt; # " ><span typeof="mw:DisplaySpace"> </span>%<span typeof="mw:DisplaySpace"> </span>: '</a></p>
<p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:💩","function":"anchorencode"},"params":{},"i":0}}]}'>💩</span> <span id="💩" about="#mwt3" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"id"},{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[178,197,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:💩\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&#39;>💩&lt;/span>"}]]}'></span></p>
<!-- These two links should produce identical HTML -->
<p><a rel="mw:WikiLink" href="./Parser_test#啤酒">#啤酒</a> <a rel="mw:WikiLink" href="./Parser_test#啤酒" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#啤酒"},"sa":{"href":"#%E5%95%A4%E9%85%92"}}'>#啤酒</a></p>
<p><a rel="mw:WikiLink" href="./Parser_test#啤酒" class="mw-selflink-fragment">#啤酒</a> <a rel="mw:WikiLink" href="./Parser_test#啤酒" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#啤酒"},"sa":{"href":"#%E5%95%A4%E9%85%92"}}'>#啤酒</a></p>
!! end
# Parsoid doesn't support this mode
@ -16788,8 +16788,8 @@ wgFragmentMode=[ "html5", "legacy" ]
<p><a href="#Foo_bar">#Foo&#160;bar</a>
</p>
!! html/parsoid
<h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
<p><a rel="mw:WikiLink" href="./Parser_test#Foo_bar" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Foo_bar"},"sa":{"href":"#Foo&amp;nbsp;bar"}}'>#Foo bar</a></p>
<h2 id="Foo_bar">Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar</h2>
<p><a rel="mw:WikiLink" href="./Parser_test#Foo_bar" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Foo_bar"},"sa":{"href":"#Foo&amp;nbsp;bar"}}'>#Foo bar</a></p>
!! end
!! test
@ -16862,7 +16862,7 @@ wgFragmentMode=[ "html5" ]
<p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
</p>
!! html/parsoid
<p><span id="[foo]" about="#mwt3" 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]" 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=\"#mwt2\" 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=\"#mwt2\" data-parsoid=\"{}\">foo&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt2\" data-parsoid=&apos;{\"src\":\"&amp;amp;#x5D;\",\"srcContent\":\"]\"}&apos;>]&lt;/span>"}]]}'>#[foo]</a></p>
<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>
!! end
##########################################################################
# Tests demonstrating white-space insensitivity in input wikitext

View file

@ -59,13 +59,6 @@ Template:table_attribs_5
|</noinclude>style="color:red;"||Bar
!! endarticle
!! article
Template:table_attribs_7
!! text
<noinclude>
|</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
!! endarticle
!! article
Template:table_header_cells
!! text
@ -983,21 +976,6 @@ parsoid={
</tbody></table>
!! end
## Edge case fix to prevent future regressions
!! test
T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
!! wikitext
{|
|{{table_attribs_7}}
|}
<references />
!! html/parsoid
<table>
<tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<sup class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
</tbody></table>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references" ><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol></div>
!! end
!! test
Table with row followed by newlines and table heading
!! options

View file

@ -299,37 +299,6 @@ Sections:
h2 index:T-2 toclevel:1 number:2 title:Template:1x off:NULL anchor/linkAnchor:b line:b
!! end
# FIXME:
# 1. This potentially exposes a subtle issue in the interaction between TOC, Cite, and
# localization. Parsoid doesn't localize numbers in Cite (at all!) since it relies on CSS.
# But, with the legacy parser, a wiki with localized numbers will have an anchor
# based off a localized number if a <ref> is used in a heading. Parsoid won't!.
# 2. We probably should be a bit smarter about what to strip for tags when that output
# comes from extensions. Below, we have stripped all extension typeofs and info.
# But, depends on who uses this 'line' property and how.
# FIXME: test disabled because CI doesn't have the Cite extension installed
!! test
Handle extension content in section headers properly
!! config
wgFragmentMode=[ "html5", "legacy" ]
!! options
nohtml
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! wikitext
==c<ref>d</ref>==
!! metadata/php+disabled
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:c[1] line:c<sup>&#91;1&#93;</sup>
!! metadata/parsoid
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:c[1] line:c<sup><span>[1]</span></sup>
!! end
!! test
Handle extension content in section headers properly (non-Cite version)
!! config
@ -1047,6 +1016,36 @@ flags=
</section>
!! end
!! test
T352467: synthetic sections shouldn't count towards "enough" sections
!! options
showflags
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! wikitext
<div>
==a==
==b==
</div>
==c==
!! metadata
flags=
!! html/php
<div>
<h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<h2><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
</div>
<h2><span class="mw-headline" id="c">c</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: c">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
!! html/parsoid
<section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div>
<section data-mw-section-id="1"><h2 id="a">a</h2>
</section><section data-mw-section-id="-1"><h2 id="b">b</h2>
</section></div>
</section><section data-mw-section-id="3"><h2 id="c">c</h2></section>
!! end
!! test
T307691: show-toc flag: not "enough" sections, but __FORCETOC__
!! options
@ -1798,12 +1797,12 @@ section 6
<h2 id="Underscore-Entity_between_Text">Underscore-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#95;","srcContent":"_"}'>_</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#95;","srcContent":"_"}'>_</span>Text</h2>
<p>section 6</p>
<p><a rel="mw:WikiLink" href="./Parser_test#Space_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Space_between_Text"},"sa":{"href":"#Space between Text"}}'>#Space between Text</a>
<a rel="mw:WikiLink" href="./Parser_test#Space-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Space-Entity_between_Text"},"sa":{"href":"#Space-Entity&amp;#32;between&amp;#32;Text"}}'>#Space-Entity between Text</a>
<a rel="mw:WikiLink" href="./Parser_test#Plus+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Plus+between+Text"},"sa":{"href":"#Plus+between+Text"}}'>#Plus+between+Text</a>
<a rel="mw:WikiLink" href="./Parser_test#Plus-Entity+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Plus-Entity+between+Text"},"sa":{"href":"#Plus-Entity&amp;#43;between&amp;#43;Text"}}'>#Plus-Entity+between+Text</a>
<a rel="mw:WikiLink" href="./Parser_test#Underscore_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Underscore_between_Text"},"sa":{"href":"#Underscore_between_Text"}}'>#Underscore_between_Text</a>
<a rel="mw:WikiLink" href="./Parser_test#Underscore-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Underscore-Entity_between_Text"},"sa":{"href":"#Underscore-Entity&amp;#95;between&amp;#95;Text"}}'>#Underscore-Entity_between_Text</a></p>
<p><a rel="mw:WikiLink" href="./Parser_test#Space_between_Text" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Space_between_Text"},"sa":{"href":"#Space between Text"}}'>#Space between Text</a>
<a rel="mw:WikiLink" href="./Parser_test#Space-Entity_between_Text" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Space-Entity_between_Text"},"sa":{"href":"#Space-Entity&amp;#32;between&amp;#32;Text"}}'>#Space-Entity between Text</a>
<a rel="mw:WikiLink" href="./Parser_test#Plus+between+Text" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Plus+between+Text"},"sa":{"href":"#Plus+between+Text"}}'>#Plus+between+Text</a>
<a rel="mw:WikiLink" href="./Parser_test#Plus-Entity+between+Text" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Plus-Entity+between+Text"},"sa":{"href":"#Plus-Entity&amp;#43;between&amp;#43;Text"}}'>#Plus-Entity+between+Text</a>
<a rel="mw:WikiLink" href="./Parser_test#Underscore_between_Text" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Underscore_between_Text"},"sa":{"href":"#Underscore_between_Text"}}'>#Underscore_between_Text</a>
<a rel="mw:WikiLink" href="./Parser_test#Underscore-Entity_between_Text" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Underscore-Entity_between_Text"},"sa":{"href":"#Underscore-Entity&amp;#95;between&amp;#95;Text"}}'>#Underscore-Entity_between_Text</a></p>
!! end
# Parsoid html2wt disabled because it adds padding spaces around =
@ -1977,3 +1976,106 @@ Sections:
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:8 anchor/linkAnchor:Renommer_la_page_«_Informatique_durable_»_en_«_Numérique_responsable_»_? line:Renommer la page «<span> </span>Informatique durable<span> </span>» en «<span> </span>Numérique responsable<span> </span>»<span> </span>?
!! end
### FIXME ptsync 2024-02-21 This test uses <poem> which isn't a
### dependency of core; it should be rewritten to use one of the
### special extensions defined by parser tests, like <spantag>;
### marked html/php+disabled and metadata/php+disabled for now.
!! test
1. Ensure sections in extensions are ignored + TOC is inserted outside extensions
!! options
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! wikitext
__FORCETOC__
<poem>
==poem h2==
</poem>
intro
==page h2==
blah
!! html/php+disabled
<div class="poem">
<h2><span class="mw-headline" id="poem_h2">poem h2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: poem h2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
</div>
<p>intro
</p>
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#page_h2"><span class="tocnumber">1</span> <span class="toctext">page h2</span></a></li>
</ul>
</div>
<h2><span class="mw-headline" id="page_h2">page h2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: page h2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<p>blah
</p>
!! html/parsoid
<section data-mw-section-id="-1"><meta property="mw:PageProp/forcetoc"/> </section><section data-mw-section-id="-2">
<div class="poem" typeof="mw:Extension/poem" data-mw='{"name":"poem","attrs":{},"body":{"extsrc":"\n==poem h2==\n"}}'><section data-mw-section-id="-1"><h2 id="poem_h2">poem h2</h2></section></div>
<p>intro</p>
<meta property="mw:PageProp/toc" data-mw='{"autoGenerated":true}'/></section><section data-mw-section-id="1"><h2 id="page_h2">page h2</h2>
<p>blah</p></section>
!! metadata/php+disabled
THIS SHOULD BE THE SAME AS THE METADATA BELOW; SEE FIXME ABOVE.
!! metadata/parsoid
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:46 anchor/linkAnchor:page_h2 line:page h2
!! end
### FIXME ptsync 2024-02-21 This test uses <poem> which isn't a
### dependency of core; it should be rewritten to use one of the
### special extensions defined by parser tests, like <spantag>;
### marked html/php+disabled and metadata/php+disabled for now.
!! test
2. Ensure sections in extensions are ignored + TOC is inserted outside extensions
!! options
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! wikitext
__FORCETOC__
{{1x|1=foo
<poem>
==poem h2==
</poem>
}}
intro
==page h2==
blah
!! html/php+disabled
<p>foo
</p>
<div class="poem">
<h2><span class="mw-headline" id="poem_h2">poem h2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: poem h2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
</div>
<p>intro
</p>
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#page_h2"><span class="tocnumber">1</span> <span class="toctext">page h2</span></a></li>
</ul>
</div>
<h2><span class="mw-headline" id="page_h2">page h2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: page h2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<p>blah
</p>
!! html/parsoid
<section data-mw-section-id="-1" about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":["__FORCETOC__\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo\n&lt;poem>\n==poem h2==\n&lt;/poem>"}},"i":0}},"\nintro\n"]}'><meta property="mw:PageProp/forcetoc" />
<p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo\n&lt;poem>\n==poem h2==\n&lt;/poem>"}},"i":0}}]}'>foo</p><span about="#mwt2">
</span></section><section data-mw-section-id="-2" about="#mwt4"><div class="poem" typeof="mw:Extension/poem" about="#mwt2" data-mw='{"name":"poem","attrs":{},"body":{"extsrc":"\n==poem h2==\n"}}'><section data-mw-section-id="-1"><h2 id="poem_h2">poem h2</h2></section></div>
<p>intro</p>
<meta property="mw:PageProp/toc" data-mw='{"autoGenerated":true}'/></section><section data-mw-section-id="1"><h2 id="page_h2">page h2</h2>
<p>blah</p></section>
!! metadata/php+disabled
THIS SHOULD BE THE SAME AS THE METADATA BELOW; SEE FIXME ABOVE.
!! metadata/parsoid
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:60 anchor/linkAnchor:page_h2 line:page h2
!! end

View file

@ -1450,21 +1450,17 @@ parsoid=html2wt
<i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
<i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b>
<a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
'<i>foo</i> <span class="mw-ref reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
'<i>foo</i> <span typeof="mw:Extension/spantag" about="#mwt3" data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"test"}}'>test</span>
'<i>foo</i> <div title="name">test</div>
'<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
</ol></div>
!! wikitext
'''a'' foo ''[[bar]]''
''a''' foo ''[[bar]]''
''a''' foo '''{{1x|[[bar]]}}'''
[[foo]] x'''[[bar]]''
'''foo'' <ref>test</ref>
'''foo'' <spantag>test</spantag>
'''foo'' <div title="name">test</div>
'''foo'' and <br> bar
<references />
!! end
!! test
@ -1601,15 +1597,11 @@ b
!! options
parsoid=html2wt
!! html/parsoid
<p>foo <span about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
<li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i>a</i>
b</span></li>
</ol></div>
<p>foo <span typeof="mw:Extension/spantag" about="#mwt2" data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"&apos;&apos;a&apos;&apos;\n b"}}'><i>a</i>
b</span></p>
!! wikitext
foo <ref>''a''
b</ref>
<references />
foo <spantag>''a''
b</spantag>
!! end
!! test