parserTests.txt: Replace implicit Bugzilla bug numbers with Phab ones
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
index 317ab0f..35b0190 100644 (file)
@@ -292,8 +292,8 @@ CircularRef
 {{CircularRef}}
 <references />
 !! html/parsoid
-<p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
+<p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./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" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
 !! end
 
 !! test
@@ -530,6 +530,8 @@ Extra newlines between heading and content are swallowed
 
 !! test
 Heading with line break in nowiki
+!! options
+parsoid=wt2html
 !! wikitext
 == A <nowiki>B
 C</nowiki> ==
@@ -537,6 +539,9 @@ C</nowiki> ==
 <h2><span class="mw-headline" id="A_B.0AC">A B
 C</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 B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
 
+!! html/parsoid
+<h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
+C</span> </h2>
 !! end
 
 !! test
@@ -604,7 +609,7 @@ Italics and bold
 
 !! end
 
-# this example taken from the [[simple:Moon]] article (bug 47326)
+# this example taken from the [[simple:Moon]] article (T49326)
 !! test
 Italics and possessives (1)
 !! wikitext
@@ -614,7 +619,7 @@ obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
 </p>
 !! end
 
-# this example taken from [[en:Flaming Pie]] (bug 49926)
+# this example taken from [[en:Flaming Pie]] (T51926)
 !! test
 Italics and possessives (2)
 !! wikitext
@@ -624,7 +629,7 @@ Italics and possessives (2)
 </p>
 !! end
 
-# this example taken from [[en:Dictionary]] (bug 49926)
+# this example taken from [[en:Dictionary]] (T51926)
 !! test
 Italics and possessives (3)
 !! wikitext
@@ -928,6 +933,7 @@ Italics and bold: 5-quote opening sequence: (5,6)
 ###
 ### multiple quote sequences in a line
 ###
+
 !! test
 Italics and bold: multiple quote sequences: (2,4,2)
 !! options
@@ -937,8 +943,7 @@ parsoid=wt2html
 !! html/*
 <p><i>foo'<b>bar</b></i>
 </p>
-!!end
-
+!! end
 
 # same html as previous, but wikitext adjusted to match parsoid html2wt
 !! test
@@ -950,7 +955,6 @@ Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
 </p>
 !! end
 
-
 !! test
 Italics and bold: multiple quote sequences: (2,4,3)
 !! options
@@ -960,8 +964,7 @@ parsoid=wt2html
 !! html/*
 <p><i>foo'<b>bar</b></i>
 </p>
-!!end
-
+!! end
 
 # same html as previous, but wikitext adjusted to match parsoid html2wt
 !! test
@@ -973,7 +976,6 @@ Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
 </p>
 !! end
 
-
 !! test
 Italics and bold: multiple quote sequences: (2,4,4)
 !! options
@@ -983,8 +985,7 @@ parsoid=wt2html
 !! html/*
 <p><i>foo'<b>bar'</b></i>
 </p>
-!!end
-
+!! end
 
 # same html as previous, but wikitext adjusted to match parsoid html2wt
 !! test
@@ -996,7 +997,6 @@ Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
 </p>
 !! end
 
-
 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
 !! test
 Italics and bold: multiple quote sequences: (3,4,2)
@@ -1010,24 +1010,21 @@ parsoid=wt2html
 !! html/parsoid
 <p><b>foo'</b>bar<i></i>
 </p>
-!!end
+!! end
 
 # same html as previous, but wikitext adjusted to match parsoid html2wt
 !! test
 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
-!! options
-parsoid
 !! wikitext
-'''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
+'''foo''''bar''<nowiki/>''
 !! html/php
 <p><b>foo'</b>bar
 </p>
 !! html/parsoid
-<p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
+<p><b>foo'</b>bar<i></i>
 </p>
 !! end
 
-
 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
 !! test
 Italics and bold: multiple quote sequences: (3,4,3)
@@ -1041,18 +1038,18 @@ parsoid=wt2html
 !! html/parsoid
 <p><b>foo'</b>bar<b></b>
 </p>
-!!end
+!! end
 
 # same html as previous, but wikitext adjusted to match parsoid html2wt
 !! test
 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
 !! wikitext
-'''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
+'''foo''''bar'''<nowiki/>'''
 !! html/php
 <p><b>foo'</b>bar
 </p>
 !! html/parsoid
-<p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
+<p><b>foo'</b>bar<b></b>
 </p>
 !! end
 
@@ -1130,7 +1127,7 @@ The ''[[Main Page]]'''s talk page.
 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
 </p>
 !! html/parsoid
-<p>The <i><a rel="mw:WikiLink"  href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
+<p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
 !! end
 
 !! test
@@ -1181,7 +1178,7 @@ Non-html5 tags should be accepted
 !! end
 
 !! test
-<wbr> is valid wikitext (bug 52468)
+<wbr> is valid wikitext (T54468)
 !! wikitext
 <wbr>
 !! html
@@ -1296,7 +1293,7 @@ Ruby markup (W3C-style)
 
 # The next two test different paths in the sanitizer.
 !! test
-Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
+Non-word characters don't terminate tag names (T19663, T42670, T54022)
 !! wikitext
 <blockquote|>a</blockquote>
 
@@ -1367,7 +1364,7 @@ array (
 !! end
 
 !! test
-Isolated close tags should be treated as literal text (bug 52760)
+Isolated close tags should be treated as literal text (T54760)
 !! options
 parsoid=wt2html
 !! wikitext
@@ -1385,7 +1382,7 @@ parsoid=wt2html
 ###
 
 !! test
-Bare pipe character (bug 52363)
+Bare pipe character (T54363)
 !! wikitext
 |
 !! html
@@ -1394,7 +1391,7 @@ Bare pipe character (bug 52363)
 !! end
 
 !! test
-Bare pipe character from a template (bug 52363)
+Bare pipe character from a template (T54363)
 !! wikitext
 {{pipe}}
 !! html
@@ -1453,6 +1450,8 @@ Don't parse <nowiki><span class="error"></nowiki> (T149622)
 !! html/php
 <p>&lt;span class="error"&gt;
 </p>
+!! html/parsoid
+<p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
 !! end
 
 !! test
@@ -2163,7 +2162,7 @@ Regression with preformatted in <center>
 !! end
 
 !! test
-Bug 52763: Preformatted in <blockquote>
+T54763: Preformatted in <blockquote>
 !! wikitext
 <blockquote>
  Blah
@@ -2187,7 +2186,7 @@ Bug 52763: Preformatted in <blockquote>
 !! end
 
 !! test
-Bug 51086: Double newlines in blockquotes should be turned into paragraphs
+T53086: Double newlines in blockquotes should be turned into paragraphs
 !! wikitext
 <blockquote>
 Foo
@@ -2204,7 +2203,7 @@ Bar
 !! end
 
 !! test
-Bug 15491: <ins>/<del> in blockquote
+T17491: <ins>/<del> in blockquote
 !! wikitext
 <blockquote>
 Foo <del>bar</del> <ins>baz</ins> quux
@@ -2219,9 +2218,9 @@ Foo <del>bar</del> <ins>baz</ins> quux
 
 # Note that the p-wrapping is newline sensitive, which could be
 # considered a bug: tidy will wrap only the 'Foo' in the example
-# below in a <p> tag. (see comment 23-25 of bug #6200)
+# below in a <p> tag. (see comment 23-25 of T8200)
 !! test
-Bug 15491: <ins>/<del> in blockquote (2)
+T17491: <ins>/<del> in blockquote (2)
 !! wikitext
 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
 </blockquote>
@@ -2236,7 +2235,7 @@ Bug 15491: <ins>/<del> in blockquote (2)
 !! end
 
 !! test
-<pre> with attributes (bug 3202)
+<pre> with attributes (T5202)
 !! wikitext
 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
 !! html
@@ -2245,7 +2244,7 @@ Bug 15491: <ins>/<del> in blockquote (2)
 !! end
 
 !! test
-<pre> with width attribute (bug 3202)
+<pre> with width attribute (T5202)
 !! wikitext
 <pre width="8">Narrow screen goodies</pre>
 !! html
@@ -2254,7 +2253,7 @@ Bug 15491: <ins>/<del> in blockquote (2)
 !! end
 
 !! test
-<pre> with forbidden attribute (bug 3202)
+<pre> with forbidden attribute (T5202)
 !! wikitext
 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
 !! html
@@ -2272,7 +2271,7 @@ Entities inside <pre>
 !! end
 
 !! test
-<pre> with forbidden attribute values (bug 3202)
+<pre> with forbidden attribute values (T5202)
 !! wikitext
 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
 !! html
@@ -2281,7 +2280,7 @@ Entities inside <pre>
 !! end
 
 !! test
-<nowiki> inside <pre> (bug 13238)
+<nowiki> inside <pre> (T15238)
 !! wikitext
 <pre>
 <nowiki>
@@ -2366,7 +2365,7 @@ Entities inside <pre>
 
 # Parsoid doesn't strip empty tags, like Tidy does.
 !! test
-Empty pre; pre inside other HTML tags (bug 54946)
+Empty pre; pre inside other HTML tags (T56946)
 !! options
 parsoid=wt2html,wt2wt
 !! wikitext
@@ -2567,7 +2566,7 @@ Barack Obama <President> of the United States
 !! end
 
 !! test
-Handle broken pre-like tags (bug 64025)
+Handle broken pre-like tags (T66025)
 !! options
 parsoid=wt2html
 !! wikitext
@@ -2783,7 +2782,7 @@ Templates: Handle comments in the target
 !!end
 
 !! test
-Templates: Handle comments in parameter names (bug 67657)
+Templates: Handle comments in parameter names (T69657)
 !! wikitext
 {{echo|1
 <!-- should be ignored -->
@@ -2813,7 +2812,7 @@ Templates: Handle comments in parameter names (bug 67657)
 !!end
 
 !! test
-Templates: Other wikitext in parameter names (bug 67657)
+Templates: Other wikitext in parameter names (T69657)
 !! wikitext
 {{echo|''1''=foo}}
 !! html/php
@@ -2854,9 +2853,9 @@ Parsoid: pipe in transclusion parameter
 !! html/php+tidy
 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
 !! html/parsoid
-<p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
+<p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
 typeof="mw:Transclusion"
-data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
+data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
 !! end
 
 !! test
@@ -2901,7 +2900,7 @@ parsoid=html2wt,wt2wt
 </p>
 !! end
 
-## Bug 52824
+## T54824
 !! test
 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
 !! options
@@ -2914,7 +2913,7 @@ parsoid=html2wt,wt2wt
 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
 !! end
 
-## Bug 56733
+## T58733
 !! test
 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
 !! wikitext
@@ -2925,7 +2924,7 @@ Templates parameters with special tokenizing behavior dont get modified because
 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
 !! end
 
-## Bug T73412
+## T73412
 !! test
 Templates: Preserve blank parameter names
 !! wikitext
@@ -3042,7 +3041,7 @@ c
 !!end
 
 !!test
-2c. Indent-Pre and tables (bug 42252)
+2c. Indent-Pre and tables (T44252)
 !! wikitext
 {|
  |+ foo
@@ -3113,7 +3112,7 @@ a
 !!end
 
 !! test
-2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
+2g. Indented table markup mixed with indented pre content (proposed in T8200)
 !! wikitext
  <table>
  <tr>
@@ -3684,7 +3683,33 @@ Definition lists: self-closed tag
 !! end
 
 !! test
-Bug 11748: Literal closing tags
+Definition lists: ignore colons inside tags
+!! wikitext
+;one <b>two : tag <i>fun:</i>:</b>: def
+!! html
+<dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
+<dd> def</dd></dl>
+
+!! end
+
+!! test
+Definition lists: excess closed tags
+!! wikitext
+;one</b>two : bad tag fun
+!! html/php+tidy
+<dl>
+<dt>onetwo&#160;</dt>
+<dd>bad tag fun</dd>
+</dl>
+!! html/parsoid
+<dl>
+<dt>onetwo</dt>
+<dd>bad tag fun</dd>
+</dl>
+!! end
+
+!! test
+T13748: Literal closing tags
 !! wikitext
 <dl>
 <dt>test 1</dt>
@@ -3811,7 +3836,7 @@ should be left alone
 !! end
 
 !! test
-Definition Lists: Hacky use to indent tables, with comments (bug 63979)
+Definition Lists: Hacky use to indent tables, with comments (T65979)
 !! wikitext
 <!-- foo -->
 ::{|
@@ -4517,7 +4542,7 @@ Non-bracketed: http://example.com
 </p>
 !! end
 
-# parsoid doesn't explicitly mark autonumbered links, see bug 53505
+# parsoid doesn't explicitly mark autonumbered links, see T55505
 !! test
 External links: numbered
 !! wikitext
@@ -4562,7 +4587,7 @@ http://example.com/1$2345
 </p>
 !! end
 
-# parsoid doesn't explicitly mark autonumbered links, see bug 53505
+# parsoid doesn't explicitly mark autonumbered links, see T55505
 !! test
 External links: dollar sign in URL (autonumber)
 !! wikitext
@@ -4575,7 +4600,7 @@ External links: dollar sign in URL (autonumber)
 !!end
 
 !! test
-External links: open square bracket forbidden in URL (bug 4377)
+External links: open square bracket forbidden in URL (T6377)
 !! options
 parsoid=wt2html,wt2wt,html2html
 !! wikitext
@@ -4588,7 +4613,7 @@ http://example.com/1[2345
 !! end
 
 !! test
-External links: open square bracket forbidden in URL (named) (bug 4377)
+External links: open square bracket forbidden in URL (named) (T6377)
 !! options
 parsoid=wt2html,html2html
 !! wikitext
@@ -4602,7 +4627,7 @@ parsoid=wt2html,html2html
 
 # parsoid adds a space before the link name
 !! test
-External links: open square bracket forbidden in URL (named) (bug 4377)
+External links: open square bracket forbidden in URL (named) (T6377)
 Parsoid variant.
 !! wikitext
 [http://example.com/1 [2345]
@@ -4612,7 +4637,7 @@ Parsoid variant.
 !!end
 
 !! test
-External links: nowiki in URL link text (bug 6230)
+External links: nowiki in URL link text (T8230)
 !! wikitext
 [http://example.com/ <nowiki>''example site''</nowiki>]
 !! html
@@ -4621,7 +4646,7 @@ External links: nowiki in URL link text (bug 6230)
 !! end
 
 !! test
-External links: newline forbidden in text (bug 6230 regression check)
+External links: newline forbidden in text (T8230 regression check)
 !! wikitext
 [http://example.com/ first
 second]
@@ -4649,7 +4674,7 @@ External links: protocol-relative URL in brackets
 </p>
 !! end
 
-# parsoid doesn't explicitly mark autonumbered links, see bug 53505
+# parsoid doesn't explicitly mark autonumbered links, see T55505
 !! test
 External links: protocol-relative URL in brackets without text
 !! wikitext
@@ -4671,7 +4696,7 @@ External links: protocol-relative URL in free text is left alone
 !!end
 
 !! test
-External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
+External links: protocol-relative URL in the middle of a word is left alone (T32269)
 !! wikitext
 foo//example.com/Foo
 !! html
@@ -4791,6 +4816,17 @@ news:'a'b''c''d e
 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
 !! end
 
+!! test
+External links: with entity
+!! wikitext
+[http://&#x20;www.librarieswithoutborders.org Libraries without borders]
+!! html/php
+<p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
+</p>
+!! html/parsoid
+<p><a rel="mw:ExtLink" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
+!! end
+
 !! test
 External links: Lone protocols are never linked (T105697)
 !! wikitext
@@ -4811,7 +4847,7 @@ bitcoin:;
 !! end
 
 !! test
-External links: No preceding word characters allowed (bug 65278)
+External links: No preceding word characters allowed (T67278)
 !! wikitext
 NOPEhttp://example.com
 N0http://example.com
@@ -4956,7 +4992,7 @@ Old &amp; use: http://x&amp;y
 !! end
 
 !! test
-External links: encoded equals (bug 6102)
+External links: encoded equals (T8102)
 !! wikitext
 http://example.com/?foo&#61;bar
 !! html/php
@@ -4968,7 +5004,7 @@ http://example.com/?foo&#61;bar
 
 ##
 ## Note that parsoid doesn't explicit mark autonumbered links, nor
-## does it number them.  As discussed in bug 53505, we can identify
+## does it number them.  As discussed in T55505, we can identify
 ## autonumbered links via CSS.
 ##
 
@@ -5012,7 +5048,7 @@ External links: [raw equals]
 # note that parsoid html is identical to [raw equals] case; so html2wt
 # mode will return the [raw equals] wikitext
 !! test
-External links: [encoded equals] (bug 6102)
+External links: [encoded equals] (T8102)
 !! options
 parsoid=wt2html,wt2wt,html2html
 !! wikitext
@@ -5072,7 +5108,7 @@ http://e&zwnj;xample.com/
 !! end
 
 !! test
-External links: www.jpeg.org (bug 554)
+External links: www.jpeg.org (T2554)
 !! wikitext
 http://www.jpeg.org
 !! html
@@ -5080,9 +5116,9 @@ http://www.jpeg.org
 </p>
 !! end
 
-# parsoid doesn't explicitly mark autonumbered links, see bug 53505
+# parsoid doesn't explicitly mark autonumbered links, see T55505
 !! test
-External links: URL within URL (original bug 2)
+External links: URL within URL (T2002)
 !! wikitext
 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
 !! html/php
@@ -5093,7 +5129,7 @@ External links: URL within URL (original bug 2)
 !! end
 
 !! test
-BUG 361: URL inside bracketed URL
+T2361: URL inside bracketed URL
 !! wikitext
 [http://www.example.com/foo http://www.example.com/bar]
 !! html
@@ -5102,7 +5138,7 @@ BUG 361: URL inside bracketed URL
 !! end
 
 !! test
-BUG 361: URL within URL, not bracketed
+T2361: URL within URL, not bracketed
 !! wikitext
 http://www.example.com/foo?=http://www.example.com/bar
 !! html
@@ -5111,7 +5147,7 @@ http://www.example.com/foo?=http://www.example.com/bar
 !! end
 
 !! test
-BUG 289: ">"-token in URL-tail
+T2289: ">"-token in URL-tail
 !! wikitext
 http://www.example.com/<hello>
 !! html
@@ -5120,7 +5156,7 @@ http://www.example.com/<hello>
 !!end
 
 !! test
-BUG 289: literal ">"-token in URL-tail
+T2289: literal ">"-token in URL-tail
 !! wikitext
 http://www.example.com/<b>html</b>
 !! html/php
@@ -5131,7 +5167,7 @@ http://www.example.com/<b>html</b>
 !! end
 
 !! test
-BUG 289: ">"-token in bracketed URL
+T2289: ">"-token in bracketed URL
 !! wikitext
 [http://www.example.com/<hello> stuff]
 !! html
@@ -5140,7 +5176,7 @@ BUG 289: ">"-token in bracketed URL
 !!end
 
 !! test
-BUG 289: literal ">"-token in bracketed URL
+T2289: literal ">"-token in bracketed URL
 !! wikitext
 [http://www.example.com/<b>html</b> stuff]
 !! html
@@ -5149,7 +5185,7 @@ BUG 289: literal ">"-token in bracketed URL
 !!end
 
 !! test
-BUG 289: literal double quote at end of URL
+T2289: literal double quote at end of URL
 !! wikitext
 http://www.example.com/"hello"
 !! html
@@ -5158,7 +5194,7 @@ http://www.example.com/"hello"
 !!end
 
 !! test
-BUG 289: literal double quote in bracketed URL
+T2289: literal double quote in bracketed URL
 !! wikitext
 [http://www.example.com/"hello" stuff]
 !! html
@@ -5167,7 +5203,7 @@ BUG 289: literal double quote in bracketed URL
 !!end
 
 !! test
-External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
+External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
 !! wikitext
 [http://www.example.com  test]
 !! html
@@ -5187,7 +5223,7 @@ External links: link text with spaces
 !! end
 
 !! test
-External links: wiki links within external link (Bug 3695)
+External links: wiki links within external link (T5695)
 !! options
 parsoid=wt2html,html2html
 !! wikitext
@@ -5200,7 +5236,7 @@ parsoid=wt2html,html2html
 !! end
 
 !! test
-BUG 787: Links with one slash after the url protocol are invalid
+T2787: Links with one slash after the url protocol are invalid
 !! wikitext
 http:/example.com
 
@@ -5221,7 +5257,7 @@ Bracketed external links with template-generated invalid target
 !! end
 
 !! test
-Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
+T4702: Mismatched <i>, <b> and <a> tags are invalid
 !! wikitext
 ''[http://example.com text'']
 [http://example.com '''text]'''
@@ -5239,7 +5275,7 @@ Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
 
 
 !! test
-Bug 4781: %26 in URL
+T6781: %26 in URL
 !! wikitext
 http://www.example.com/?title=AT%26T
 !! html/php
@@ -5252,7 +5288,7 @@ http://www.example.com/?title=AT%26T
 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
 # % is actually legal in HTML5. Any change in output would need testing though.
 !! test
-Bug 4781, 5267: %25 in URL
+T6781, T7267: %25 in URL
 !! wikitext
 http://www.example.com/?title=100%25_Bran
 !! html/php
@@ -5263,7 +5299,7 @@ http://www.example.com/?title=100%25_Bran
 !! end
 
 !! test
-Bug 4781, 5267: %28, %29 in URL
+T6781, T7267: %28, %29 in URL
 !! wikitext
 http://www.example.com/?title=Ben-Hur_%281959_film%29
 !! html/php
@@ -5275,7 +5311,7 @@ http://www.example.com/?title=Ben-Hur_%281959_film%29
 
 
 !! test
-Bug 4781: %26 in autonumber URL
+T6781: %26 in autonumber URL
 !! wikitext
 [http://www.example.com/?title=AT%26T]
 !! html/php
@@ -5286,7 +5322,7 @@ Bug 4781: %26 in autonumber URL
 !! end
 
 !! test
-Bug 4781, 5267: %26 in autonumber URL
+T6781, T7267: %26 in autonumber URL
 !! wikitext
 [http://www.example.com/?title=100%25_Bran]
 !! html/php
@@ -5297,7 +5333,7 @@ Bug 4781, 5267: %26 in autonumber URL
 !! end
 
 !! test
-Bug 4781, 5267: %28, %29 in autonumber URL
+T6781, T7267: %28, %29 in autonumber URL
 !! wikitext
 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
 !! html/php
@@ -5309,7 +5345,7 @@ Bug 4781, 5267: %28, %29 in autonumber URL
 
 
 !! test
-Bug 4781: %26 in bracketed URL
+T6781: %26 in bracketed URL
 !! wikitext
 [http://www.example.com/?title=AT%26T link]
 !! html/php
@@ -5320,7 +5356,7 @@ Bug 4781: %26 in bracketed URL
 !! end
 
 !! test
-Bug 4781, 5267: %25 in bracketed URL
+T6781, T7267: %25 in bracketed URL
 !! wikitext
 [http://www.example.com/?title=100%25_Bran link]
 !! html
@@ -5329,7 +5365,7 @@ Bug 4781, 5267: %25 in bracketed URL
 !! end
 
 !! test
-Bug 4781, 5267: %28, %29 in bracketed URL
+T6781, T7267: %28, %29 in bracketed URL
 !! wikitext
 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
 !! html/php
@@ -5340,7 +5376,7 @@ Bug 4781, 5267: %28, %29 in bracketed URL
 !! end
 
 !! test
-External link containing a period in the anchor. (bug 63947)
+External link containing a period in the anchor. (T65947)
 !! wikitext
 [//foo.org/bar#baz. bang]
 
@@ -5355,7 +5391,7 @@ External link containing a period in the anchor. (bug 63947)
 !! end
 
 !! test
-External link containing a single quote. (bug 63947)
+External link containing a single quote. (T65947)
 !! wikitext
 [//foo.org/bar'baz]
 
@@ -5370,7 +5406,7 @@ External link containing a single quote. (bug 63947)
 !! end
 
 !! test
-External link containing double-single-quotes in text '' (bug 4598 sanity check)
+External link containing double-single-quotes in text '' (T6598 sanity check)
 !! wikitext
 Some [http://example.com/ pretty ''italics'' and stuff]!
 !! html
@@ -5379,7 +5415,7 @@ Some [http://example.com/ pretty ''italics'' and stuff]!
 !! end
 
 !! test
-External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
+External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
 !! wikitext
 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
 !! html
@@ -5453,7 +5489,7 @@ http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
 !! html/parsoid
 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
 
-<p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
+<p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
 !! end
 
 !! test
@@ -6339,7 +6375,7 @@ Nested table
 !! end
 
 !! test
-Invalid attributes in table cell (bug 1830)
+Invalid attributes in table cell (T3830)
 !! wikitext
 {|
 |Cell:|broken
@@ -6400,7 +6436,7 @@ parsoid=wt2html,html2html
 !! html/parsoid
 <table><tbody>
 <tr>
-<td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
+<td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
 !! end
 
 !! test
@@ -6474,6 +6510,26 @@ parsoid=wt2html,html2html
 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
 !! end
 
+!! test
+Break on | in element attribute name in template
+!! wikitext
+{{echo|<div cla|ss="hiho">ha</div>}}
+!! html/parsoid
+<p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
+!! end
+
+!! test
+Don't break on | in extension attribute in template
+!! wikitext
+{{echo|<ref name="hi|ho">ha</ref>}}
+
+<references />
+!! html/parsoid
+<p><span about="#mwt2" class="mw-ref" id="cite_ref-hi.7Cho_1-0" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi.7Cho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
+
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi.7Cho-1" id="cite_note-hi.7Cho-1"><a href="./Main_Page#cite_ref-hi.7Cho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi.7Cho-1" class="mw-reference-text">ha</span></li></ol>
+!! end
+
 ## We don't support roundtripping of these attributes in Parsoid.
 ## Selective serialization takes care of preventing dirty diffs.
 ## But, on edits, we dirty-diff the invalid attribute text.
@@ -6644,9 +6700,9 @@ T107652: <ref>s in templates that also generate table cell attributes should be
 <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<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
+<tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
 </tbody></table>
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./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" data-parsoid="{}">foo</span></li></ol>
 !! end
 
 !! test
@@ -7039,7 +7095,7 @@ Table cells not properly parsed in an implicit-td context
 !! end
 
 !! test
-Parsoid: Round-trip tables directly followed by content (bug 51219)
+Parsoid: Round-trip tables directly followed by content (T53219)
 !! options
 parsoid=wt2html,wt2wt
 !! wikitext
@@ -7066,7 +7122,7 @@ parsoid=wt2html,wt2wt
 !! end
 
 !! test
-Parsoid: Default to a newline after tables in new content (bug 51219)
+Parsoid: Default to a newline after tables in new content (T53219)
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -7458,7 +7514,7 @@ Piped link with multiple pipe characters in link text
 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
 </p>
 !! html/parsoid
-<p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
+<p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
 !! end
 
 !! test
@@ -7550,7 +7606,7 @@ Some text
 !! endarticle
 
 !! test
-Bug 43661: Piped links with identical prefixes
+T45661: Piped links with identical prefixes
 !! wikitext
 [[prefixed article|prefixed articles with spaces]]
 
@@ -7629,7 +7685,7 @@ Link with multiple pipes
 !! end
 
 !! test
-Anchor containing a #. (bug 63430)
+Anchor containing a #. (T65430)
 !! wikitext
 [[Main Page#And#Link]]
 !! html/php
@@ -7665,7 +7721,7 @@ This is an article in the MemoryAlpha namespace
 !! endarticle
 
 !! test
-Namespace takes precedence over interwiki link (bug 51680)
+Namespace takes precedence over interwiki link (T53680)
 !! wikitext
 [[MemoryAlpha:AlphaTest]]
 !! html
@@ -7804,7 +7860,7 @@ Link containing a tilde
 !! end
 
 !! test
-Link containing double-single-quotes '' (bug 4598)
+Link containing double-single-quotes '' (T6598)
 !! wikitext
 [[Lista d''e paise d''o munno]]
 !! html/php
@@ -7815,18 +7871,29 @@ Link containing double-single-quotes '' (bug 4598)
 !! end
 
 !! test
-Link containing double-single-quotes '' in text (bug 4598 sanity check)
+Link containing double quotes and spaces
+!! wikitext
+[[Cool "Gator"]]
+!! html/php
+<p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
+</p>
+!! html/parsoid
+<p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
+!! end
+
+!! test
+Link containing double-single-quotes '' in text (T6598 sanity check)
 !! wikitext
 Some [[Link|pretty ''italics'' and stuff]]!
 !! html/php
 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
 </p>
 !! html/parsoid
-<p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
+<p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
 !! end
 
 !! test
-Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
+Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
 !! wikitext
 ''Some [[Link|pretty ''italics'' and stuff]]!''
 !! html
@@ -7852,13 +7919,13 @@ Link with double quotes in title part (literal) and alternate part (interpreted)
 </p>
 !! html/parsoid
 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
-<p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
-<p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
-<p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
+<p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
+<p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
+<p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
 !! end
 
 !! test
-Broken image links with HTML captions (bug 39700)
+Broken image links with HTML captions (T41700)
 !! wikitext
 [[File:Nonexistent|<script></script>]]
 [[File:Nonexistent|100x100px|<script></script>]]
@@ -7949,11 +8016,11 @@ Piped link to URL: [[http://www.example.com|an example URL]]
 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
 </p>
 !! html/parsoid
-<p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
+<p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
 !! end
 
 !! test
-BUG 2: [[page|http://url/]] should link to page, not http://url/
+T2002: [[page|http://url/]] should link to page, not http://url/
 !! wikitext
 [[Main Page|http://url/]]
 !! html/php
@@ -7965,7 +8032,7 @@ BUG 2: [[page|http://url/]] should link to page, not http://url/
 
 # Parsoid does not mark self-links, by design.
 !! test
-BUG 337: Escaped self-links should be bold
+T2337: Escaped self-links should be bold
 !! options
 title=[[Bug462]]
 !! wikitext
@@ -8037,7 +8104,7 @@ Non-breaking spaces in title
 !!end
 
 !! test
-Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
+Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
 !! options
 language=ca
 !! wikitext
@@ -8048,7 +8115,7 @@ language=ca
 !! end
 
 !! test
-Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
+Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
 !! options
 language=ca
 !! wikitext
@@ -8059,7 +8126,7 @@ language=ca
 !! end
 
 !! test
-Internal link with en linktrail: no apostrophes (bug 27473)
+Internal link with en linktrail: no apostrophes (T29473)
 !! options
 language=en
 !! wikitext
@@ -8070,7 +8137,7 @@ language=en
 !! end
 
 !! test
-Internal link with ca linktrail with apostrophes (bug 27473)
+Internal link with ca linktrail with apostrophes (T29473)
 !! options
 language=ca
 !! wikitext
@@ -8081,7 +8148,7 @@ language=ca
 !! end
 
 !! test
-Internal link with kaa linktrail with apostrophes (bug 27473)
+Internal link with kaa linktrail with apostrophes (T29473)
 !! options
 language=kaa
 !! wikitext
@@ -8092,7 +8159,7 @@ language=kaa
 !! end
 
 !! test
-Link with multiple ":" in a subpage-supporting namespace (bug 63636)
+Link with multiple ":" in a subpage-supporting namespace (T65636)
 !! wikitext
 [[User:Foo/Test/63636:Bar|Test]]
 !! html/php
@@ -8107,19 +8174,32 @@ Link with multiple ":" in a subpage-supporting namespace (bug 63636)
 Handle title parsing for subpages
 !! options
 title=[[/123123]]
+subpage
 !! wikitext
 123
+!! html/php
+<p>123
+</p>
 !! html/parsoid
 <p>123</p>
 !! end
 
-## FIXME: Add a working php section here
+!! article
+User:Test/123
+!! text
+test 123
+!! endarticle
+
 !! test
 Link to a subpage from a namespace other than main
 !! options
-title=[[User:test]]
+title=[[User:Test]]
+subpage
 !! wikitext
 [[/123]]
+!! html/php
+<p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
+</p>
 !! html/parsoid
 <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>
 !! end
@@ -8141,7 +8221,8 @@ parsoid=wt2html
 !! test
 Purely hash wikilink
 !! options
-title=[[User:test/123]]
+title=[[User:Test/123]]
+subpage
 !! wikitext
 [[#a|b]]
 !! html/php
@@ -8153,12 +8234,10 @@ title=[[User:test/123]]
 
 !! test
 1. Interaction of linktrail and template encapsulation
-!! options
-parsoid
 !! wikitext
 {{echo|[[Foo]]}}l
-!! html
-<p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
+!! html/parsoid
+<p><a rel="mw:WikiLink" href="./Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
 !! end
 
 !! test
@@ -8228,7 +8307,7 @@ Parsoid link trail escaping
 !! options
 parsoid=html2wt,html2html
 !! html/parsoid
-<p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
+<p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
 !! wikitext
 [[apple]]<nowiki/>s
 !! end
@@ -8239,7 +8318,7 @@ Parsoid link prefix escaping
 language=is
 parsoid=html2wt,html2html
 !! html/parsoid
-<p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
+<p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
 !! wikitext
 Aðrir mótmælenda<nowiki/>[[söfnuður]]
 !! end
@@ -8264,12 +8343,10 @@ Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
 
 !! test
 Parsoid: Scoped parsing should handle mixed transclusions and plain text
-!! options
-parsoid
 !! wikitext
 [[Foo|{{echo|a}} b {{echo|c}}]]
-!! html
-<p><a rel="mw:WikiLink" href="Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
+!! html/parsoid
+<p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
 !! end
 
 !! test
@@ -8301,7 +8378,7 @@ parsoid=wt2html,wt2wt,html2html
 !! end
 
 !! test
-Inline interwiki link with empty title (bug 2372)
+Inline interwiki link with empty title (T4372)
 !! options
 parsoid=wt2html,wt2wt,html2html
 !! wikitext
@@ -8314,7 +8391,7 @@ parsoid=wt2html,wt2wt,html2html
 !! end
 
 !! test
-Interwiki link encoding conversion (bug 1636)
+Interwiki link encoding conversion (T3636)
 !! wikitext
 *[[Wikipedia:ro:Olteni&#0355;a]]
 *[[Wikipedia:ro:Olteni&#355;a]]
@@ -8330,7 +8407,7 @@ Interwiki link encoding conversion (bug 1636)
 !! end
 
 !! test
-Interwiki link with fragment (bug 2130)
+Interwiki link with fragment (T4130)
 !! wikitext
 [[MeatBall:SoftSecurity#foo]]
 !! html
@@ -8456,7 +8533,7 @@ parsoid=wt2html,wt2wt,html2html
 !! end
 
 !! test
-Local interwiki link: prefix only (bug 64167)
+Local interwiki link: prefix only (T66167)
 !! options
 parsoid=wt2html,wt2wt,html2html
 !! wikitext
@@ -8469,7 +8546,7 @@ parsoid=wt2html,wt2wt,html2html
 !! end
 
 !! test
-Local interwiki link: with additional interwiki prefix (bug 61357)
+Local interwiki link: with additional interwiki prefix (T63357)
 !! options
 parsoid=wt2html,wt2wt,html2html
 !! wikitext
@@ -8563,6 +8640,22 @@ Blah blah blah
 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
 !! end
 
+!! test
+Escaping of interlanguage links
+!! wikitext
+Blah blah blah
+[[:es:Spanish]]
+[[ : zh : Chinese ]]
+!! html/php
+<p>Blah blah blah
+<a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
+<a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
+</p>
+!! html/parsoid
+<p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
+<a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
+!! end
+
 ## parsoid html2wt will normalize the space to _
 !! test
 Space and question mark encoding in interlanguage links (T95473)
@@ -8595,7 +8688,7 @@ Blah blah blah
 !! end
 
 !! test
-Double interlanguage link, with prefix links (bug 8897)
+Double interlanguage link, with prefix links (T10897)
 !! options
 language=ln
 !! wikitext
@@ -8612,7 +8705,7 @@ Blah blah blah
 !! end
 
 !! test
-"Extra" interlanguage links (bug 32189 / gerrit 111390)
+"Extra" interlanguage links (T34189 / gerrit 111390)
 !! wikitext
 Blah blah blah
 [[mul:Article]]
@@ -8664,12 +8757,12 @@ language=ln
 !! end
 
 !! test
-Parsoid bug 53221: Wikilinks should be properly entity-escaped
+Parsoid T55221: Wikilinks should be properly entity-escaped
 !! options
 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
 !! html/parsoid
-<p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
-<p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
+<p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
+<p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
 !! wikitext
 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
 
@@ -8741,7 +8834,7 @@ parsoid=wt2html,wt2wt,html2html
 !! end
 
 !! test
-Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
+Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
 !! wikitext
 [[mi:Foo]]
 !! html/php
@@ -8752,7 +8845,7 @@ Handle interwiki links pointing to the current wiki as plain wiki links (bug 452
 !! end
 
 !! test
-Interlanguage link with preceding local interwiki link (bug 68085)
+Interlanguage link with preceding local interwiki link (T70085)
 !! options
 parsoid=wt2html,wt2wt,html2html
 !! wikitext
@@ -8999,7 +9092,7 @@ Broken br tag sanitization
 </p>
 !! end
 
-# TODO: Fix html2html mode (bug 51055)!
+# TODO: Fix html2html mode (T53055)!
 !! test
 Parsoid: Broken br tag recognition
 !! options
@@ -9383,7 +9476,7 @@ parsoid
 !! end
 
 !! test
-List items are not parsed correctly following a <pre> block (bug 785)
+List items are not parsed correctly following a <pre> block (T2785)
 !! wikitext
 * <pre>foo</pre>
 * <pre>bar</pre>
@@ -9592,7 +9685,7 @@ Unbalanced closing block tags break a list
 !! end
 
 # Parsoid fails this test, but it might be tricky to support properly.
-# See bug 68395.
+# See T70395.
 !! test
 Unbalanced closing non-block tags don't break a list
 (php parser relies on Tidy to fix up)
@@ -9634,7 +9727,7 @@ parsoid=wt2html,wt2wt,html2html
 <li><s> b </s></li></ol>
 !! end
 
-# See bug 68395.
+# See T70395.
 !!test
 1. List embedded in a formatting tag
 !! wikitext
@@ -9826,7 +9919,7 @@ Magic Word: {{CURRENTHOUR}}
 !! end
 
 !! test
-Magic Word: {{CURRENTWEEK}} (@bug 4594)
+Magic Word: {{CURRENTWEEK}} (T6594)
 !! wikitext
 {{CURRENTWEEK}}
 !! html
@@ -10173,7 +10266,7 @@ title=[['foo & bar = baz']]
 !! end
 
 !! test
-Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
+Magic Word: {{PAGENAME}} with metacharacters (T28781)
 !! options
 title=[[*RFC 1234 http://example.com/]]
 !! wikitext
@@ -10197,7 +10290,7 @@ title=[[User:Ævar Arnfjörð Bjarmason]]
 !! end
 
 !! test
-Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
+Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
 !! options
 title=[[*RFC 1234 http://example.com/]]
 !! wikitext
@@ -10262,6 +10355,26 @@ Magic Word: {{SITENAME}}
 </p>
 !! end
 
+!! test
+Magic Word: {{PAGELANGUAGE}}
+!! options
+language=fr
+!! wikitext
+{{PAGELANGUAGE}}
+!! html
+<p>fr
+</p>
+!! end
+
+!! test
+Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
+!! wikitext
+{{PAGELANGUAGE}}
+!! html
+<p>en
+</p>
+!! end
+
 !! test
 Case-sensitive magic words, when cased differently, should just be template transclusions
 !! wikitext
@@ -10298,7 +10411,7 @@ Parsoid: Page property magic word with magic word contents
 !! wikitext
 {{DISPLAYTITLE:''{{PAGENAME}}''}}
 !! html/parsoid
-<meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&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;>Main Page&lt;/span>&lt;/i>"}]]}'/>
+<meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt2\" 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;>Main Page&lt;/span>&lt;/i>"}]]}'/>
 !! end
 
 !! test
@@ -10328,7 +10441,7 @@ Namespace 1 {{ns:01}}
 !! end
 
 !! test
-Namespace 0 {{ns:0}} (bug 4783)
+Namespace 0 {{ns:0}} (T6783)
 !! wikitext
 {{ns:0}}
 !! html
@@ -10336,7 +10449,7 @@ Namespace 0 {{ns:0}} (bug 4783)
 !! end
 
 !! test
-Namespace 0 {{ns:00}} (bug 4783)
+Namespace 0 {{ns:00}} (T6783)
 !! wikitext
 {{ns:00}}
 !! html
@@ -10480,7 +10593,7 @@ __proto__
 ### Magic links
 ###
 !! test
-Magic links: internal link to RFC (bug 479)
+Magic links: internal link to RFC (T2479)
 !! wikitext
 [[RFC 123]]
 !! html/php
@@ -10491,7 +10604,7 @@ Magic links: internal link to RFC (bug 479)
 !! end
 
 !! test
-Magic links: RFC (bug 479)
+Magic links: RFC (T2479)
 !! wikitext
 RFC 822
 !! html/php
@@ -10502,7 +10615,7 @@ RFC 822
 !! end
 
 !! test
-Magic links: RFC (bug 65278)
+Magic links: RFC (T67278)
 !! wikitext
 This is RFC 822 but thisRFC 822 is not RFC 822linked.
 !! html/php
@@ -10513,7 +10626,7 @@ This is RFC 822 but thisRFC 822 is not RFC 822linked.
 !! end
 
 !! test
-Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
+Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
 !! wikitext
 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
 RFC
@@ -10530,7 +10643,7 @@ RFC
 !! end
 
 !! test
-Magic links: ISBN (bug 1937)
+Magic links: ISBN (T3937)
 !! wikitext
 ISBN 0-306-40615-2
 !! html/php
@@ -10541,7 +10654,7 @@ ISBN 0-306-40615-2
 !! end
 
 !! test
-Magic links: ISBN (bug 65278)
+Magic links: ISBN (T67278)
 !! wikitext
 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
 !! html/php
@@ -10552,7 +10665,7 @@ This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-
 !! end
 
 !! test
-Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
+Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
 !! wikitext
 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
 ISBN
@@ -10586,7 +10699,7 @@ PMID 1234
 !! end
 
 !! test
-Magic links: PMID (bug 65278)
+Magic links: PMID (T67278)
 !! wikitext
 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
 !! html/php
@@ -10597,7 +10710,7 @@ This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
 !! end
 
 !! test
-Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
+Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
 !! wikitext
 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
 PMID
@@ -10688,7 +10801,7 @@ Template with invalid target containing wikilink
 !! end
 
 !! test
-Template with just whitespace in it, bug #68421
+Template with just whitespace in it, T70421
 !! wikitext
 {{echo|{{ }}}}
 !! html/parsoid
@@ -10906,7 +11019,7 @@ Template with complex arguments
 !! end
 
 !! test
-BUG 553: link with two variables in a piped link
+T2553: link with two variables in a piped link
 !! wikitext
 {|
 |[[{{{1}}}|{{{2}}}]]
@@ -10919,7 +11032,8 @@ BUG 553: link with two variables in a piped link
 
 !! html/parsoid
 <table>
-<tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-parsoid='{"src":"{{{1}}}"}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-parsoid='{"src":"{{{2}}}"}'>{{{2}}}</span>]]</td></tr>
+<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>
+</tbody></table>
 !! end
 
 # See: T2553
@@ -11066,7 +11180,7 @@ Template:table
 !! endarticle
 
 !! test
-BUG 529: Template with table, not included at beginning of line
+T2529: Template with table, not included at beginning of line
 !! wikitext
 foo {{table}}
 !! html
@@ -11085,7 +11199,7 @@ foo {{table}}
 !! end
 
 !! test
-BUG 523: Template shouldn't eat newline (or add an extra one before table)
+T2523: Template shouldn't eat newline (or add an extra one before table)
 !! wikitext
 foo
 {{table}}
@@ -11105,7 +11219,7 @@ foo
 !! end
 
 !! test
-BUG 41: Template parameters shown as broken links
+T2041: Template parameters shown as broken links
 !! wikitext
 {{{parameter}}}
 !! html
@@ -11353,7 +11467,7 @@ Template:Includeonly section
 !!endarticle
 
 !! test
-Bug 6563: Edit link generation for section shown by <includeonly>
+T8563: Edit link generation for section shown by <includeonly>
 !! wikitext
 {{includeonly section}}
 !! html
@@ -11364,7 +11478,7 @@ Bug 6563: Edit link generation for section shown by <includeonly>
 
 # Uses same input as the contents of [[Template:Includeonly section]]
 !! test
-Bug 6563: Section extraction for section shown by <includeonly>
+T8563: Section extraction for section shown by <includeonly>
 !! options
 section=T-2
 !! wikitext
@@ -11377,7 +11491,7 @@ section=T-2
 !! end
 
 !! test
-Bug 6563: Edit link generation for section suppressed by <includeonly>
+T8563: Edit link generation for section suppressed by <includeonly>
 !! wikitext
 <includeonly>
 ==Includeonly section==
@@ -11389,7 +11503,7 @@ Bug 6563: Edit link generation for section suppressed by <includeonly>
 !! end
 
 !! test
-Bug 6563: Section extraction for section suppressed by <includeonly>
+T8563: Section extraction for section suppressed by <includeonly>
 !! options
 section=1
 !! wikitext
@@ -11611,7 +11725,7 @@ parsoid=wt2html
 |c
 |}
 !!html/parsoid
-<meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"dsr\":[31,38,null,null],\"src\":\"{{{b}}}\"}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
+<meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-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":""}]]}'>
 <tbody><tr><td>c</td></tr>
 </tbody></table>
 !!end
@@ -12152,11 +12266,11 @@ Templates: HTML Tables: 5. Proper fostering of categories from inside
 parsoid=wt2html,wt2wt
 !! wikitext
 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
-<!--Two categories (Bug 50330)-->
+<!--Two categories (T52330)-->
 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
 !! html
 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
-<!--Two categories (Bug 50330)-->
+<!--Two categories (T52330)-->
 <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>
 !!end
 
@@ -12296,11 +12410,11 @@ Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
 
 <references />
 !!html/parsoid
-<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
+<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
 <tbody>
 </tbody></table>
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./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">foo</span></li></ol>
 !!end
 
 !! test
@@ -12468,7 +12582,7 @@ Templates: Ugly templates: 4. newline-only template parameter inconsistency
 </p>
 !! end
 
-# Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
+# T66017 -- ugly wikitext with fostered content generates two template ranges that
 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
 !! test
 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
@@ -12482,7 +12596,7 @@ Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap o
 </table>
 !! end
 
-# Bug 64017 -- ugly wikitext with fostered content generates two template ranges
+# T66017 -- ugly wikitext with fostered content generates two template ranges
 # that are "identical" and generate nesting cycles in the algorithm
 !! test
 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
@@ -12500,11 +12614,16 @@ Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of t
 Templates: Parameters substituted at the top-level
 !! wikitext
 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
+
+{{{foo|bar|baz}}}
 !! html/php
 <p><i>who</i> me? <b>never!</b>
+</p><p>bar
 </p>
 !! html/parsoid
-<p about="#mwt2" typeof="mw:Param" data-parsoid="{&quot;src&quot;:&quot;{{{foo|''who'' {{echo|me}}? '''never!'''}}}&quot;}"><i>who</i> me? <b>never!</b></p>
+<p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
+
+<p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
 !! end
 
 !!test
@@ -12568,7 +12687,7 @@ pst
 MediaWiki
 !! end
 
-# This is bug 89, which I fixed. -- wtm
+# This is T2089, which I fixed. -- wtm
 !! test
 pre-save transform: subst: templates with parameters
 !! options
@@ -12586,7 +12705,7 @@ Template:nowikitest
 !! endarticle
 
 !! test
-pre-save transform: nowiki in subst (bug 1188)
+pre-save transform: nowiki in subst (T3188)
 !! options
 pst
 !! wikitext
@@ -12602,7 +12721,7 @@ This template has <!-- a comment --> in it.
 !! endarticle
 
 !! test
-pre-save transform: comment in subst (bug 1936)
+pre-save transform: comment in subst (T3936)
 !! options
 pst
 !! wikitext
@@ -12651,7 +12770,7 @@ Template:dangerous
 !!endarticle
 
 !!test
-(confirming safety of fix for subst bug 1936)
+(confirming safety of fix for subst T3936)
 !! wikitext
 {{Template:dangerous}}
 !! html
@@ -12660,7 +12779,7 @@ Template:dangerous
 !! end
 
 !! test
-pre-save transform: comment containing gallery (bug 5024)
+pre-save transform: comment containing gallery (T7024)
 !! options
 pst
 !! wikitext
@@ -12690,7 +12809,7 @@ pst
 !!end
 
 !! test
-pre-save transform: <noinclude> in subst (bug 3298)
+pre-save transform: <noinclude> in subst (T5298)
 !! options
 pst
 !! wikitext
@@ -12700,7 +12819,7 @@ Foobar
 !! end
 
 !! test
-pre-save transform: <onlyinclude> in subst (bug 3298)
+pre-save transform: <onlyinclude> in subst (T5298)
 !! options
 pst
 !! wikitext
@@ -12722,7 +12841,7 @@ Template:SafeSubstTest
 !! endarticle
 
 !! test
-bug 22297: safesubst: works during PST
+T24297: safesubst: works during PST
 !! options
 pst
 !! wikitext
@@ -12732,7 +12851,7 @@ FoobarFoobar
 !! end
 
 !! test
-bug 22297: safesubst: works during normal parse
+T24297: safesubst: works during normal parse
 !! wikitext
 {{SafeSubstTest}}
 !! html
@@ -12890,7 +13009,7 @@ pst title=[[Ns:Somearticle (IGNORED), Context]]
 !! end
 
 !! test
-pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
+pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
 !! options
 pst
 !! wikitext
@@ -12910,7 +13029,7 @@ pst
 !! end
 
 !! test
-pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
+pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
 !! options
 pst
 !! wikitext
@@ -12930,7 +13049,7 @@ pst
 !! end
 
 !! test
-pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
+pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
 !! options
 pst
 !! wikitext
@@ -12950,7 +13069,7 @@ pst
 !! end
 
 !! test
-pre-save transform: context links ("pipe trick") with commas (bug 21660)
+pre-save transform: context links ("pipe trick") with commas (T23660)
 !! options
 pst
 !! wikitext
@@ -13001,7 +13120,7 @@ pst
 
 
 !! test
-pre-save transform: Signature expansion in nowiki tags (bug 93)
+pre-save transform: Signature expansion in nowiki tags (T2093)
 !! options
 pst disabled
 !! wikitext
@@ -13124,7 +13243,7 @@ msg
 !! end
 
 !! test
-message transform: <noinclude> in transcluded template (bug 4926)
+message transform: <noinclude> in transcluded template (T6926)
 !! options
 msg
 !! wikitext
@@ -13134,7 +13253,7 @@ Foobar
 !! end
 
 !! test
-message transform: <onlyinclude> in transcluded template (bug 4926)
+message transform: <onlyinclude> in transcluded template (T6926)
 !! options
 msg
 !! wikitext
@@ -13256,7 +13375,7 @@ Image with caption
 !! end
 
 !! test
-Image with caption, bug 53312 #1
+Image with caption, T55312 #1
 !! wikitext
 [[File:Foobar.jpg|right|Caption page stuff]]
 !! html/php
@@ -13267,7 +13386,7 @@ Image with caption, bug 53312 #1
 !! end
 
 !! test
-Image with caption, bug 53312 #2
+Image with caption, T55312 #2
 !! wikitext
 [[File:Foobar.jpg|right|Caption page=]]
 !! html/php
@@ -13278,7 +13397,7 @@ Image with caption, bug 53312 #2
 !! end
 
 !! test
-Image with caption, bug 53312 #3
+Image with caption, T55312 #3
 !! wikitext
 [[File:Foobar.jpg|right|Caption page=stuff]]
 !! html/php
@@ -13289,7 +13408,7 @@ Image with caption, bug 53312 #3
 !! end
 
 !! test
-Allow empty links in image captions (Bug 60753)
+Allow empty links in image captions (T62753)
 !! options
 thumbsize=220
 !! wikitext
@@ -13451,7 +13570,7 @@ Image with multiple widths -- use last
 !! end
 
 !! test
-Image with multiple alignments -- use first (bug 48664)
+Image with multiple alignments -- use first (T50664)
 !! options
 thumbsize=220
 !! wikitext
@@ -13486,7 +13605,7 @@ Image with width attribute at different positions
 
 # a sad bit of backward-compatibility
 !! test
-Image with size specified with pxpx (bug 13500, 51628)
+Image with size specified with pxpx (T15500, T53628)
 !! options
 parsoid=wt2html,wt2wt,html2html
 !! wikitext
@@ -13508,10 +13627,10 @@ Image with link parameter, wiki target
 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
 </p>
 !! html/parsoid
-<p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
+<p><span class="mw-default-size" typeof="mw:Image"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
 !! end
 
-# parsoid bug 49293 (part 1)
+# parsoid T51293 (part 1)
 !! test
 Image with link parameter, URL target
 !! wikitext
@@ -13523,7 +13642,7 @@ Image with link parameter, URL target
 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
 !! end
 
-# parsoid bug 49293 (part 2)
+# parsoid T51293 (part 2)
 !! test
 Image with link parameter, protocol-less URL target
 !! wikitext
@@ -13615,7 +13734,7 @@ Image with link parameter (wiki target) and unnamed parameter
 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
 </p>
 !! html/parsoid
-<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
+<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
 !! end
 
 !! test
@@ -13667,7 +13786,7 @@ parsoid=wt2html,wt2wt,html2html
 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
 
 !! html/parsoid
-<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
+<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
 !! end
 
 !! test
@@ -13709,7 +13828,7 @@ parsoid=wt2html,wt2wt,html2html
 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
 
 !! html/parsoid
-<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
+<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
 !! end
 
 !! test
@@ -13722,7 +13841,7 @@ parsoid=wt2html,wt2wt,html2html
 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
 
 !! html/parsoid
-<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
+<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
 !! end
 
 !! test
@@ -13735,7 +13854,7 @@ parsoid=wt2html,wt2wt,html2html
 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
 
 !! html/parsoid
-<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
+<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
 !! end
 
 !! test
@@ -13973,7 +14092,7 @@ Add test with existing image page
 !! end
 
 !! test
-bug 18784  Link to non-existent image page with caption should use caption as link text
+T20784  Link to non-existent image page with caption should use caption as link text
 !! wikitext
 [[:Image:test|caption]]
 !! html
@@ -14058,7 +14177,7 @@ parsoid=wt2html,wt2wt,html2html
 !! end
 
 !! test
-BUG 1887: A ISBN with a thumbnail
+T3887: A ISBN with a thumbnail
 !! wikitext
 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
 !! html/php
@@ -14069,7 +14188,7 @@ BUG 1887: A ISBN with a thumbnail
 !! end
 
 !! test
-BUG 1887: A RFC with a thumbnail
+T3887: A RFC with a thumbnail
 !! wikitext
 [[File:Foobar.jpg|thumb|This is RFC 12354]]
 !! html/php
@@ -14080,7 +14199,7 @@ BUG 1887: A RFC with a thumbnail
 !! end
 
 !! test
-BUG 1887: A mailto link with a thumbnail
+T3887: A mailto link with a thumbnail
 !! wikitext
 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
 !! html/php
@@ -14090,9 +14209,9 @@ BUG 1887: A mailto link with a thumbnail
 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
 !! end
 
-# Pending resolution to bug 368
+# Pending resolution to T2368
 !! test
-BUG 648: Frameless image caption with a link
+T2648: Frameless image caption with a link
 !! wikitext
 [[File:Foobar.jpg|text with a [[link]] in it]]
 !! html/php
@@ -14103,7 +14222,7 @@ BUG 648: Frameless image caption with a link
 !! end
 
 !! test
-BUG 648: Frameless image caption with a link (suffix)
+T2648: Frameless image caption with a link (suffix)
 !! wikitext
 [[File:Foobar.jpg|text with a [[link]]foo in it]]
 !! html/php
@@ -14114,7 +14233,7 @@ BUG 648: Frameless image caption with a link (suffix)
 !! end
 
 !! test
-BUG 648: Frameless image caption with an interwiki link
+T2648: Frameless image caption with an interwiki link
 !! wikitext
 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
 !! html/php
@@ -14125,7 +14244,7 @@ BUG 648: Frameless image caption with an interwiki link
 !! end
 
 !! test
-BUG 648: Frameless image caption with a piped interwiki link
+T2648: Frameless image caption with a piped interwiki link
 !! wikitext
 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
 !! html/php
@@ -14179,7 +14298,7 @@ Entities in file name and attributes
 !! end
 
 !! test
-BUG 499: Alt text should have &#1234;, not &amp;1234;
+T2499: Alt text should have &#1234;, not &amp;1234;
 !! wikitext
 [[File:Foobar.jpg|&#9792;]]
 !! html/php
@@ -14199,7 +14318,7 @@ parsoid=wt2html,wt2wt,html2html
 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
 </p>
 !! html/parsoid
-<p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
+<p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
 !! end
 
 !! test
@@ -14263,7 +14382,7 @@ and some more text.]]
 !! end
 
 !! test
-Bug 3090: External links other than http: in image captions
+T5090: External links other than http: in image captions
 !! wikitext
 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
 !! html/php
@@ -14312,7 +14431,7 @@ language=es
 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
 
 !! html/parsoid
-<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
+<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
 !! end
 
 !! test
@@ -14342,7 +14461,7 @@ parsoid=wt2html,wt2wt,html2html
 
 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
 !! test
-Invalid image attributes (bug 62500)
+Invalid image attributes (T64500)
 !! options
 thumbsize=220
 parsoid=wt2html,wt2wt,html2html
@@ -14606,9 +14725,9 @@ T93580: 1. Templated <ref> inside block images
 
 <references />
 !! html/parsoid
-<figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <span about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
+<figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <span about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./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" data-parsoid="{}">foo</span></li></ol>
 !! end
 
 !! test
@@ -14618,9 +14737,9 @@ T93580: 2. <ref> inside inline images
 
 <references />
 !! html/parsoid
-<p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
+<p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./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" data-parsoid="{}">foo</span></li></ol>
 !! end
 
 !! test
@@ -14630,9 +14749,9 @@ T93580: 3. Templated <ref> inside inline images
 
 <references />
 !! html/parsoid
-<p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion  mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
+<p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion  mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./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" data-parsoid="{}">foo</span></li></ol>
 !! end
 
 ###
@@ -14686,8 +14805,8 @@ subpage title=[[Subpage test/1/2/3/4]]
 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
 </p>
 !! html/parsoid
-<p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
-<p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
+<p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
+<p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
 !! end
 
 !! test
@@ -14711,7 +14830,7 @@ Parsoid: dot-slash prefixed wikilinks
 !! end
 
 !! test
-Render invalid page names as plain text (bug 51090)
+Render invalid page names as plain text (T53090)
 !! wikitext
 [[./../foo|bar]]
 [[foo�|bar]]
@@ -14793,7 +14912,7 @@ Disabled subpages
 !! end
 
 !! test
-BUG 561: {{/Subpage}}
+T2561: {{/Subpage}}
 !! options
 subpage title=[[Page]]
 !! wikitext
@@ -14977,12 +15096,12 @@ Bar
 Bar
 </p>
 !! html/parsoid
-<p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
-<p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
-<p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
-<p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
-<p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/></p>
-<link rel="mw:PageProp/Category" href="Category:Baz"/>
+<p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
+<p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
+<p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
+<p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
+<p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/></p>
+<link rel="mw:PageProp/Category" href="./Category:Baz"/>
 !! end
 
 ## We used to, but no longer wt2wt this test since the default serializer
@@ -14992,7 +15111,7 @@ Bar
 ##
 ## The whitespace on the empty line is part of the test. Please do not delete
 !! test
-1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
+1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
 !! options
 parsoid=wt2html
 !! wikitext
@@ -15021,7 +15140,7 @@ This
 ##
 ## The whitespace on the empty line is part of the test. Please do not delete
 !! test
-2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
+2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
 !! options
 parsoid=wt2html
 !! wikitext
@@ -15217,7 +15336,7 @@ parsoid
 !! end
 
 !! test
-Normalize hrefs properly before testing for invalid link targets (bug 70894)
+Normalize hrefs properly before testing for invalid link targets (T72894)
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -15262,7 +15381,7 @@ es:Alimento fr:Nourriture zh:食品
 !! end
 
 !! test
-Duplicate interlanguage links (bug 24502)
+Duplicate interlanguage links (T26502)
 !! options
 ill
 !! wikitext
@@ -15489,7 +15608,7 @@ __FORCETOC__
 !! end
 
 !! test
-TOC with wgMaxTocLevel=3 (bug 6204)
+TOC with wgMaxTocLevel=3 (T8204)
 !! options
 wgMaxTocLevel=3
 !! wikitext
@@ -15526,7 +15645,7 @@ wgMaxTocLevel=3
 !! end
 
 !! test
-TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
+TOC with wgMaxTocLevel=3 and two level four headings (T8204)
 !! options
 wgMaxTocLevel=3
 !! wikitext
@@ -15568,7 +15687,7 @@ Resolving duplicate section names
 !! end
 
 !! test
-Resolving duplicate section names with differing case (bug 10721)
+Resolving duplicate section names with differing case (T12721)
 !! wikitext
 == Foo bar ==
 == Foo Bar ==
@@ -15647,7 +15766,7 @@ __TOC__
 !! end
 
 !! test
-BUG 1219 URL next to image (good)
+T3219 URL next to image (good)
 !! wikitext
 http://example.com [[File:Foobar.jpg]]
 !! html/php
@@ -15658,7 +15777,7 @@ http://example.com [[File:Foobar.jpg]]
 !!end
 
 !! test
-Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
+Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
 !! wikitext
 === 
 The line above must have a trailing space!
@@ -15675,7 +15794,7 @@ But just in case it doesn't...
 !! end
 
 !! test
-Header with special characters (bug 25462)
+Header with special characters (T27462)
 !! wikitext
 The tooltips shall not show entities to the user (ie. be double escaped)
 
@@ -15818,7 +15937,7 @@ Headers with excess '=' characters
 !! end
 
 !! test
-HTML headers vs TOC (bug 23393)
+HTML headers vs TOC (T25393)
 (__NOEDITSECTION__ for clearer output, doesn't matter here)
 !! wikitext
 <h1>Header 1</h1>
@@ -15875,7 +15994,7 @@ c3-->
 !! end
 
 !! test
-BUG 1219 URL next to image (broken)
+T3219 URL next to image (broken)
 !! wikitext
 http://example.com[[File:Foobar.jpg]]
 !! html/php
@@ -15886,7 +16005,7 @@ http://example.com[[File:Foobar.jpg]]
 !!end
 
 !! test
-Bug 1186 news: in the middle of text
+T3186 news: in the middle of text
 !! wikitext
 http://en.wikinews.org/wiki/Wikinews:Workplace
 !! html
@@ -16014,7 +16133,7 @@ div with braces in attribute value
 !! wikitext
 <div title="{}">Foo</div>
 !! html/php
-<div title="&#123;}">Foo</div>
+<div title="&#123;&#125;">Foo</div>
 
 !! html/parsoid
 <div title="{}">Foo</div>
@@ -16144,22 +16263,22 @@ HTML tag with leading space is parsed as text
 !! end
 
 ###
-### Nesting tests (see bug 41545, 50604, 51081)
+### Nesting tests (see T43545, T52604, T53081)
 ###
 
-# This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
+# This test case is fixed in Parsoid by domino 1.0.12. (T52604)
 # Note that html2wt is considerably more difficult if we use <b> in
-# the test case, instead of <big>
+# the test case, instead of <small>
 !! test
 Ensure that HTML adoption agency algorithm is properly implemented.
 !! wikitext
-<big>X<big>Y</big>Z</big>
+<small>X<small>Y</small>Z</small>
 !! html
-<p><big>X<big>Y</big>Z</big>
+<p><small>X<small>Y</small>Z</small>
 </p>
 !! end
 
-# This was bug 41545 in the PHP parser.
+# This was T43545 in the PHP parser.
 # Note that tidy doesn't handle this correctly.
 !! test
 Nesting of <kbd>
@@ -16170,9 +16289,9 @@ Nesting of <kbd>
 </p>
 !! end
 
-# The following cases were bug 51081 in the PHP parser.
+# The following cases were T53081 in the PHP parser.
 # Note that there are some other nestable tags (b, i, etc) which are
-# not covered; see bug 51081 for discussion.
+# not covered; see T53081 for discussion.
 
 # Note that tidy doesn't handle this correctly.
 !! test
@@ -16260,7 +16379,7 @@ Media link with nasty text
 !! end
 
 !! test
-Media link to nonexistent file (bug 1702)
+Media link to nonexistent file (T3702)
 !! wikitext
 [[Media:No such.jpg]]
 !! html
@@ -16269,7 +16388,7 @@ Media link to nonexistent file (bug 1702)
 !! end
 
 !! test
-Image link to nonexistent file (bug 1850 - good)
+Image link to nonexistent file (T3850 - good)
 !! wikitext
 [[File:No_such.jpg]]
 !! html/php
@@ -16280,7 +16399,7 @@ Image link to nonexistent file (bug 1850 - good)
 !! end
 
 !! test
-:Image link to nonexistent file (bug 1850 - bad)
+:Image link to nonexistent file (T3850 - bad)
 !! wikitext
 [[:Image:No such.jpg]]
 !! html/php
@@ -16293,7 +16412,7 @@ Image link to nonexistent file (bug 1850 - good)
 
 
 !! test
-Character reference normalization in link text (bug 1938)
+Character reference normalization in link text (T3938)
 !! wikitext
 [[Main Page|this&that]]
 !! html
@@ -16310,7 +16429,7 @@ The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
 !! endarticle
 
 !! test
-(bug 19451) Links should refer to the normalized form.
+(T21451) Links should refer to the normalized form.
 !! wikitext
 [[&#xFB2E;]]
 [[&#x5d0;&#x5b7;]]
@@ -16327,7 +16446,7 @@ The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
 !! end
 
 !! test
-Empty attribute crash test (bug 2067)
+Empty attribute crash test (T4067)
 !! wikitext
 <font color="">foo</font>
 !! html
@@ -16336,7 +16455,7 @@ Empty attribute crash test (bug 2067)
 !! end
 
 !! test
-Empty attribute crash test single-quotes (bug 2067)
+Empty attribute crash test single-quotes (T4067)
 !! wikitext
 <font color=''>foo</font>
 !! html
@@ -16395,7 +16514,7 @@ parsoid=wt2html,html2html
 !! end
 
 !! test
-Bug 2095: link with three closing brackets
+T4095: link with three closing brackets
 !! wikitext
 [[Main Page]]]
 !! html/php
@@ -16406,7 +16525,7 @@ Bug 2095: link with three closing brackets
 !! end
 
 !! test
-Bug 2095: link with pipe and three closing brackets
+T4095: link with pipe and three closing brackets
 !! wikitext
 [[Main Page|link]]]
 !! html/php
@@ -16417,7 +16536,7 @@ Bug 2095: link with pipe and three closing brackets
 !! end
 
 !! test
-Bug 2095: link with pipe and three closing brackets, version 2
+T4095: link with pipe and three closing brackets, version 2
 !! wikitext
 [[Main Page|[http://example.com/]]]
 !! html/php
@@ -16451,17 +16570,19 @@ Template:Div style
 !! endarticle
 
 !! test
-Bug 2304: HTML attribute safety (safe template; regression bug 2309)
+T4304: HTML attribute safety (safe template; regression T4309)
 !! wikitext
 <div title="{{test}}"></div>
-!! html
+!! html/php
 <div title="This is a test template"></div>
 
+!! html/parsoid
+<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>
 !! end
 
 # Parsoid has enough context to handle this case
 !! test
-Bug 2304: HTML attribute safety (dangerous template; 2309)
+T4304: HTML attribute safety (dangerous template; 2309)
 !! wikitext
 <div title="{{dangerous attribute}}"></div>
 !! html/php
@@ -16472,34 +16593,41 @@ Bug 2304: HTML attribute safety (dangerous template; 2309)
 !! end
 
 !! test
-Bug 2304: HTML attribute safety (dangerous style template; 2309)
+T4304: HTML attribute safety (dangerous style template; 2309)
 !! wikitext
 <div style="{{dangerous style attribute}}"></div>
-!! html
+!! html/php
 <div style="/* insecure input */"></div>
 
+!! html/parsoid
+<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>
 !! end
 
 !! test
-Bug 2304: HTML attribute safety (safe parameter; 2309)
+T4304: HTML attribute safety (safe parameter; 2309)
 !! wikitext
 {{div style|width: 200px}}
-!! html
+!! html/php
 <div style="float: right; width: 200px">Magic div</div>
 
+!! html/parsoid
+<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>
 !! end
 
 !! test
-Bug 2304: HTML attribute safety (unsafe parameter; 2309)
+T4304: HTML attribute safety (unsafe parameter; 2309)
 !! wikitext
 {{div style|width: expression(alert(document.cookie))}}
-!! html
+!! html/php
 <div style="/* insecure input */">Magic div</div>
 
+!! html/parsoid
+<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>
 !! end
 
+## Parsoid output here differs; needs investigation.
 !! test
-Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
+T4304: HTML attribute safety (unsafe breakout parameter; 2309)
 !! wikitext
 {{div style|"><script>alert(document.cookie)</script>}}
 !! html
@@ -16507,8 +16635,9 @@ Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
 
 !! end
 
+## Parsoid output here differs; needs investigation.
 !! test
-Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
+T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
 !! wikitext
 {{div style|" ><script>alert(document.cookie)</script>}}
 !! html
@@ -16517,7 +16646,7 @@ Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
 !! end
 
 !! test
-Bug 2304: HTML attribute safety (link)
+T4304: HTML attribute safety (link)
 !! wikitext
 <div title="[[Main Page]]"></div>
 !! html
@@ -16526,7 +16655,7 @@ Bug 2304: HTML attribute safety (link)
 !! end
 
 !! test
-Bug 2304: HTML attribute safety (italics)
+T4304: HTML attribute safety (italics)
 !! wikitext
 <div title="''foobar''"></div>
 !! html
@@ -16535,7 +16664,7 @@ Bug 2304: HTML attribute safety (italics)
 !! end
 
 !! test
-Bug 2304: HTML attribute safety (bold)
+T4304: HTML attribute safety (bold)
 !! wikitext
 <div title="'''foobar'''"></div>
 !! html
@@ -16543,9 +16672,8 @@ Bug 2304: HTML attribute safety (bold)
 
 !! end
 
-
 !! test
-Bug 2304: HTML attribute safety (ISBN)
+T4304: HTML attribute safety (ISBN)
 !! wikitext
 <div title="ISBN 1234567890"></div>
 !! html
@@ -16554,7 +16682,7 @@ Bug 2304: HTML attribute safety (ISBN)
 !! end
 
 !! test
-Bug 2304: HTML attribute safety (RFC)
+T4304: HTML attribute safety (RFC)
 !! wikitext
 <div title="RFC 1234"></div>
 !! html
@@ -16563,7 +16691,7 @@ Bug 2304: HTML attribute safety (RFC)
 !! end
 
 !! test
-Bug 2304: HTML attribute safety (PMID)
+T4304: HTML attribute safety (PMID)
 !! wikitext
 <div title="PMID 1234567890"></div>
 !! html
@@ -16572,7 +16700,7 @@ Bug 2304: HTML attribute safety (PMID)
 !! end
 
 !! test
-Bug 2304: HTML attribute safety (web link)
+T4304: HTML attribute safety (web link)
 !! wikitext
 <div title="http://example.com/"></div>
 !! html
@@ -16581,7 +16709,7 @@ Bug 2304: HTML attribute safety (web link)
 !! end
 
 !! test
-Bug 2304: HTML attribute safety (named web link)
+T4304: HTML attribute safety (named web link)
 !! wikitext
 <div title="[http://example.com/ link]"></div>
 !! html
@@ -16590,21 +16718,25 @@ Bug 2304: HTML attribute safety (named web link)
 !! end
 
 !! test
-Bug 3244: HTML attribute safety (extension; safe)
+T5244: HTML attribute safety (extension; safe)
 !! wikitext
 <div style="<nowiki>background:blue</nowiki>"></div>
-!! html
+!! html/php
 <div style="background:blue"></div>
 
+!! html/parsoid
+<div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
 !! end
 
 !! test
-Bug 3244: HTML attribute safety (extension; unsafe)
+T5244: HTML attribute safety (extension; unsafe)
 !! wikitext
 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
-!! html
+!! html/php
 <div style="/* insecure input */"></div>
 
+!! html/parsoid
+<div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"&lt;nowiki>border-left:expression(alert(document.cookie))&lt;/nowiki>"}}'></div>
 !! end
 
 # More MSIE fun discovered by Tom Gilder
@@ -16613,96 +16745,119 @@ Bug 3244: HTML attribute safety (extension; unsafe)
 MSIE CSS safety test: spurious slash
 !! wikitext
 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
-!! html
+!! html/php
 <div style="/* insecure input */">evil</div>
 
+!! html/parsoid
+<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>
 !! end
 
 !! test
 MSIE CSS safety test: hex code
 !! wikitext
 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
-!! html
+!! html/php
 <div style="/* insecure input */">evil</div>
 
+!! html/parsoid
+<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>
 !! end
 
 !! test
 MSIE CSS safety test: comment in url
 !! wikitext
 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
-!! html
+!! html/php
 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
 
+!! html/parsoid
+<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>
 !! end
 
 !! test
 MSIE CSS safety test: comment in expression
 !! wikitext
 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
-!! html
+!! html/php
 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
 
+!! html/parsoid
+<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>
 !! end
 
 !! test
-CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
+CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
 !! wikitext
 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
-!! html
+!! html/php
 <p style="/* invalid control char */">A</p>
 
+!! html/parsoid
+<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>
 !! end
 
 !! test
-MSIE 6 CSS safety test: Fullwidth (bug 55332)
+MSIE 6 CSS safety test: Fullwidth (T57332)
 !! wikitext
 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
 <div style="top:EXPRESSION(alert())">B</div>
-!! html
+!! html/php
 <p style="/* insecure input */">A</p>
 <div style="/* insecure input */">B</div>
 
+!! html/parsoid
+<p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expression((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
+<div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
 !! end
 
 !! test
-MSIE 6 CSS safety test: IPA extensions (bug 55332)
+MSIE 6 CSS safety test: IPA extensions (T57332)
 !! wikitext
 <div style="background-image:uʀʟ(javascript:alert())">A</div>
 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
-!! html
+!! html/php
 <div style="/* insecure input */">A</div>
 <p style="/* insecure input */">B</p>
 
+!! html/parsoid
+<div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
+<p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expʀessɪoɴ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
 !! end
 
 !! test
-MSIE 6 CSS safety test: sup/sub script (bug 55332)
+MSIE 6 CSS safety test: sup/sub script (T57332)
 !! wikitext
 <div style="background-image:url⁽javascript:alert())">A</div>
 <div style="background-image:url₍javascript:alert())">B</div>
 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
-!! html
+!! html/php
 <div style="/* insecure input */">A</div>
 <div style="/* insecure input */">B</div>
 <p style="/* insecure input */">C</p>
 
+!! html/parsoid
+<div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
+<div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
+<p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expressioⁿ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
 !! end
 
-# FIXME: Parsoid fails to sanitize this! See T58846.
 !! test
 Opera -o-link CSS
+!! options
+parsoid=wt2html,html2html
 !! wikitext
 <div
 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;"
 style="-o-link:attr(title);-o-link-source:current">X</div>
-!! html
+!! html/php
 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
 
+!! html/parsoid
+<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>
 !! end
 
 !! test
-MSIE 6 CSS safety test: Repetition markers (bug 55332)
+MSIE 6 CSS safety test: Repetition markers (T57332)
 !! wikitext
 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
@@ -16711,7 +16866,7 @@ MSIE 6 CSS safety test: Repetition markers (bug 55332)
 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
-!! html
+!! html/php
 <p style="/* insecure input */">A</p>
 <p style="/* insecure input */">B</p>
 <p style="/* insecure input */">C</p>
@@ -16720,6 +16875,14 @@ MSIE 6 CSS safety test: Repetition markers (bug 55332)
 <p style="/* insecure input */">F</p>
 <p style="/* insecure input */">G</p>
 
+!! html/parsoid
+<p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expres〱ion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
+<p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
+<p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
+<p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
+<p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
+<p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
+<p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
 !! end
 
 !! test
@@ -16775,7 +16938,7 @@ Template:Identity
 !! endarticle
 
 !! test
-Expansion of multi-line templates in attribute values (bug 6255)
+Expansion of multi-line templates in attribute values (T8255)
 !! wikitext
 <div style="background: {{identity|#00FF00}}">-</div>
 !! html
@@ -16783,22 +16946,21 @@ Expansion of multi-line templates in attribute values (bug 6255)
 
 !! end
 
-
 !! test
-Expansion of multi-line templates in attribute values (bug 6255 sanity check)
+Expansion of multi-line templates in attribute values (T8255 sanity check)
 !! wikitext
-<div style="background: 
+<div style="background:
 #00FF00">-</div>
 !! html/php
 <div style="background: #00FF00">-</div>
 
 !! html/parsoid
-<div style="background: 
+<div style="background:
 #00FF00">-</div>
 !! end
 
 !! test
-Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
+Expansion of multi-line templates in attribute values (T8255 sanity check 2)
 !! wikitext
 <div style="background: &#10;#00FF00">-</div>
 !! html
@@ -16817,6 +16979,7 @@ Tags which are hidden from Tidy cannot pass through the Sanitizer
 ###
 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
 ###
+
 !! test
 Parser hook: empty input
 !! wikitext
@@ -16973,7 +17136,7 @@ array (
 !! end
 
 !! test
-Parser hook: argument containing a forward slash (bug 5344)
+Parser hook: argument containing a forward slash (T7344)
 !! wikitext
 <tag filename="/tmp/bla"></tag>
 !! html/php
@@ -16990,7 +17153,7 @@ array (
 
 ## Don't expect parsoid to rt this form.
 !! test
-Parser hook: empty input using terminated empty elements (bug 2374)
+Parser hook: empty input using terminated empty elements (T4374)
 !! options
 parsoid=wt2html,html2html
 !! wikitext
@@ -17010,7 +17173,7 @@ array (
 ## </tag> should be output literally since there is no matching tag that begins it
 ## Don't expect parsoid to rt this form.
 !! test
-Parser hook: basic arguments using terminated empty elements (bug 2374)
+Parser hook: basic arguments using terminated empty elements (T4374)
 !! options
 parsoid=wt2html
 !! wikitext
@@ -17174,7 +17337,7 @@ Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=
 # In HTML5, the restrictions are that id must contain at least one character,
 # and must not contain any space characters.
 !! test
-Sanitizer: Validating the contents of the id attribute (bug 4515)
+Sanitizer: Validating the contents of the id attribute (T6515)
 !! options
 disabled
 !! wikitext
@@ -17185,7 +17348,7 @@ Something ...
 
 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
 !! test
-Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
+Sanitizer: Validating id attribute uniqueness (T6515, T8301)
 !! options
 disabled
 !! wikitext
@@ -17219,7 +17382,7 @@ Sanitizer: Validating that <meta> and <link> work, but only for Microdata
 !! end
 
 !! test
-Language converter: output gets cut off unexpectedly (bug 5757)
+Language converter: output gets cut off unexpectedly (T7757)
 !! options
 language=zh
 !! wikitext
@@ -17239,7 +17402,7 @@ all additional text is vanished
 !! end
 
 !! test
-Self closed html pairs (bug 5487)
+Self closed html pairs (T7487)
 !! options
 !! wikitext
 <center><font id="bug" />Centered text</center>
@@ -17264,7 +17427,7 @@ C'est grave !
 !! end
 
 !! test
-Punctuation: CSS !important (bug 11874)
+Punctuation: CSS !important (T13874)
 !! wikitext
 <div style="width:50% !important">important</div>
 !! html
@@ -17273,7 +17436,7 @@ Punctuation: CSS !important (bug 11874)
 !!end
 
 !! test
-Punctuation: CSS ! important (bug 11874; with space after)
+Punctuation: CSS ! important (T13874; with space after)
 !! wikitext
 <div style="width:50% ! important">important</div>
 !! html
@@ -17282,7 +17445,7 @@ Punctuation: CSS ! important (bug 11874; with space after)
 !!end
 
 !! test
-HTML bullet list, closed tags (bug 5497)
+HTML bullet list, closed tags (T7497)
 !! wikitext
 <ul>
 <li>One</li>
@@ -17303,7 +17466,7 @@ HTML bullet list, closed tags (bug 5497)
 !! end
 
 !! test
-HTML bullet list, unclosed tags (bug 5497)
+HTML bullet list, unclosed tags (T7497)
 !! wikitext
 <ul>
 <li>One
@@ -17323,7 +17486,7 @@ HTML bullet list, unclosed tags (bug 5497)
 !! end
 
 !! test
-HTML ordered list, closed tags (bug 5497)
+HTML ordered list, closed tags (T7497)
 !! wikitext
 <ol>
 <li>One</li>
@@ -17344,7 +17507,7 @@ HTML ordered list, closed tags (bug 5497)
 !! end
 
 !! test
-HTML ordered list, unclosed tags (bug 5497)
+HTML ordered list, unclosed tags (T7497)
 !! options
 !! wikitext
 <ol>
@@ -17365,7 +17528,7 @@ HTML ordered list, unclosed tags (bug 5497)
 !! end
 
 !! test
-HTML nested bullet list, closed tags (bug 5497)
+HTML nested bullet list, closed tags (T7497)
 !! wikitext
 <ul>
 <li>One</li>
@@ -17400,7 +17563,7 @@ HTML nested bullet list, closed tags (bug 5497)
 !! end
 
 !! test
-HTML nested bullet list, open tags (bug 5497)
+HTML nested bullet list, open tags (T7497)
 !! wikitext
 <ul>
 <li>One
@@ -17437,7 +17600,7 @@ HTML nested bullet list, open tags (bug 5497)
 !! end
 
 !! test
-HTML nested ordered list, closed tags (bug 5497)
+HTML nested ordered list, closed tags (T7497)
 !! wikitext
 <ol>
 <li>One</li>
@@ -17462,7 +17625,7 @@ HTML nested ordered list, closed tags (bug 5497)
 !! end
 
 !! test
-HTML nested ordered list, open tags (bug 5497)
+HTML nested ordered list, open tags (T7497)
 !! wikitext
 <ol>
 <li>One
@@ -17509,9 +17672,9 @@ HTML ordered list item with parameters oddity
 
 !! end
 
-# parsoid doesn't explicitly mark autonumbered links, see bug 53505
+# parsoid doesn't explicitly mark autonumbered links, see T55505
 !!test
-bug 5918: autonumbering
+T7918: autonumbering
 !! wikitext
 [http://first/] [http://second] [ftp://ftp]
 
@@ -17675,6 +17838,8 @@ http://===r:::https://b
 # Known to produce bad XML for now
 !! test
 Fuzz testing: Parser24
+!! options
+parsoid=wt2html
 !! wikitext
 {|
 {{{|
@@ -17684,7 +17849,7 @@ Fuzz testing: Parser24
 
 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
 |
-!! html
+!! html/php
 <table>
 {{{|
 <u class="&#124;">}}}} &gt;
@@ -17697,6 +17862,14 @@ MOVE YOUR MOUSE CURSOR OVER THIS TEXT
 </tr>
 </table>
 
+!! html/parsoid
+<p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
+<u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>
+<br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true,"autoInsertedStart":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
+
+
+
+<tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
 !! end
 
 # Note: the current result listed for this is not what the original one was,
@@ -17708,16 +17881,19 @@ MOVE YOUR MOUSE CURSOR OVER THIS TEXT
 # <li class="&#124;&#124;">
 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
 !!test
-Fuzz testing: Parser25 (bug 6055)
+Fuzz testing: Parser25 (T8055)
 !! wikitext
 {{{
 | 
 <LI CLASS=||
  >
 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
-!! html
+!! html/php
 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
 </p>
+!! html/parsoid
+<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"]}'> 
+</span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
 !! end
 
 !!test
@@ -17770,7 +17946,7 @@ Fuzz testing: image with bogus manual thumbnail
 !!end
 
 !! test
-Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
+Fuzz testing: encoded newline in generated HTML replacements (T8577)
 !! wikitext
 <pre dir="&#10;"></pre>
 !! html
@@ -17779,7 +17955,7 @@ Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
 !! end
 
 !! test
-Parsing optional HTML elements (Bug 6171)
+Parsing optional HTML elements (T8171)
 !! options
 !! wikitext
 <table>
@@ -17801,7 +17977,7 @@ Parsing optional HTML elements (Bug 6171)
 !! end
 
 !! test
-Correct handling of <td>, <tr> (Bug 6171)
+Correct handling of <td>, <tr> (T8171)
 !! options
 !! wikitext
 <table>
@@ -17897,7 +18073,7 @@ Special page transclusion
 !! end
 
 !! test
-Special page transclusion twice (bug 5021)
+Special page transclusion twice (T7021)
 !! options
 !! wikitext
 {{Special:Prefixindex/Xyzzyx}}
@@ -18278,7 +18454,7 @@ section=2
 ==b==
 !! end
 
-# Formerly testing for bug 2587, now resolved by the use of unmarked sections
+# Formerly testing for T4587, now resolved by the use of unmarked sections
 # instead of respecting commented sections
 !! test
 Section extraction prefixed by comment (section 1)
@@ -18302,7 +18478,7 @@ section=2
 
 !!end
 
-# Formerly testing for bug 2607, now resolved by the use of unmarked sections
+# Formerly testing for T4607, now resolved by the use of unmarked sections
 # instead of respecting HTML-style headings
 !! test
 Section extraction, mixed wiki and html (section 1)
@@ -18337,7 +18513,7 @@ two
 !! end
 
 
-# Formerly testing for bug 3342
+# Formerly testing for T5342
 !! test
 Section extraction, heading surrounded by <noinclude>
 !! options
@@ -18349,7 +18525,7 @@ section=1
 ==marked==
 !!end
 
-# Test behavior of bug 19910
+# Test behavior of T21910
 !! test
 Sectiion with all-equals
 !! options
@@ -18697,7 +18873,7 @@ xxx
 !! end
 
 !! test
-Section replacement test with initial whitespace (bug 13728)
+Section replacement test with initial whitespace (T15728)
 !! options
 replace=2,"xxx"
 !! wikitext
@@ -18712,7 +18888,7 @@ xxx
 
 
 !! test
-Section extraction, heading followed by pre with 20 spaces (bug 6398)
+Section extraction, heading followed by pre with 20 spaces (T8398)
 !! options
 section=1
 !! wikitext
@@ -18724,7 +18900,7 @@ section=1
 !! end
 
 !! test
-Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
+Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
 !! options
 section=1
 !! wikitext
@@ -18737,7 +18913,7 @@ section=1
 
 
 !! test
-Section extraction, <pre> around bogus header (bug 10309)
+Section extraction, <pre> around bogus header (T12309)
 !! options
 section=2
 !! wikitext
@@ -18754,7 +18930,7 @@ stuff
 !! end
 
 !! test
-Section replacement, <pre> around bogus header (bug 10309)
+Section replacement, <pre> around bogus header (T12309)
 !! options
 replace=2,"xxx"
 !! wikitext
@@ -18774,7 +18950,6 @@ stuff
 xxx
 !! end
 
-
 !! test
 Handling of &#x0A; in URLs
 !! wikitext
@@ -18783,9 +18958,7 @@ Handling of &#x0A; in URLs
 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
 
 !! html/parsoid
-<ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
-a">irc://
-a</a></li></ul></li></ul>
+<ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul></li></ul>
 !! end
 
 !! test
@@ -18799,7 +18972,6 @@ Handling of %0A in URLs
 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
 !! end
 
-
 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
 !! test
 5 quotes, code coverage +1 line
@@ -19370,6 +19542,27 @@ File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
 </ul>
 !! end
 
+!! test
+Gallery override link with absolute external link with LanguageConverter
+!! options
+language=zh
+!! input
+<gallery>
+File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
+</gallery>
+!! result
+<ul class="gallery mw-gallery-traditional">
+               <li class="gallerybox" style="width: 155px"><div style="width: 155px">
+                       <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
+                       <div class="gallerytext">
+<p>caption
+</p>
+                       </div>
+               </div></li>
+</ul>
+
+!! end
+
 !! test
 Gallery override link with malicious javascript (T36852)
 !! options
@@ -19392,7 +19585,7 @@ File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!
 
 !! html/parsoid
 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
-<li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./&quot;_onclick=&quot;alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
+<li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./%22_onclick=%22alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
 </ul>
 !! end
 
@@ -19422,6 +19615,24 @@ File:Foobar.jpg|link=<
 </ul>
 !! end
 
+!! test
+Serialize gallery without attrs in data-mw
+!! options
+parsoid={
+  "modes": ["html2wt"],
+  "nativeGallery": true
+}
+!! html/parsoid
+<ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
+<li class="gallerycaption">123</li>
+<li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Test.png</span></div><div class="gallerytext"></div></li>
+</ul>
+!! wikitext
+<gallery caption="123">
+File:Test.png
+</gallery>
+!! end
+
 !! test
 HTML Hex character encoding (spells the word "JavaScript")
 !! options
@@ -19438,7 +19649,7 @@ parsoid=wt2html,wt2wt,html2html
 !! end
 
 !! test
-HTML Hex character encoding bogus encoding (bug 26437 regression check)
+HTML Hex character encoding bogus encoding (T28437 regression check)
 !! wikitext
 &#xsee;&#XSEE;
 !! html/php
@@ -19577,7 +19788,7 @@ ISBN 1234567890
 !! end
 
 !! test
-Bug 22905: <abbr> followed by ISBN followed by </a>
+T24905: <abbr> followed by ISBN followed by </a>
 !! wikitext
 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
 !! html/php
@@ -19705,7 +19916,6 @@ dt/dd/dl test
 
 !!end
 
-
 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
 !! test
 Images with the "|" character in the comment
@@ -19715,7 +19925,7 @@ Images with the "|" character in the comment
 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
 
 !! html/parsoid
-<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
+<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx" data-parsoid='{"a":{"href":"http://test/?param1=%7Cleft%7C&amp;param2=%7Cx"},"sa":{"href":"http://test/?param1=|left|&amp;param2=|x"}}'>external</a> URL</figcaption></figure>
 !! end
 
 !! test
@@ -20013,7 +20223,7 @@ ISBN 12345678901
 
 
 !! test
-ISBN with trailing year (bug 8110)
+ISBN with trailing year (T9110)
 !! wikitext
 ISBN 1-234-56789-0 - 2006
 
@@ -20062,7 +20272,7 @@ anchorencode deals with templates
 !! end
 
 !! test
-anchorencode encodes like the TOC generator: (bug 18431)
+anchorencode encodes like the TOC generator: (T20431)
 !! wikitext
 === _ +:.3A%3A&&amp;]] ===
 {{anchorencode: _ +:.3A%3A&&amp;]] }}
@@ -20074,7 +20284,7 @@ __NOEDITSECTION__
 !! end
 
 !! test
-Bug 6200: blockquotes and paragraph formatting
+T8200: blockquotes and paragraph formatting
 !! wikitext
 <blockquote>
 foo
@@ -20095,7 +20305,7 @@ bar
 !! end
 
 !! test
-Bug 8293: Use of center tag ruins paragraph formatting
+T10293: Use of center tag ruins paragraph formatting
 !! wikitext
 <center>
 foo
@@ -20257,7 +20467,7 @@ blah
 ## This wikitext usage is going to be fairly uncommon in production and
 ## selser will take care of preserving formatting in those scenarios.
 !! test
-Don't convert blue categorylinks to another variant (bug 33210)
+Don't convert blue categorylinks to another variant (T35210)
 !! options
 cat
 language=zh
@@ -20267,8 +20477,8 @@ parsoid=wt2html
 !! html/php
 cat=分类 sort=
 !! html/parsoid
-<p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
-<link rel="mw:PageProp/Category" href="Category:分类"/>
+<p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
+<link rel="mw:PageProp/Category" href="./Category:分类"/>
 !! end
 
 !! test
@@ -20426,7 +20636,7 @@ Should be stripped<span title="Exclamation">!</span>
 !! end
 
 !! test
-Bug 24072: more test on conversion rule for title
+T26072: more test on conversion rule for title
 !! options
 language=zh variant=zh-tw showtitle
 !! wikitext
@@ -20543,6 +20753,28 @@ Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiw
 # Since Parsoid is starting to emit canonical wikitext for links,
 # [http://example.com http://example.com] will not RT back to that
 # form anymore.
+!! test
+HTML markups with conversion syntax in attribs, nested in other conversion blocks
+!! options
+language=zh variant=zh-cn
+!! wikitext
+-{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
+!! html
+<p><span title="X">A</span>
+</p>
+!! end
+
+!! test
+HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
+!! options
+language=zh variant=zh-cn disabled
+!! wikitext
+-{<span title="-{X}-">A</span>}-
+!! html
+<p><span title="X">A</span>
+</p>
+!! end
+
 !! test
 Proper conversion of text in external links
 !! options
@@ -20619,10 +20851,12 @@ language=sr variant=sr-ec
 </p>
 !! end
 
+# FIXME: This test is currently broken in the PHP parser T153761
 !! test
 T146304: Don't break template parsing if language converter markup is in the parameter.
 !! options
 language=sr variant=sr-ec
+disabled
 !! wikitext
 {{echo|-{R|foo}-}}
 !! html/php
@@ -20685,24 +20919,65 @@ File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
 
 !! end
 
-# FIXME: This test is currently broken in the PHP parser (bug 52661)
 !! test
-Don't break list handling if language converter markup is in the item.
+T153135: Don't break list handling if language converter markup is in the item.
 !! options
 language=zh variant=zh-cn
 !! wikitext
 ;-{zh-cn:AAA;zh-tw:BBB}-
+;-{R|foo:bar}-
+!! html/php
+<dl><dt>AAA</dt>
+<dt>foo:bar</dt></dl>
+
+!! html/parsoid
+<dl>
+<dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}],"show":true}'></span></dt>
+<dt><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"foo:bar"}'></span></dt>
+</dl>
+!! end
+
+// Note that parsoid does not protect colons unless language converter
+// markup is properly nested, because it is a backtracking parser.
+!! test
+T153135: Unclosed markup in definition list (code coverage)
+!! options
+language=zh variant=zh-cn
+!! wikitext
+;<b>foo:bar
+;-{zh-cn:AAA
+!! html/php
+<dl><dt><b>foo:bar</dt>
+<dt>-{zh-cn:AAA</b></dt></dl>
+
+!! html/parsoid
+<dl>
+<dt><b>foo:bar</b></dt>
+<b>
+<dt>-{zh-cn</dt>
+<dd>AAA</dd>
+</b></dl>
+!! end
+
+!! test
+T153135: Nested language converter markup in definition list (code coverage)
+!! options
+language=zh variant=zh-cn
+!! wikitext
+;-{zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
 !! html/php
-<dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
+<dl><dt>AAA foo:bar bat:baz</dt>
+<dd>def</dd></dl>
 
 !! html/parsoid
-<dl><dt>AAA
-</dt></dl>
+<dl>
+<dt><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"AAA &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[13,32,null,2]}&#39; data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"bar\"}&#39;>&lt;/span> &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[33,46,null,2]}&#39; data-mw=&#39;{\"disabled\":true,\"show\":true,\"text\":\"bat:baz\"}&#39;>&lt;/span>"}],"show":true}'></span></dt>
+<dd>def</dd>
+</dl>
 !! end
 
-# FIXME: This test is currently broken in the PHP parser (bug 52661)
 !! test
-Don't break table handling if language converter markup is in the cell.
+T153140: Don't break table handling if language converter markup is in the cell.
 !! options
 language=sr variant=sr-ec
 !! wikitext
@@ -20714,7 +20989,7 @@ language=sr variant=sr-ec
 <table>
 
 <tr>
-<td>Б}-
+<td> B
 </td></tr></table>
 
 !! html/parsoid
@@ -20727,7 +21002,7 @@ language=sr variant=sr-ec
 !! end
 
 !! test
-Bug 529: Uncovered bullet
+T2529: Uncovered bullet
 !! wikitext
 * Foo {{bullet}}
 !! html
@@ -20743,7 +21018,7 @@ Bug 529: Uncovered bullet
 # To test realistic parsing behavior, apply a tidy-like transformation to both
 # the expected output and your parser's output.
 !! test
-Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
+T2529: Uncovered bullet leaving empty list, normally removed by tidy
 !! wikitext
 ******* Foo {{bullet}}
 !! html
@@ -20753,7 +21028,7 @@ Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
 !! end
 
 !! test
-Bug 529: Uncovered table already at line-start
+T2529: Uncovered table already at line-start
 !! wikitext
 x
 
 !! end
 
 !! test
-Bug 529: Uncovered bullet in parser function result
+T2529: Uncovered bullet in parser function result
 !! wikitext
 * Foo {{lc:{{bullet}} }}
 !! html
@@ -20786,7 +21061,7 @@ Bug 529: Uncovered bullet in parser function result
 !! end
 
 !! test
-Bug 5678: Double-parsed template argument
+T7678: Double-parsed template argument
 !! wikitext
 {{lc:{{{1}}}|hello}}
 !! html
@@ -20795,7 +21070,7 @@ Bug 5678: Double-parsed template argument
 !! end
 
 !! test
-Bug 5678: Double-parsed template invocation
+T7678: Double-parsed template invocation
 !! wikitext
 {{lc:{{paramtest {{!}} param = hello }} }}
 !! html
@@ -20804,7 +21079,7 @@ Bug 5678: Double-parsed template invocation
 !! end
 
 !! test
-Case insensitivity of parser functions for non-ASCII characters (bug 8143)
+Case insensitivity of parser functions for non-ASCII characters (T10143)
 !! options
 language=cs
 title=[[Main Page]]
@@ -20949,9 +21224,9 @@ B</strong>
 </p>
 !! end
 
-# Bug 6200: <blockquote> should behave like <div> with respect to line breaks
+# T8200: <blockquote> should behave like <div> with respect to line breaks
 !! test
-Bug 6200: paragraphs inside blockquotes (no extra line breaks)
+T8200: paragraphs inside blockquotes (no extra line breaks)
 !! wikitext
 <blockquote>Line one
 
@@ -20967,7 +21242,7 @@ Line two</blockquote>
 !! end
 
 !! test
-Bug 6200: paragraphs inside blockquotes (extra line break on open)
+T8200: paragraphs inside blockquotes (extra line break on open)
 !! wikitext
 <blockquote>
 Line one
@@ -20986,7 +21261,7 @@ Line two</blockquote>
 !! end
 
 !! test
-Bug 6200: paragraphs inside blockquotes (extra line break on close)
+T8200: paragraphs inside blockquotes (extra line break on close)
 !! wikitext
 <blockquote>Line one
 
@@ -21006,7 +21281,7 @@ Line two
 !! end
 
 !! test
-Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
+T8200: paragraphs inside blockquotes (extra line break on open and close)
 !! wikitext
 <blockquote>
 Line one
@@ -21111,7 +21386,7 @@ Free external link invading image caption
 !! end
 
 !! test
-Bug 15196: localised external link numbers
+T17196: localised external link numbers
 !! options
 language=fa
 !! wikitext
@@ -21248,7 +21523,7 @@ comment local title=[[Main Page]]
 !!end
 
 !! test
-Edit comment with subpage link (bug 14080)
+Edit comment with subpage link (T16080)
 !! options
 comment
 subpage
@@ -21260,7 +21535,7 @@ Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/su
 !!end
 
 !! test
-Edit comment with subpage link and link text (bug 14080)
+Edit comment with subpage link and link text (T16080)
 !! options
 comment
 subpage
@@ -21272,7 +21547,7 @@ Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">nea
 !!end
 
 !! test
-Edit comment with bogus subpage link in non-subpage NS (bug 14080)
+Edit comment with bogus subpage link in non-subpage NS (T16080)
 !! options
 comment
 title=[[Subpage test]]
@@ -21348,7 +21623,7 @@ Created page with &quot;&lt;noinclude&gt;<a href="/index.php?title=Category:Requ
 !! end
 
 !! test
-Space normalisation on autocomment (bug 22784)
+Space normalisation on autocomment (T24784)
 !! options
 comment
 title=[[Main Page]]
@@ -21359,7 +21634,7 @@ title=[[Main Page]]
 !! end
 
 !! test
-percent-encoding and + signs in comments (Bug 26410)
+percent-encoding and + signs in comments (T28410)
 !! options
 comment
 !! wikitext
@@ -21368,7 +21643,7 @@ comment
 <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>
 !! end
 
-# Parsoid doesn't support this yet: see bug 73581
+# Parsoid doesn't support this yet: see T75581
 # but it *should* omit the 'src' attribute if the image is bad.
 # PHP side of tests was disabled in
 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
@@ -21384,7 +21659,7 @@ Bad images - basic functionality
 !! end
 
 !! test
-Bad images - bug 16039: text after bad image disappears
+Bad images - T18039: text after bad image disappears
 !! wikitext
 Foo bar
 [[File:Bad.jpg]]
@@ -21400,7 +21675,7 @@ Bar foo</p>
 !! end
 
 !! test
-Verify that displaytitle works (bug #22501) no displaytitle
+Verify that displaytitle works (T24501) no displaytitle
 !! options
 showtitle
 !! config
@@ -21415,7 +21690,7 @@ Parser test
 !! end
 
 !! test
-Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
+Verify that displaytitle works (T24501) RestrictDisplayTitle=false
 !! options
 showtitle
 title=[[Screen]]
@@ -21432,7 +21707,7 @@ whatever
 !! end
 
 !! test
-Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
+Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
 !! options
 showtitle
 title=[[Screen]]
@@ -21449,7 +21724,7 @@ Screen
 !! end
 
 !! test
-Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
+Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
 !! options
 showtitle
 title=[[Screen]]
@@ -21466,7 +21741,7 @@ screen
 !! end
 
 !! test
-Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
+Verify that displaytitle works (T24501) AllowDisplayTitle=false
 !! options
 showtitle
 title=[[Screen]]
@@ -21483,7 +21758,7 @@ Screen
 !! end
 
 !! test
-Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
+Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
 !! options
 showtitle
 title=[[Screen]]
@@ -21498,7 +21773,7 @@ Screen
 !! end
 
 !! test
-Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
+Verify that displaytitle handles inline CSS styles (T28547) - rejected value
 !! options
 showtitle
 title=[[Screen]]
@@ -21515,7 +21790,7 @@ this is not the the title
 !! end
 
 !! test
-Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
+Verify that displaytitle handles inline CSS styles (T28547) - accepted value
 !! options
 showtitle
 title=[[Screen]]
@@ -21648,7 +21923,7 @@ preload
 !! end
 
 !! test
-Play a bit with r67090 and bug 3158
+Play a bit with r67090 and T5158
 !! wikitext
 <div style="width:50% !important">&nbsp;</div>
 <div style="width:50%&nbsp;!important">&nbsp;</div>
@@ -21695,7 +21970,7 @@ Strip reserved data attributes
 !! end
 
 !! test
-percent-encoding and + signs in internal links (Bug 26410)
+percent-encoding and + signs in internal links (T28410)
 !! wikitext
 [[User:+%]] [[Page+title%]]
 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
@@ -21715,7 +21990,7 @@ percent-encoding and + signs in internal links (Bug 26410)
 !! end
 
 !! test
-Special characters in embedded file links (bug 27679)
+Special characters in embedded file links (T29679)
 !! wikitext
 [[File:Contains & ampersand.jpg]]
 [[File:Does not exist.jpg|Title with & ampersand]]
@@ -21738,7 +22013,7 @@ Text&apos;s been normalized?
 !! end
 
 !! test
-Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
+T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
 !! wikitext
 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
 !! html
@@ -21747,7 +22022,7 @@ http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
 !! end
 
 !! test
-Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
+T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
 !! wikitext
 [http://www.example.org/ ideograms]
 !! html
@@ -21756,7 +22031,7 @@ Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
 !! end
 
 !! test
-Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
+T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
 !! wikitext
 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
 !! html
@@ -21784,7 +22059,7 @@ Template:Identical
 !! endarticle
 
 !! test
-Bug 31098 Template which includes system messages which includes the template
+T33098 Template which includes system messages which includes the template
 !! wikitext
 {{Identical}}
 !! html
@@ -21794,7 +22069,7 @@ Bug 31098 Template which includes system messages which includes the template
 !! end
 
 !! test
-Bug31490 Turkish: ucfirst 'blah'
+T33490 Turkish: ucfirst 'blah'
 !! options
 language=tr
 !! wikitext
@@ -21805,7 +22080,7 @@ language=tr
 !! end
 
 !! test
-Bug31490 Turkish: ucfirst 'ix'
+T33490 Turkish: ucfirst 'ix'
 !! options
 language=tr
 !! wikitext
@@ -21816,7 +22091,7 @@ language=tr
 !! end
 
 !! test
-Bug31490 Turkish: lcfirst 'BLAH'
+T33490 Turkish: lcfirst 'BLAH'
 !! options
 language=tr
 !! wikitext
@@ -21827,7 +22102,7 @@ language=tr
 !! end
 
 !! test
-Bug31490 Turkish: ucfırst (with a dotless i)
+T33490 Turkish: ucfırst (with a dotless i)
 !! options
 language=tr
 !! wikitext
@@ -21838,7 +22113,7 @@ language=tr
 !! end
 
 !! test
-Bug31490 ucfırst (with a dotless i) with English language
+T33490 ucfırst (with a dotless i) with English language
 !! options
 language=en
 !! wikitext
@@ -21849,7 +22124,7 @@ language=en
 !! end
 
 !! test
-Bug 26375: TOC with italics
+T28375: TOC with italics
 !! options
 title=[[Main Page]]
 !! wikitext
@@ -21867,7 +22142,7 @@ __TOC__
 !! end
 
 !! test
-Bug 26375: TOC with bold
+T28375: TOC with bold
 !! options
 title=[[Main Page]]
 !! wikitext
@@ -21885,7 +22160,7 @@ __TOC__
 !! end
 
 !! test
-Bug 33845: Headings become cursive in TOC when they contain an image
+T35845: Headings become cursive in TOC when they contain an image
 !! options
 title=[[Main Page]]
 !! wikitext
@@ -21903,7 +22178,7 @@ __TOC__
 !! end
 
 !! test
-Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
+T35845 (2): Headings become bold in TOC when they contain a blockquote
 !! options
 title=[[Main Page]]
 !! wikitext
@@ -22058,7 +22333,7 @@ __TOC__
 !! end
 
 !! test
-Bug 72884: bdi element in ToC
+T74884: bdi element in ToC
 !! wikitext
 __TOC__
 == <bdi>test</bdi> ==
@@ -22121,17 +22396,17 @@ __TOC__
 !! end
 
 !! article
-MediaWiki:Bug32057
+MediaWiki:T34057
 !! text
 == {{int:headline_sample}} ==
 !! endarticle
 
 !! test
-Bug 32057: Title needed when expanding <h> nodes.
+T34057: Title needed when expanding <h> nodes.
 !! options
 title=[[Main Page]]
 !! wikitext
-{{int:Bug32057}}
+{{int:T34057}}
 !! html
 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
 
@@ -22195,7 +22470,7 @@ language=be-tarask
 !! end
 
 !! test
-Wrong option for formatNum (bug 56199)
+Wrong option for formatNum (T58199)
 !! wikitext
 {{formatnum:1,234.56|Random}}
 {{formatnum:1,234.56|EVERYTHING}}
@@ -22246,7 +22521,7 @@ Strip marker in anchorencode
 !! end
 
 !! test
-nowiki inside link inside heading (bug 18295)
+nowiki inside link inside heading (T20295)
 !! wikitext
 ==[[foo|x<nowiki>y</nowiki>z]]==
 !! html
@@ -22255,7 +22530,7 @@ nowiki inside link inside heading (bug 18295)
 !! end
 
 !! test
-new support for bdi element (bug 31817)
+new support for bdi element (T33817)
 !! wikitext
 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
 !! html
@@ -22283,7 +22558,7 @@ Ignore pipe between table row attributes
 !! end
 
 !!test
-Gallery override link with WikiLink (bug 34852)
+Gallery override link with WikiLink (T36852)
 !! wikitext
 <gallery>
 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
@@ -22301,82 +22576,6 @@ File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
 
 !! end
 
-!!test
-Gallery override link with absolute external link (bug 34852)
-!! wikitext
-<gallery>
-File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
-</gallery>
-!! html
-<ul class="gallery mw-gallery-traditional">
-               <li class="gallerybox" style="width: 155px"><div style="width: 155px">
-                       <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
-                       <div class="gallerytext">
-<p>caption
-</p>
-                       </div>
-               </div></li>
-</ul>
-
-!! end
-
-!! test
-Gallery override link with absolute external link with LanguageConverter
-!! options
-language=zh
-!! input
-<gallery>
-File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
-</gallery>
-!! result
-<ul class="gallery mw-gallery-traditional">
-               <li class="gallerybox" style="width: 155px"><div style="width: 155px">
-                       <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
-                       <div class="gallerytext">
-<p>caption
-</p>
-                       </div>
-               </div></li>
-</ul>
-
-!! end
-
-!!test
-Gallery override link with malicious javascript (bug 34852)
-!! wikitext
-<gallery>
-File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
-</gallery>
-!! html
-<ul class="gallery mw-gallery-traditional">
-               <li class="gallerybox" style="width: 155px"><div style="width: 155px">
-                       <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
-                       <div class="gallerytext">
-<p>caption
-</p>
-                       </div>
-               </div></li>
-</ul>
-
-!! end
-
-!!test
-Gallery with invalid title as link (bug 43964)
-!! wikitext
-<gallery>
-File:foobar.jpg|link=<
-</gallery>
-!! html
-<ul class="gallery mw-gallery-traditional">
-               <li class="gallerybox" style="width: 155px"><div style="width: 155px">
-                       <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
-                       <div class="gallerytext">
-                       </div>
-               </div></li>
-</ul>
-
-!! end
-
 !!test
 Language parser function
 !! wikitext
@@ -22411,7 +22610,7 @@ Special:Foobar
 !! end
 
 !!test
-Bug 34939 - Case insensitive link parsing ([HttP://])
+T36939 - Case insensitive link parsing ([HttP://])
 !! wikitext
 [HttP://MediaWiki.Org/]
 !! html/php
@@ -22422,7 +22621,7 @@ Bug 34939 - Case insensitive link parsing ([HttP://])
 !! end
 
 !!test
-Bug 34939 - Case insensitive link parsing ([HttP:// title])
+T36939 - Case insensitive link parsing ([HttP:// title])
 !! wikitext
 [HttP://MediaWiki.Org/ MediaWiki]
 !! html
@@ -22431,7 +22630,7 @@ Bug 34939 - Case insensitive link parsing ([HttP:// title])
 !! end
 
 !!test
-Bug 34939 - Case insensitive link parsing (HttP://)
+T36939 - Case insensitive link parsing (HttP://)
 !! wikitext
 HttP://MediaWiki.Org/
 !! html/php
@@ -22493,7 +22692,7 @@ parsoid=wt2html,wt2wt
 #### Parsoid-specific functionality tests
 #### -----------------------------------------------------------------
 
-# Bug 63642/66749: Formatting elt fixup around images is cleaned up.
+# T65642/T68749: Formatting elt fixup around images is cleaned up.
 # We know wt2wt will fail, but we expect selser to pass.
 # Due to the nature of our testing, wt2wt and selser tests will enter the
 # blacklist and we'll catch selser regressions based on changes to the
@@ -22573,13 +22772,13 @@ B <ref name="x">foo</ref>
 C <ref name="y" />
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
-B <span about="#mwt4" class="mw-ref" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
-C <span about="#mwt6" class="mw-ref" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
+B <span about="#mwt4" class="mw-ref" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
+C <span about="#mwt6" class="mw-ref" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="./Main_Page#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
-<li about="#cite_note-x-2" id="cite_note-x-2"><a href="#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
-<li about="#cite_note-y-3" id="cite_note-y-3"><a href="#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
+<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">foo</span></li>
+<li about="#cite_note-x-2" id="cite_note-x-2"><a href="./Main_Page#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
+<li about="#cite_note-y-3" id="cite_note-y-3"><a href="./Main_Page#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
 </ol>
 !!end
 
@@ -22590,10 +22789,10 @@ A <ref name="x">foo</ref>
 B <ref name="x" />
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
-B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
+B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
+<li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
 </ol>
 !!end
 
@@ -22605,11 +22804,11 @@ B <ref name=" x " />
 C <ref name= x  />
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
-B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
-C <span about="#mwt6" class="mw-ref" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
+B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
+C <span about="#mwt6" class="mw-ref" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
+<li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Main_Page#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
 </ol>
 !!end
 
@@ -22620,9 +22819,9 @@ Ref: 4. 'constructor' should be accepted as a valid ref-name
 A <ref name="constructor">foo</ref>
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="./Main_Page#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
+<li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="./Main_Page#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
 </ol>
 !!end
 
@@ -22635,10 +22834,10 @@ A <ref>
 
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
 
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">This is a <b><a rel="mw:WikiLink" href="Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
+<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">This is a <b><a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
 </span></li>
 </ol>
 !!end
@@ -22654,10 +22853,10 @@ A <ref>
 
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
 
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
+<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">foo
  bar
  baz
 </span></li>
@@ -22682,10 +22881,10 @@ booz
 
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
 
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
+<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">foo
 
 bar
 
@@ -22706,9 +22905,9 @@ A <ref> foo {{echo|</ref> B C}}
 
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C}}</p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C}}</p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo {{echo|</span></li>
+<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">foo {{echo|</span></li>
 </ol>
 !!end
 
@@ -22718,9 +22917,9 @@ Ref: 9. unclosed comments should not leak out of ref-body
 A <ref> foo <!--</ref> B C
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <!----></span></li>
+<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">foo <!----></span></li>
 </ol>
 !!end
 
@@ -22731,11 +22930,11 @@ A <ref> <b> foo </ref> B C
 
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
 
 
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
+<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"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
 </ol>
 !!end
 
@@ -22746,11 +22945,11 @@ A <ref>foo</ref> B
 C <ref>bar</ref> D
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B
-C <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B
+C <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
-<li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
+<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">foo</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">bar</span></li>
 </ol>
 !!end
 
 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
 
 
-<p>b<!--the newline at the end of this line stays inside the p tag--> <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
-<span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
+<p>b<!--the newline at the end of this line stays inside the p tag--> <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
+<span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
 
 <p>c</p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li>
-<li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
+<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"></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"></span></li></ol>
 !!end
 
 !!test
@@ -22785,11 +22984,11 @@ Ref: 13. ref-tags are not SOL-transparent and block indent-pres
 </ref> B
 <references />
 !! html/parsoid
-<p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> A
-<span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
+<p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> A
+<span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
-<li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
+<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">foo</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">bar
 </span></li>
 </ol>
 !!end
@@ -22804,9 +23003,9 @@ parsoid=wt2html
 
 <references />
 !! html/parsoid
-<p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span> baz&lt;/ref></p>
+<p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span> baz&lt;/ref></p>
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo &lt;ref>bar</span></li></ol>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./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" data-parsoid="{}">foo &lt;ref>bar</span></li></ol>
 !! end
 
 !!test
@@ -22817,10 +23016,10 @@ B1 <ref name="b" /> B2 <ref name="b">bar</ref>
 
 <references />
 !! html/parsoid
-<p>A1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a-1"},"attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span> A2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
-B1 <span about="#mwt7" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span> B2 <span about="#mwt8" class="mw-ref" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
+<p>A1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a-1"},"attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span> A2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
+B1 <span about="#mwt7" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span> B2 <span about="#mwt8" class="mw-ref" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
 </ol>
 !!end
 
@@ -22834,24 +23033,24 @@ A <ref >foo</ref >
 
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
+<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">foo</span></li></ol>
 !!end
 
 !!test
 Ref: 17. Generate valid HTML5 id/about attributes
 !!wikitext
 <ref name="a b">foo</ref>
+<ref name=":0">ve-created name</ref>
 
 <references />
 !!html/parsoid
-<p><span class="mw-ref" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1"><span class="mw-reflink-text">[1]</span></a></span>
-</p>
+<p><span about="#mwt2" class="mw-ref" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="./Main_Page#cite_note-a_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span>
+<span about="#mwt4" class="mw-ref" id="cite_ref-:0_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-:0-2"},"attrs":{"name":":0"}}'><a href="./Main_Page#cite_note-:0-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></span>
+
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="./Main_Page#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li><li about="#cite_note-:0-2" id="cite_note-:0-2"><a href="./Main_Page#cite_ref-:0_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-:0-2" class="mw-reference-text">ve-created name</span></li></ol>
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li>
-</ol>
 !!end
 
 !!test
@@ -22861,11 +23060,11 @@ Ref: 18. T58916: Extension attributes should be parsed as plain text
 
 <references />
 !!html/parsoid
-<p><span class="mw-ref" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
+<p><span class="mw-ref" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="./Main_Page#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
 </p>
 
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
+<li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="./Main_Page#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
 </ol>
 !!end
 
@@ -22876,10 +23075,10 @@ Ref: 19. ref-tags with identical name encodings should get identical indexes
 
 <references />
 !! html/parsoid
-<p>1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"attrs":{"name":"a &amp; b"}}'><a href="#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span> 2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
+<p>1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"attrs":{"name":"a &amp; b"}}'><a href="./Main_Page#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span> 2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="./Main_Page#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
 </p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-a_.26_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
+<li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-a_.26_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
 </ol>
 !!end
 
@@ -22892,11 +23091,11 @@ C <ref name="foo" />
 
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
-B <span about="#mwt4" class="mw-ref" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
-C <span about="#mwt6" class="mw-ref" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
+B <span about="#mwt4" class="mw-ref" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
+C <span about="#mwt6" class="mw-ref" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Main_Page#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
 </ol>
 !!end
 
@@ -22919,18 +23118,18 @@ C <ref>baz</ref>
 <references />
 <references group="b" />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
-B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
-C <span class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
+B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="./Main_Page#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
+C <span class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="./Main_Page#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
 
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
+<li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
 </ol>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-3" id="cite_note-3"><a href="#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
+<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">baz</span></li>
 </ol>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
-<li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
+<li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
 </ol>
 !!end
 
@@ -22945,15 +23144,15 @@ B <ref>bar</ref>
 
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./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">foo</span></li>
 </ol>
 
-<p>B <span about="#mwt6" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>B <span about="#mwt6" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
 
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</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">bar</span></li>
 </ol>
 !!end
 
@@ -22969,15 +23168,15 @@ C <ref>cfoo</ref>
 
 <references />
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
-B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
+B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
 </ol>
 
-<p>C <span about="#mwt8" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
+<p>C <span about="#mwt8" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="./Main_Page#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><a href="#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><a href="./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">bfoo</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">cfoo</span></li>
 </ol>
 !!end
 
@@ -22995,11 +23194,11 @@ B <ref name="b">bar</ref>
 This should just get lost.
 </references>
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
-B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
+B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
 
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>\n"}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"./Main_Page#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>\n"}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="./Main_Page#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Main_Page#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
 </ol>
 !! end
 
@@ -23008,7 +23207,7 @@ References: 6. <references /> from a transclusion
 !! wikitext
 <ref>Foo</ref> {{echo|<references />}}
 !! html/parsoid
-<p><span about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p> <ol class="mw-references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
+<p><span about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p> <ol class="mw-references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><a href="./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">Foo</span></li>
 </ol>
 !! end
 
@@ -23024,16 +23223,16 @@ B <ref group="X" name="b" />
 <ref name="b">foo</ref>
 </references>
 !! html/parsoid
-<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
-B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
+<p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
+B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="./Main_Page#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
 </p>
 
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li>
+<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">foo bar for a</span></li>
 </ol>
 
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
-<li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"./Main_Page#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
+<li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Main_Page#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
 </ol>
 !! end
 
@@ -23043,8 +23242,8 @@ References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself
 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
 <references />
 !! html/parsoid
-<p>X<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
+<p>X<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./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">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
 </ol>
 !!end
 
@@ -23058,12 +23257,12 @@ References: 9. Generate missing references list at the end
 A <ref>foo</ref>
 B <ref group="inexistent">bar</ref>
 !! html/parsoid
-<p>A <span class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B <span class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
+<p>A <span class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B <span class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="./Main_Page#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
+<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">foo</span></li>
 </ol>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
-<li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
+<li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
 </ol>
 !! end
 
@@ -23089,9 +23288,9 @@ Entities in ref name
 <ref name="test &amp; me">hi</ref>
 <references />
 !! html/parsoid
-<p><span about="#mwt2" class="mw-ref" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp;amp; me"}}'><a href="#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p><span about="#mwt2" class="mw-ref" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp;amp; me"}}'><a href="./Main_Page#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="#cite_ref-test_.26_me_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
+<li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="./Main_Page#cite_ref-test_.26_me_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
 </ol>
 !! end
 
@@ -23109,10 +23308,10 @@ a<ref>foo</ref>
 
 <references>
 !! html/parsoid
-<p>a<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>a<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
 
 <p>&lt;references></p>
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><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">foo</span></li></ol>
 !! end
 
 !! test
@@ -23126,6 +23325,43 @@ foo
 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
 !! end
 
+#### ----------------------------------------------------------------
+#### Parsoid-only testing of Parsoid's impl of LST
+#### Not implemented yet, see
+#### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
+#### ----------------------------------------------------------------
+
+## We still need to support serializing the older format while content is stored.
+!! test
+LST Sections: Backwards compatibility
+!! options
+parsoid={
+  "suppressErrors": true,
+  "modes": ["html2wt"]
+}
+!! wikitext
+<section begin="2011-05-16" />
+<section end="2014-04-10 (MW 1.23wmf22)" />
+!! html/parsoid
+<p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
+<meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
+!! end
+
+## The unconventional output is the result of `usePHPPreProcessor` being
+## disabled in parserTests.js.  This test is mainly just to show <section> is
+## recognized as an extension tag w/o a native handler.
+!! test
+LST Sections: Newfangled approach
+!! options
+parsoid={ "suppressErrors": true }
+!! wikitext
+<section begin="2011-05-16" />
+<section end="2014-04-10 (MW 1.23wmf22)" />
+!! html/parsoid
+<p><span typeof="mw:Extension/section" about="#mwt1" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section begin=\"2011-05-16\" />","tagWidths":[30,0]}'>&lt;section begin="2011-05-16" /></span>
+<span typeof="mw:Extension/section" about="#mwt2" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section end=\"2014-04-10 (MW 1.23wmf22)\" />","tagWidths":[43,0]}'>&lt;section end="2014-04-10 (MW 1.23wmf22)" /></span></p>
+!! end
+
 #--------- Test stripping of empty nodes in template content ----------
 !!test
 Empty LI and TR nodes should be stripped from template content
@@ -24194,7 +24430,7 @@ parsoid=html2wt
 !! end
 
 !! test
-Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
+Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -24229,7 +24465,7 @@ http://example.com(x<nowiki/>)
 !! end
 
 !! test
-Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
+Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
 !! options
 parsoid=html2wt
 !! html/parsoid
 !! end
 
 !! test
-Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
+Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -24280,7 +24516,7 @@ http://example.com.,;:!?\
 !! end
 
 !! test
-Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
+Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -24294,7 +24530,7 @@ X<nowiki/>RFC 123<nowiki/>y
 !! end
 
 !! test
-Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
+Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -24314,7 +24550,7 @@ RFC 123&foo
 !! end
 
 !! test
-Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
+Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -24328,7 +24564,7 @@ X<nowiki/>PMID 123<nowiki/>y
 !! end
 
 !! test
-Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
+Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -24348,7 +24584,7 @@ PMID 123&foo
 !! end
 
 !! test
-Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
+Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -24363,7 +24599,7 @@ a<nowiki/>ISBN 1234567890<nowiki/>b
 !! end
 
 !! test
-Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
+Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -24464,11 +24700,11 @@ 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":"echo","href":"./Template:Echo"},"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" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
+'<i>foo</i> <span class="mw-ref" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
 '<i>foo</i> <div title="name">test</div>
 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
+<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>
 !! wikitext
 '''a'' foo ''[[bar]]''
 !! options
 parsoid=html2wt
 !! html/parsoid
-<p>foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
+<p>foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
-<li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i>a</i>
+<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>
 !! wikitext
@@ -24809,7 +25045,7 @@ parsoid=html2wt
 
 ## The quote-char in the input is necessary for triggering the bug
 !! test
-(Bug 52035) Nowiki-escaping should not get tripped by " :" in text
+(T54035) Nowiki-escaping should not get tripped by " :" in text
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -25496,7 +25732,7 @@ parsoid=wt2html
 </table>
 !!end
 
-# Parsoid only for bug 64747
+# Parsoid only for T66747
 !! test
 Properly encapsulate empty-content transclusions in fosterable positions
 !! wikitext
@@ -25592,7 +25828,7 @@ http://en.wikipedia.org/wiki/Foobar
 
 # 'mi' is a localinterwiki prefix as well as a language
 !! test
-Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
+Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -25744,7 +25980,7 @@ parsoid={
 !!end
 
 !! test
-Image: Modifying alignment of an image (bug 48665)
+Image: Modifying alignment of an image (T50665)
 !! options
 parsoid={
   "modes": ["wt2wt"],
@@ -25760,7 +25996,7 @@ parsoid={
 !! end
 
 !! test
-Image: Modifying mw-default-size of an frameless image (bug 62805)
+Image: Modifying mw-default-size of an frameless image (T64805)
 !! options
 parsoid={
   "modes": ["wt2wt"],
@@ -25775,7 +26011,7 @@ parsoid={
 !! end
 
 !! test
-Image: Modifying valign of an image (bug 49221)
+Image: Modifying valign of an image (T51221)
 !! options
 parsoid={
   "modes": ["wt2wt"],
@@ -25791,7 +26027,7 @@ parsoid={
 !! end
 
 !! test
-Image: Modifying alt attribute of an image (bug 56400)
+Image: Modifying alt attribute of an image (T58400)
 !! options
 parsoid={
   "modes": ["wt2wt"],
@@ -25821,7 +26057,7 @@ parsoid={
 !!end
 
 !! test
-Image: empty alt attribute (bug 48924)
+Image: empty alt attribute (T50924)
 !! options
 parsoid
 !! wikitext
@@ -25831,7 +26067,7 @@ parsoid
 !! end
 
 !! test
-Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
+Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
 !! options
 parsoid=html2wt
 language=ar
@@ -26124,9 +26360,9 @@ parsoid={
   "scrubWikitext": true
 }
 !! html/parsoid
-<h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
+<h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./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="#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>
+<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> ==
@@ -26214,9 +26450,9 @@ 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" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
+<h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./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="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
+<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>
 
 <ul><li>asd
@@ -26436,7 +26672,7 @@ parsoid={
 #------------------------------
 
 !!test
-Bug 54262: New entities
+T56262: New entities
 !! options
 parsoid=html2wt
 !! html/parsoid
@@ -26828,7 +27064,8 @@ parsoid={
     [ "#h2", "html", "a\nb\n" ],
     [ "#c1", "html", "a\nb\n" ],
     [ "#c2", "html", "<p>a</p>" ],
-    [ "#c3", "html", "<p>a</p>" ]
+    [ "#c3", "html", "<p>a</p>" ],
+    [ "#c4", "html", "edit-me<p>a</p>" ]
   ]
 }
 !! wikitext
@@ -26842,6 +27079,8 @@ parsoid={
 | id="c2" |edit-me||4
 |-
 | id="c3" |edit-me||p||q||r
+|-
+| id="c4" |edit-me||p||q||r
 |}
 !! wikitext/edited
 {|
 |-
 | id="c3" |a
 |p||q||r
+|-
+| id="c4" |edit-me
+a
+|p||q||r
 |}
 !! end