jenkins-bot has submitted this change and it was merged. Change subject: Sync up with Parsoid parserTests. ......................................................................
Sync up with Parsoid parserTests. This now aligns with Parsoid commit 5c1681a53606e80522afc6e2496aaef2b30aad4c Change-Id: Ic871d300eec6ba268eceef6b1014884c763b0e1c --- M tests/parser/parserTests.txt 1 file changed, 200 insertions(+), 5 deletions(-) Approvals: Subramanya Sastry: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index b3e9c51..03e4959 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -1093,6 +1093,59 @@ </p> !! end +## a,rtc not permitted +## i,b,br omitted +!! test +Text-level semantic html elements in wikitext +!! wikitext +<em>text</em> +<strong>text</strong> +<small>text</small> +<s>text</s> +<cite>text</cite> +<q>text</q> +<dfn>text</dfn> +<abbr>text</abbr> +<data>text</data> +<time>text</time> +<code>text</code> +<var>text</var> +<samp>text</samp> +<kbd>text</kbd> +<sub>text</sub> +<u>text</u> +<mark>text</mark> +<ruby><rb>明日<rp>(</rp><rt>Ashita</rt><rp>)</rp></rb></ruby> +<bdi>text</bdi> +<bdo>text</bdo> +<span>text</span> +<wbr /> +!! html +<p><em>text</em> +<strong>text</strong> +<small>text</small> +<s>text</s> +<cite>text</cite> +<q>text</q> +<dfn>text</dfn> +<abbr>text</abbr> +<data>text</data> +<time>text</time> +<code>text</code> +<var>text</var> +<samp>text</samp> +<kbd>text</kbd> +<sub>text</sub> +<u>text</u> +<mark>text</mark> +<ruby><rb>明日<rp>(</rp><rt>Ashita</rt><rp>)</rp></rb></ruby> +<bdi>text</bdi> +<bdo>text</bdo> +<span>text</span> +<wbr /> +</p> +!! end + !! test Non-word characters don't terminate tag names (bug 17663, 40670, 52022) !! wikitext @@ -1221,6 +1274,16 @@ !! html <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&ndash;"}},"i":0}}]}'>–</span> </p> +!! end + +!! test +Properly escape nowiki when combined with other wiki markup +!! options +parsoid=html2wt +!! wikitext +<nowiki>* </nowiki></nowiki> tag +!! html +<p>* </nowiki> tag</p> !! end ### @@ -4458,6 +4521,16 @@ <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com<!-- hi -->"}}'>http://example.com</a>)</p> !! end +!! test +Replace invalid link targets when serializing +!! options +parsoid=html2wt +!! html +<a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a> +!! wikitext +[[MediaWiki:Badtitletext|Manual]] +!! end + ### ### Quotes ### @@ -5185,6 +5258,23 @@ !! end +!! test +Table-cell after a comment-only-empty-line +!! wikitext +{| +|a +<!--c1--> +<!--c2-->| b +|} +!! html/parsoid +<table> +<tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td> +<!--c1--> +<!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr> +</tbody></table> + +!! end + # The expected HTML structure in this test is debatable. The PHP parser does # not parse this kind of table at all. The main focus for Parsoid is on # round-tripping, so this output is ok for now. TODO: revisit! @@ -5348,6 +5438,54 @@ <p>foo</p></td></tr> </tbody></table> !!end + +!! test +Strip unsupported table tags +!! options +parsoid=html2wt +!! html +<table> +<thead> +<tr> +<th>Month</th> +<th>Savings</th> +</tr> +</thead> +<tbody> +<tr> +<td>January</td> +<td>$100</td> +</tr> +<tr> +<td>February</td> +<td>$80</td> +</tr> +</tbody> +<tfoot> +<tr> +<td>Sum</td> +<td>$180</td> +</tr> +</tfoot> +</table> +!! wikitext +{| + +!Month +!Savings + +|January +|$100 + +|- +|February +|$80 + +|Sum +|$180 + +|} +!! end ### ### Internal links @@ -19399,6 +19537,47 @@ b</p> !! end +!! test +2. Leading whitespace in non-indent-pre contexts should not be escaped +!! options +parsoid +!! wikitext +foo <ref>''a'' + b</ref> +!! html +<p>foo <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"<i data-parsoid='{\"dsr\":[9,14,2,2]}'>a</i>\n b"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p> +!! end + +!! test +3. Leading whitespace in indent-pre suppressing contexts should not be escaped +!! options +parsoid +!! wikitext +<blockquote> + a + <span>b</span> + c +</blockquote> +!! html +<blockquote> +<p> + a + <span>b</span> + c</p> +</blockquote> +!! end + +!! test +4. Leading whitespace in indent-pre suppressing contexts should not be escaped +!! options +parsoid +!! wikitext + [[File:Foobar.jpg|thumb|caption]] +!! html +!! 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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure> +!! end + #### --------------- Behavior Switches -------------------- !! test 1. Valid behavior switches should be escaped @@ -19406,8 +19585,10 @@ parsoid=html2wt !! wikitext <nowiki>__TOC__</nowiki> +''<nowiki>__TOC__</nowiki>'' !! html __TOC__ +<i>__TOC__</i> !! end !! test @@ -19798,6 +19979,20 @@ <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr> </tbody></table> !!end + +!! test +Indent and comment before table row +!! wikitext +{| + <!--hi-->|- + | there +|} +!! html/parsoid +<table data-parsoid='{}'> + <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'> + <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr> +</tbody></table> +!! end !!test Empty TR followed by a template-generated TR @@ -20470,21 +20665,21 @@ !! end !! test -Strip leading whitespace when handling indent-pre inducing tags +Nowiki-wrap leading whitespace when handling indent-pre inducing tags !! options parsoid=html2wt !! wikitext foo -<span>bar</span> +<nowiki> </nowiki><span>bar</span> <span>foo2 -</span>bar2 +<nowiki> </nowiki></span>bar2 <div>foo</div> -<span>bar</span> +<nowiki> </nowiki><span>bar</span> <div> -<span>foo</span> +<nowiki> </nowiki><span>foo</span> </div> !! html <p>foo</p> -- To view, visit https://gerrit.wikimedia.org/r/141743 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic871d300eec6ba268eceef6b1014884c763b0e1c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Cscott <canan...@wikimedia.org> Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org> Gerrit-Reviewer: Cscott <canan...@wikimedia.org> Gerrit-Reviewer: GWicke <gwi...@wikimedia.org> Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits