# ill add inter-language links
# (ignored by Parsoid, since it emits <link>s)
# subpage enable subpages (disabled by default)
-# noxml don't check for XML well-formedness
# title=[[XXX]] run test using article title XXX
# language=XXX set content language to XXX for this test
# variant=XXX set the variant of language for this test (eg zh-tw)
<span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a }"}},"i":0}}]}" about="#mwt5"></span></p>
!! wikitext
{{echo|a [ b}}
-{{echo|a <nowiki>}}</nowiki> b}}
+{{echo|<nowiki>a }} b</nowiki>}}
{{echo|<nowiki>a [[ b</nowiki>}}
-{{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
+{{echo|<nowiki>a | {{ ]]</nowiki>}}
{{echo|a <nowiki>}</nowiki>}}
!! end
</p>
!! end
-## PHP parser discards the "<pre " string
!! test
Handle broken pre-like tags (bug 64025)
!! options
<table><pre </table>
!! html/php
<pre>x</pre>
-<table><pre></pre></table>
+<table><pre </table>
+!! html/php+tidy
+<pre>
+x
+</pre>
+<p><pre</p>
!! html/parsoid
<pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"<pre":null},"sa":{"<pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<pre <pre>x</pre>"}},"i":0}}]}'>x</pre>
!! wikitext
External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
!! html
-<p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
+<p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
</p>
!! end
!! wikitext
External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
!! html
-<p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
+<p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
</p>
!! end
!! wikitext
ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
!! html/php
-<p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
+<p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
</p>
!! html/parsoid
<p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
<td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
!! end
+!! test
+Element attributes with double ! should not be broken up by <th>
+!! wikitext
+{|
+! hi <div class="!!">ha</div> ho
+|}
+!! html/php
+<table>
+<tr>
+<th> hi <div class="!!">ha</div> ho
+</th></tr></table>
+
+!! html/parsoid
+<table>
+<tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
+</tbody></table>
+!! end
+
!! test
! and || in element attributes should not be parsed as <th>/<td>
!! wikitext
!! test
Table attributes with empty value
+!! options
+parsoid=wt2html,html2html
!! wikitext
{|
| style=| hello
!! html/parsoid
<table>
-<tbody>
-<tr>
-<td style=""> hello
-</td></tr></tbody></table>
-
+<tbody><tr><td style=""> hello</td></tr>
+</tbody></table>
!! end
!! test
!! wikitext
{{echo|{{ }}}}
!! html/parsoid
-<p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
+<p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
!! end
!! article
{|
| testing [[one|two]] | three || four
| testing one two | three || four
+| testing="[[one|two]]" | three || four
|}
!! html/php
<table>
</td>
<td> three </td>
<td> four
+</td>
+<td> testing="<a href="/index.php?title=One&action=edit&redlink=1" class="new" title="One (page does not exist)">two</a>" | three </td>
+<td> four
</td></tr></table>
!! html/parsoid
<table>
<tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
-<td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
+<td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
+<td> testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
</tbody></table>
!! end
!! test
pre-save transform: unclosed tag
!! options
-pst noxml
+pst
!! wikitext
<nowiki>'''not wiki'''
!! html/php
!! test
pre-save transform: mixed tag case
!! options
-pst noxml
+pst
!! wikitext
<NOwiki>'''not wiki'''</noWIKI>
!! html/php
!! test
pre-save transform: unclosed comment in <nowiki>
!! options
-pst noxml
+pst
!! wikitext
wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
!! html/php
<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
+Localized image handling (3).
+!! options
+language=fa
+parsoid=html2wt
+!! 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></figure>
+!! wikitext
+[[File:Foobar.jpg|بندانگشتی]]
+!! end
+
!! test
"border", "frameless" and "class" attributes on an image.
!! options
!! test
div with empty attribute value, space before equals
+!! options
+parsoid=wt2html,html2html
!! wikitext
<div class =>HTML rocks</div>
-!! html
+!! html/php
<div class="">HTML rocks</div>
+!! html/parsoid
+<div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
!! end
-# FIXME: Parsoid doesn't match the html5 spec
!! test
div with multiple empty attribute values
!! options
<div id="title.3D">HTML rocks</div>
!! html/parsoid
-<div id="" title="">HTML rocks</div>
+<div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
!! end
-# FIXME: Parsoid doesn't match the html5 spec
!! test
table with multiple empty attribute values
!! options
</td></tr></table>
!! html/parsoid
-<table title="" id="">
+<table title="id=">
<tbody><tr><td> hi</td></tr>
</tbody></table>
!! end
!! test
Attribute test: equals, then nothing
+!! options
+parsoid=wt2html,html2html
!! wikitext
<font color=>foo</font>
-!! html
+!! html/php
<p><font color="">foo</font>
</p>
+!! html/parsoid
+<p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
!! end
!! test
Attribute test: unquoted value
+!! options
+parsoid=wt2html,html2html
!! wikitext
<font color=x>foo</font>
-!! html
+!! html/php
<p><font color="x">foo</font>
</p>
+!! html/parsoid
+<p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
!! end
!! test
!! test
Parser hook: nested tags
-!! options
-noxml
!! wikitext
<tag><tag></tag></tag>
!! html/php
!! test
Fuzz testing: Parser14-table
+!! options
+parsoid=wt2html,html2html
!! wikitext
==a==
{| STYLE=__TOC__
<td></td>
</tr>
</table>
+!! html/parsoid
+<h2>a</h2>
+<table style="__TOC__"></table>
!! end
# Known to produce bogus xml (extra </td>)
!! test
Fuzz testing: Parser16
-!! options
-noxml
!! wikitext
{|
!https://||||||
# Known to produce bad XML for now
!! test
Fuzz testing: Parser24
-!! options
-noxml
!! wikitext
{|
{{{|
!! test
Section extraction, <pre> around bogus header (bug 10309)
!! options
-noxml section=2
+section=2
!! wikitext
== Section One ==
<pre>
!! test
Section replacement, <pre> around bogus header (bug 10309)
!! options
-noxml replace=2,"xxx"
+replace=2,"xxx"
!! wikitext
== Section One ==
<pre>
!! wikitext
http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
!! html
-<p><img src="http://www.example.org/pic.png" alt="pic.png" /> <-- U+3000 (vim: ^Vu3000)
+<p><img src="http://www.example.org/pic.png" alt="pic.png"/> <-- U+3000 (vim: ^Vu3000)
</p>
!! end
<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 typeof="mw:Nowiki">}}</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="#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>
</ol>
# This test only works in wt2html now as the <references /> are always generated
# unless selser is active. Once T72722 is fixed, we should add a changes test
-# here to ensure that unrelated changes don't add the new <references /> in
-# wt2wt.
+# here to ensure that unrelated changes don't add the new <references />
+# when selser is active.
!! test
References: 9. Generate missing references list at the end
!! wikitext
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>
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
+<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>
</ol>
-<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
+<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>
</ol>
!! end
!! end
-!! test
-2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
-!! options
-parsoid
-!! wikitext
-{{}}
-!! html
-{{}}
-!! end
-
-!! test
-1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
-!! options
-parsoid
-!! wikitext
-}}{{
-!! html
-}}{{
-!! end
-
!!test
Accept empty td cell attribute
!! wikitext
!! wikitext
<span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
!! html/php
-<p><span>MediaWiki</span>
+<p><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
</p>
!! html/parsoid
<p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>