jenkins-bot has submitted this change and it was merged.
Change subject: Updated wikitext-escaping tests to reflect Parsoid's latest
output
......................................................................
Updated wikitext-escaping tests to reflect Parsoid's latest output
* Changed wikitext (input) portion of several html2wt-centric tests
to match how Parsoid adds the nowiki tags. We are not as concerned
about the wt -> html direction.
* Changed 'disabled' flag to 'parsoid' on several tests since that was
the original intention of these disabled tests. Since then, we have
the parsoid option to indicate the same thing which is more accurate
than 'disabled'.
* Added few more escaping tests based on recent Parsoid fixes and
discovery of new bugs.
* Disabled one test known to not pass because of absence of
data-parsoid flags.
Change-Id: Icd10a9bccbcc27715914b9f00a20afb06ed275d1
---
M tests/parser/parserTests.txt
1 file changed, 115 insertions(+), 67 deletions(-)
Approvals:
GWicke: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 0631196..a587a76 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -3665,7 +3665,7 @@
!! test
Table attributes with empty value
!! options
-disabled
+parsoid
!! input
{|
| style=| hello
@@ -4756,9 +4756,9 @@
!! test
Unbalanced closing block tags break a list
-(Disabled since php parser generates broken html -- relies on Tidy to fix up)
+(Parsoid-only since php parser generates broken html -- relies on Tidy to fix
up)
!! options
-disabled
+parsoid
!! input
<div>
*a</div><div>
@@ -4773,9 +4773,9 @@
!! test
Unbalanced closing non-block tags don't break a list
-(Disabled since php parser generates broken html -- relies on Tidy to fix up)
+(Parsoid-only since php parser generates broken html -- relies on Tidy to fix
up)
!! options
-disabled
+parsoid
!! input
<span>
*a</span><span>
@@ -4790,9 +4790,9 @@
!! test
Unclosed formatting tags that straddle lists are closed and reopened
-(Disabled since php parser generates broken html -- relies on Tidy to fix up)
+(Parsoid-only since php parser generates broken html -- relies on Tidy to fix
up)
!! options
-disabled
+parsoid
!! input
# <s> a
# b </s>
@@ -6532,7 +6532,7 @@
Templates: Ugly nesting: 2. Quotes opened/closed across templates
(echo_with_span)
(PHP parser generates misnested html)
!! options
-disabled
+parsoid
!!input
{{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
!!result
@@ -6543,7 +6543,7 @@
Templates: Ugly nesting: 3. Quotes opened/closed across templates
(echo_with_div)
(PHP parser generates misnested html)
!! options
-disabled
+parsoid
!!input
{{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
!!result
@@ -8595,7 +8595,7 @@
!! test
div with empty attribute value, space before equals
!! options
-disabled
+parsoid
!! input
<div class =>HTML rocks</div>
!! result
@@ -8608,7 +8608,7 @@
!! test
div with braces in attribute value
!! options
-disabled
+parsoid
!! input
<div title="{}">Foo</div>
!! result
@@ -8625,7 +8625,7 @@
!! test
div with empty attribute value, no space before equals
!! options
-disabled
+parsoid
!! input
<div class=>HTML rocks</div>
!! result
@@ -13573,7 +13573,7 @@
!!test
1. SOL-sensitive wikitext tokens as template-args
!!options
-disabled
+parsoid
!!input
{{echo|*a}}
{{echo|#a}}
@@ -13586,12 +13586,15 @@
!!end
#### The following section of tests are primarily to test
-#### wikitext escaping capabilities of Parsoid.
-#### A lot of the tests are disabled for the PHP parser either
-#### because of minor newline diffs or other reasons.
-#### As Parsoid serializer can handle newlines and other HTML
-#### more robustly, some of these tests might get reenabled
-#### for the PHP parser.
+#### wikitext escaping capabilities of Parsoid. Given that
+#### escaping can be done any number of ways, the wikitext (input)
+#### is always adjusted to reflect how Parsoid adds nowiki
+#### escape tags.
+####
+#### We are marking several tests as parsoid-only since the
+#### HTML in the result section is different from what the
+#### PHP parser generates for it.
+
#### --------------- Headings ---------------
#### 0. Unnested
@@ -13604,12 +13607,20 @@
#### ----------------------------------------
!! test
Headings: 0. Unnested
+!! options
+parsoid
!! input
<nowiki>=foo=</nowiki>
-<nowiki>=foo</nowiki>''a''=
+<nowiki> =foo= </nowiki>
+<!--cmt-->
+<nowiki>=foo=</nowiki>
+
+=foo''a''<nowiki>=</nowiki>
!! result
<p>=foo=
+</p><p> =foo=
+</p><p><!--cmt-->=foo=
</p><p>=foo<i>a</i>=
</p>
!!end
@@ -13617,7 +13628,7 @@
!! test
Headings: 1. Nested inside html
!! options
-disabled
+parsoid
!! input
=<nowiki>=foo=</nowiki>=
==<nowiki>=foo=</nowiki>==
@@ -13637,7 +13648,7 @@
!! test
Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
!! options
-disabled
+parsoid
!! input
=foo=
<nowiki>*bar</nowiki>
@@ -13654,44 +13665,64 @@
!! test
Headings: 3. Nested inside html with wikitext split by html tags
!! options
-disabled
+parsoid
!! input
-=<nowiki>=</nowiki>'''bold'''foo==
+=='''bold'''<nowiki>foo=</nowiki>=
!! result
<h1>=<b>bold</b>foo=</h1>
!!end
!! test
-Headings: 4. No escaping needed (testing just h1 and h2)
+Headings: 4a. No escaping needed (testing just h1 and h2)
!! options
-disabled
+parsoid
!! input
==foo=
=foo==
+= =foo= =
+==foo= bar=
===foo==
==foo===
=''=''foo==
-===
+=<nowiki>=</nowiki>=
!! result
<h1>=foo</h1>
<h1>foo=</h1>
+<h1> =foo= </h1>
+<h1>=foo= bar</h1>
<h2>=foo</h2>
<h2>foo=</h2>
<h1><i>=</i>foo=</h1>
<h1>=</h1>
+
+!!end
+
+!! test
+Headings: 4b. No escaping needed (inside p-tags)
+!! options
+parsoid
+!! input
+===
+=foo= x
+=foo= <s></s>
+!! result
+<p>===
+=foo= x
+=foo= <s></s>
+</p>
!!end
!! test
Headings: 5. Empty headings
!! options
-disabled
+parsoid
!! input
-=<nowiki></nowiki>=
-==<nowiki></nowiki>==
-===<nowiki></nowiki>===
-====<nowiki></nowiki>====
-=====<nowiki></nowiki>=====
-======<nowiki></nowiki>======
+=<nowiki/>=
+==<nowiki/>==
+===<nowiki/>===
+====<nowiki/>====
+=====<nowiki/>=====
+======<nowiki/>======
!! result
<h1></h1>
<h2></h2>
@@ -13704,11 +13735,13 @@
!! test
Headings: 6. Heading chars in SOL context
!! options
-disabled
+parsoid
!! input
<!--cmt--><nowiki>=h1=</nowiki>
+<!--cmt--><nowiki> =h1= </nowiki>
!! result
<p><!--cmt-->=h1=
+<!--cmt--> =h1=
</p>
!!end
@@ -13814,7 +13847,7 @@
!! test
Lists: 4. No escapes needed
!! options
-disabled
+parsoid
!! input
*foo*bar
@@ -13839,9 +13872,11 @@
*[[bar <span><nowiki>[[foo]]</nowiki></span>
-*<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
+*]]bar <span><nowiki>[[foo]]</nowiki></span>
*=bar <span>foo]]</span>=
+
+* <s></s>: a
!! result
<ul><li> bar <span>[[foo]]</span>
</li></ul>
@@ -13853,13 +13888,15 @@
</li></ul>
<ul><li>=bar <span>foo]]</span>=
</li></ul>
+<ul><li> <s></s>: a
+</li></ul>
!!end
!! test
Lists: 6. Escape bullets in SOL position
!! options
-disabled
+parsoid
!! input
<!--cmt--><nowiki>*foo</nowiki>
!! result
@@ -13885,14 +13922,11 @@
!! test
HRs: 1. Single line
!! options
-disabled
+parsoid
!! input
-----
-<nowiki>----</nowiki>
-----
-<nowiki>=foo=</nowiki>
-----
-<nowiki>*foo</nowiki>
+----<nowiki>----</nowiki>
+----=foo=
+----*foo
!! result
<hr/>----
<hr/>=foo=
@@ -13959,7 +13993,7 @@
!! test
Tables: 2a. Nested in td
!! options
-disabled
+parsoid
!! input
{|
|<nowiki>foo|bar</nowiki>
@@ -13974,7 +14008,7 @@
!! test
Tables: 2b. Nested in td
!! options
-disabled
+parsoid
!! input
{|
|<nowiki>foo||bar</nowiki>
@@ -13991,7 +14025,7 @@
!! test
Tables: 2c. Nested in td -- no escaping needed
!! options
-disabled
+parsoid
!! input
{|
|foo!!bar
@@ -14006,7 +14040,7 @@
!! test
Tables: 3a. Nested in th
!! options
-disabled
+parsoid
!! input
{|
!foo!bar
@@ -14021,7 +14055,7 @@
!! test
Tables: 3b. Nested in th
!! options
-disabled
+parsoid
!! input
{|
!<nowiki>foo!!bar</nowiki>
@@ -14036,10 +14070,10 @@
!! test
Tables: 3c. Nested in th -- no escaping needed
!! options
-disabled
+parsoid
!! input
{|
-!foo||bar
+!<nowiki>foo||bar</nowiki>
|}
!! result
<table>
@@ -14051,7 +14085,7 @@
!! test
Tables: 4a. Escape -
!! options
-disabled
+parsoid
!! input
{|
|-
@@ -14069,7 +14103,7 @@
!! test
Tables: 4b. Escape +
!! options
-disabled
+parsoid
!! input
{|
|-
@@ -14087,7 +14121,7 @@
!! test
Tables: 4c. No escaping needed
!! options
-disabled
+parsoid
!! input
{|
|-
@@ -14104,8 +14138,16 @@
</tbody></table>
!! end
+### SSS FIXME: Disabled right now because accurate html2wt
+### on this snippet requires data-parsoid flags that we've
+### stripped out of these tests. We should scheme how we
+### we want to handle these kind of tests that require
+### data-parsoid flags for accurate html2wt serialization
+
!! test
Tables: 4d. No escaping needed
+!! options
+disabled
!! input
{|
||+1
@@ -14131,7 +14173,7 @@
!! test
Links 1. Quote marks in link text
!! options
-disabled
+parsoid
!! input
[[Foo|<nowiki>Foo''boo''</nowiki>]]
!! result
@@ -14141,15 +14183,18 @@
!! test
Links 2. WikiLinks: Escapes needed
!! options
-disabled
+parsoid
!! input
[[Foo|<nowiki>[Foobar]</nowiki>]]
[[Foo|<nowiki>Foobar]</nowiki>]]
-[[Foo|<nowiki>x [Foobar] x</nowiki>]]
+[[Foo|x [Foobar] x]]
[[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
[[Foo|<nowiki>[[Bar]]</nowiki>]]
[[Foo|<nowiki>x [[Bar]] x</nowiki>]]
[[Foo|<nowiki>|Bar</nowiki>]]
+[[Foo|<nowiki>]]bar</nowiki>]]
+[[Foo|<nowiki>[[bar</nowiki>]]
+[[Foo|<nowiki>x ]] y [[ z</nowiki>]]
!! result
<a href="Foo" rel="mw:WikiLink">[Foobar]</a>
<a href="Foo" rel="mw:WikiLink">Foobar]</a>
@@ -14158,12 +14203,15 @@
<a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
<a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
<a href="Foo" rel="mw:WikiLink">|Bar</a>
+<a href="Foo" rel="mw:WikiLink">]]bar</a>
+<a href="Foo" rel="mw:WikiLink">[[bar</a>
+<a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
!! end
!! test
Links 3. WikiLinks: No escapes needed
!! options
-disabled
+parsoid
!! input
[[Foo|[Foobar]]
[[Foo|foo|bar]]
@@ -14175,7 +14223,7 @@
!! test
Links 4. ExtLinks: Escapes needed
!! options
-disabled
+parsoid
!! input
[http://google.com <nowiki>[google]</nowiki>]
[http://google.com <nowiki>google]</nowiki>]
@@ -14187,7 +14235,7 @@
!! test
Links 5. ExtLinks: No escapes needed
!! options
-disabled
+parsoid
!! input
[http://google.com [google]
!! result
@@ -14259,9 +14307,9 @@
[[bar <span><nowiki>[[foo]]</nowiki></span>
-<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
+]]bar <span><nowiki>[[foo]]</nowiki></span>
-<nowiki>=bar </nowiki><span>foo]]</span>=
+=bar <span>foo]]</span><nowiki>=</nowiki>
!! result
<p>bar <span>[[foo]]</span>
</p><p>=bar <span>[[foo]]</span>
@@ -14277,7 +14325,7 @@
!! test
1. Leading space in SOL context should be escaped
!! options
-disabled
+parsoid
!! input
<nowiki> foo</nowiki>
<!--cmt--><nowiki> foo</nowiki>
@@ -14295,7 +14343,7 @@
!! test
1. a tags
!! options
-disabled
+parsoid
!! input
<a href="http://google.com">google</a>
!! result
@@ -14335,8 +14383,8 @@
<p><nowiki>foo</nowiki>
</p>
!! end
-
!! test
+
Tag-like HTML structures are passed through as text
!! input
<x y>
@@ -14369,7 +14417,7 @@
!! test
Tag names followed by punctuation should not be recognized as tags
!! options
-disabled
+parsoid
!! input
<s.ome> text
!! result
--
To view, visit https://gerrit.wikimedia.org/r/60812
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icd10a9bccbcc27715914b9f00a20afb06ed275d1
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits