* 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
!! test
Table attributes with empty value
!! options
!! test
Table attributes with empty value
!! options
!! input
{|
| style=| hello
!! input
{|
| style=| hello
!! test
Unbalanced closing block tags break a list
!! 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)
!! input
<div>
*a</div><div>
!! input
<div>
*a</div><div>
!! test
Unbalanced closing non-block tags don't break a list
!! 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)
!! input
<span>
*a</span><span>
!! input
<span>
*a</span><span>
!! test
Unclosed formatting tags that straddle lists are closed and reopened
!! 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)
!! input
# <s> a
# b </s>
!! input
# <s> a
# b </s>
Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
(PHP parser generates misnested html)
!! options
Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
(PHP parser generates misnested html)
!! options
!!input
{{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
!!result
!!input
{{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
!!result
Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
(PHP parser generates misnested html)
!! options
Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
(PHP parser generates misnested html)
!! options
!!input
{{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
!!result
!!input
{{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
!!result
!! test
div with empty attribute value, space before equals
!! options
!! test
div with empty attribute value, space before equals
!! options
!! input
<div class =>HTML rocks</div>
!! result
!! input
<div class =>HTML rocks</div>
!! result
!! test
div with braces in attribute value
!! options
!! test
div with braces in attribute value
!! options
!! input
<div title="{}">Foo</div>
!! result
!! input
<div title="{}">Foo</div>
!! result
!! test
div with empty attribute value, no space before equals
!! options
!! test
div with empty attribute value, no space before equals
!! options
!! input
<div class=>HTML rocks</div>
!! result
!! input
<div class=>HTML rocks</div>
!! result
!!test
1. SOL-sensitive wikitext tokens as template-args
!!options
!!test
1. SOL-sensitive wikitext tokens as template-args
!!options
!!input
{{echo|*a}}
{{echo|#a}}
!!input
{{echo|*a}}
{{echo|#a}}
!!end
#### The following section of tests are primarily to test
!!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
#### --------------- Headings ---------------
#### 0. Unnested
#### ----------------------------------------
!! test
Headings: 0. Unnested
#### ----------------------------------------
!! test
Headings: 0. Unnested
!! input
<nowiki>=foo=</nowiki>
!! input
<nowiki>=foo=</nowiki>
-<nowiki>=foo</nowiki>''a''=
+<nowiki> =foo= </nowiki>
+<!--cmt-->
+<nowiki>=foo=</nowiki>
+
+=foo''a''<nowiki>=</nowiki>
+</p><p> =foo=
+</p><p><!--cmt-->=foo=
</p><p>=foo<i>a</i>=
</p>
!!end
</p><p>=foo<i>a</i>=
</p>
!!end
!! test
Headings: 1. Nested inside html
!! options
!! test
Headings: 1. Nested inside html
!! options
!! input
=<nowiki>=foo=</nowiki>=
==<nowiki>=foo=</nowiki>==
!! input
=<nowiki>=foo=</nowiki>=
==<nowiki>=foo=</nowiki>==
!! test
Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
!! options
!! test
Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
!! options
!! input
=foo=
<nowiki>*bar</nowiki>
!! input
=foo=
<nowiki>*bar</nowiki>
!! test
Headings: 3. Nested inside html with wikitext split by html tags
!! options
!! test
Headings: 3. Nested inside html with wikitext split by html tags
!! options
-=<nowiki>=</nowiki>'''bold'''foo==
+=='''bold'''<nowiki>foo=</nowiki>=
!! result
<h1>=<b>bold</b>foo=</h1>
!!end
!! test
!! 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)
===foo==
==foo===
=''=''foo==
===foo==
==foo===
=''=''foo==
!! result
<h1>=foo</h1>
<h1>foo=</h1>
!! 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>
<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
!!end
!! test
Headings: 5. Empty headings
!! options
-=<nowiki></nowiki>=
-==<nowiki></nowiki>==
-===<nowiki></nowiki>===
-====<nowiki></nowiki>====
-=====<nowiki></nowiki>=====
-======<nowiki></nowiki>======
+=<nowiki/>=
+==<nowiki/>==
+===<nowiki/>===
+====<nowiki/>====
+=====<nowiki/>=====
+======<nowiki/>======
!! result
<h1></h1>
<h2></h2>
!! result
<h1></h1>
<h2></h2>
!! test
Headings: 6. Heading chars in SOL context
!! options
!! test
Headings: 6. Heading chars in SOL context
!! options
!! input
<!--cmt--><nowiki>=h1=</nowiki>
!! input
<!--cmt--><nowiki>=h1=</nowiki>
+<!--cmt--><nowiki> =h1= </nowiki>
!! result
<p><!--cmt-->=h1=
!! result
<p><!--cmt-->=h1=
!! test
Lists: 4. No escapes needed
!! options
!! test
Lists: 4. No escapes needed
!! options
*[[bar <span><nowiki>[[foo]]</nowiki></span>
*[[bar <span><nowiki>[[foo]]</nowiki></span>
-*<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
+*]]bar <span><nowiki>[[foo]]</nowiki></span>
*=bar <span>foo]]</span>=
*=bar <span>foo]]</span>=
!! result
<ul><li> bar <span>[[foo]]</span>
</li></ul>
!! result
<ul><li> bar <span>[[foo]]</span>
</li></ul>
</li></ul>
<ul><li>=bar <span>foo]]</span>=
</li></ul>
</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
!!end
!! test
Lists: 6. Escape bullets in SOL position
!! options
!! input
<!--cmt--><nowiki>*foo</nowiki>
!! result
!! input
<!--cmt--><nowiki>*foo</nowiki>
!! result
!! test
HRs: 1. Single line
!! options
!! test
HRs: 1. Single line
!! options
-----
-<nowiki>----</nowiki>
-----
-<nowiki>=foo=</nowiki>
-----
-<nowiki>*foo</nowiki>
+----<nowiki>----</nowiki>
+----=foo=
+----*foo
!! result
<hr/>----
<hr/>=foo=
!! result
<hr/>----
<hr/>=foo=
!! test
Tables: 2a. Nested in td
!! options
!! test
Tables: 2a. Nested in td
!! options
!! input
{|
|<nowiki>foo|bar</nowiki>
!! input
{|
|<nowiki>foo|bar</nowiki>
!! test
Tables: 2b. Nested in td
!! options
!! test
Tables: 2b. Nested in td
!! options
!! input
{|
|<nowiki>foo||bar</nowiki>
!! input
{|
|<nowiki>foo||bar</nowiki>
!! test
Tables: 2c. Nested in td -- no escaping needed
!! options
!! test
Tables: 2c. Nested in td -- no escaping needed
!! options
!! test
Tables: 3a. Nested in th
!! options
!! test
Tables: 3a. Nested in th
!! options
!! test
Tables: 3b. Nested in th
!! options
!! test
Tables: 3b. Nested in th
!! options
!! input
{|
!<nowiki>foo!!bar</nowiki>
!! input
{|
!<nowiki>foo!!bar</nowiki>
!! test
Tables: 3c. Nested in th -- no escaping needed
!! options
!! test
Tables: 3c. Nested in th -- no escaping needed
!! options
+!<nowiki>foo||bar</nowiki>
!! test
Tables: 4a. Escape -
!! options
!! test
Tables: 4a. Escape -
!! options
!! test
Tables: 4b. Escape +
!! options
!! test
Tables: 4b. Escape +
!! options
!! test
Tables: 4c. No escaping needed
!! options
!! test
Tables: 4c. No escaping needed
!! options
+### 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
!! test
Tables: 4d. No escaping needed
!! test
Links 1. Quote marks in link text
!! options
!! test
Links 1. Quote marks in link text
!! options
!! input
[[Foo|<nowiki>Foo''boo''</nowiki>]]
!! result
!! input
[[Foo|<nowiki>Foo''boo''</nowiki>]]
!! result
!! test
Links 2. WikiLinks: Escapes needed
!! options
!! test
Links 2. WikiLinks: Escapes needed
!! options
!! input
[[Foo|<nowiki>[Foobar]</nowiki>]]
[[Foo|<nowiki>Foobar]</nowiki>]]
!! input
[[Foo|<nowiki>[Foobar]</nowiki>]]
[[Foo|<nowiki>Foobar]</nowiki>]]
-[[Foo|<nowiki>x [Foobar] x</nowiki>]]
[[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>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>
!! result
<a href="Foo" rel="mw:WikiLink">[Foobar]</a>
<a href="Foo" rel="mw:WikiLink">Foobar]</a>
<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">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
!! end
!! test
Links 3. WikiLinks: No escapes needed
!! options
!! input
[[Foo|[Foobar]]
[[Foo|foo|bar]]
!! input
[[Foo|[Foobar]]
[[Foo|foo|bar]]
!! test
Links 4. ExtLinks: Escapes needed
!! options
!! test
Links 4. ExtLinks: Escapes needed
!! options
!! input
[http://google.com <nowiki>[google]</nowiki>]
[http://google.com <nowiki>google]</nowiki>]
!! input
[http://google.com <nowiki>[google]</nowiki>]
[http://google.com <nowiki>google]</nowiki>]
!! test
Links 5. ExtLinks: No escapes needed
!! options
!! test
Links 5. ExtLinks: No escapes needed
!! options
!! input
[http://google.com [google]
!! result
!! input
[http://google.com [google]
!! result
[[bar <span><nowiki>[[foo]]</nowiki></span>
[[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>
!! result
<p>bar <span>[[foo]]</span>
</p><p>=bar <span>[[foo]]</span>
!! test
1. Leading space in SOL context should be escaped
!! options
!! test
1. Leading space in SOL context should be escaped
!! options
!! input
<nowiki> foo</nowiki>
<!--cmt--><nowiki> foo</nowiki>
!! input
<nowiki> foo</nowiki>
<!--cmt--><nowiki> foo</nowiki>
!! test
1. a tags
!! options
!! test
1. a tags
!! options
!! input
<a href="http://google.com">google</a>
!! result
!! input
<a href="http://google.com">google</a>
!! result
<p><nowiki>foo</nowiki>
</p>
!! end
<p><nowiki>foo</nowiki>
</p>
!! end
Tag-like HTML structures are passed through as text
!! input
<x y>
Tag-like HTML structures are passed through as text
!! input
<x y>
!! test
Tag names followed by punctuation should not be recognized as tags
!! options
!! test
Tag names followed by punctuation should not be recognized as tags
!! options
!! input
<s.ome> text
!! result
!! input
<s.ome> text
!! result