From 4bff1ccc98b96a88e7bbb744eafecc91ec23c146 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Fri, 19 Dec 2014 15:28:44 -0500 Subject: [PATCH] Sync up with Parsoid parserTests. This now aligns with Parsoid commit 2711026e89948a99f85182228563fdab8e2dfad3 Change-Id: I7e1e562273d2cdd5a4199971a975c2e674a519e9 --- tests/parser/parserTests.txt | 493 ++++++++++++++++++++++++----------- 1 file changed, 344 insertions(+), 149 deletions(-) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 63f6a759ef..f7dc0a90b5 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -540,8 +540,6 @@ Italics and bold: 2-quote opening sequence: (2,2) !! test Italics and bold: 2-quote opening sequence: (2,3) -!! options -parsoid=wt2html !! wikitext ''foo''' !! html/* @@ -549,16 +547,6 @@ parsoid=wt2html

!!end -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki -!! wikitext -''foo''' -!! html -

foo' -

-!! end - !! test Italics and bold: 2-quote opening sequence: (2,4) !! options @@ -615,8 +603,6 @@ Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki !! test Italics and bold: 3-quote opening sequence: (3,2) -!! options -parsoid=wt2html !! wikitext '''foo'' !! html/* @@ -624,16 +610,6 @@ parsoid=wt2html

!!end -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 3-quote opening sequence: (3,2) w/ nowiki -!! wikitext -'''foo'' -!! html -

'foo -

-!!end - !! test Italics and bold: 3-quote opening sequence: (3,3) !! wikitext @@ -645,8 +621,6 @@ Italics and bold: 3-quote opening sequence: (3,3) !! test Italics and bold: 3-quote opening sequence: (3,4) -!! options -parsoid=wt2html !! wikitext '''foo'''' !! html/* @@ -654,16 +628,6 @@ parsoid=wt2html

!!end -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki -!! wikitext -'''foo'''' -!! html -

foo' -

-!! end - # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test Italics and bold: 3-quote opening sequence: (3,5) @@ -720,8 +684,6 @@ Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki !! test Italics and bold: 4-quote opening sequence: (4,3) -!! options -parsoid=wt2html !! wikitext ''''foo''' !! html/* @@ -729,16 +691,6 @@ parsoid=wt2html

!!end -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 4-quote opening sequence: (4,3) w/ nowiki -!! wikitext -''''foo''' -!! html -

'foo -

-!!end - !! test Italics and bold: 4-quote opening sequence: (4,4) !! options @@ -849,16 +801,6 @@ parsoid=wt2html

!!end -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki -!! wikitext -'''''foo'''''' -!! html -

foo' -

-!! end - !! test Italics and bold: 5-quote opening sequence: (5,5) !! wikitext @@ -868,6 +810,15 @@ Italics and bold: 5-quote opening sequence: (5,5)

!!end +!! test +Italics and bold: 5-quote opening sequence: (5,6) +!! wikitext +'''''foo'''''' +!! html/* +

foo' +

+!! end + ### ### multiple quote sequences in a line ### @@ -1047,8 +998,6 @@ Italics and bold: other quote tests: (3,2,3+2+2,2) !! test Italics and bold: other quote tests: (3,2,3,3) -!! options -parsoid=wt2html !! wikitext '''this is about ''foo'''s family''' !! html/* @@ -1057,17 +1006,6 @@ parsoid=wt2html !!end -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: other quote tests: (3,2,3,3) w/ nowiki -!! wikitext -'''this is about ''foo'''s family''' -!! html -

'this is about foos family -

-!!end - - !! test Italics and bold: other quote tests: (3,(2,2),3) !! wikitext @@ -1082,9 +1020,11 @@ Italics and bold: other quote tests: (3,(2,2),3) Italicized possessive !! wikitext The ''[[Main Page]]'''s talk page. -!! html +!! html/php

The Main Page's talk page.

+!! html/parsoid +

The Main Page's talk page.

!! end !! test @@ -3966,6 +3906,76 @@ Definition Lists: Weird Ones: Test 1 !! end +!! test +Definition Lists: colons occurring in tags +!! wikitext +;a:b +;'''a:b''' +;a:b +;a:b +;
a:b
+;{{echo|a:b}} +;{{echo|''a:b''}} +!! html +
a
+
b
+
a:b
+
a:b
+
a:b
+
a:b
+
a
+
b
+
a:b
+ +!! end + +!! test +Definition Lists: colons and tables 1 +!! wikitext +:{| +| x +|} +:{| +| y +|} +!! html +
+ +
x +
+
+ +
y +
+ +!! end + +# Parsoid's output (as documented below) differs from php's in this case. +# This is probably a bug. If we fixup parsoid to match php's output, the +# above test should pass and the below test case can be removed. It is +# unclear which output is more desirable. + +!! test +Definition Lists: colons and tables 2 +!! wikitext +:{| +| x +|} +:{| +| y +|} +!! html/parsoid +
+ +
x +
+
+ +
y +
+!! end + + ### ### External links ### @@ -20004,17 +20014,15 @@ parsoid=html2wt !! test Headings: 3. Nested inside html with wikitext split by html tags !! options -parsoid=html2wt +parsoid=html2wt,wt2wt !! wikitext = ='''bold'''foo= = -!! html -

=boldfoo=

+!! html/parsoid +

=boldfoo=

!!end !! test Headings: 4a. No escaping needed (testing just h1 and h2) -!! options -parsoid=html2wt !! wikitext = =foo = @@ -20028,20 +20036,28 @@ parsoid=html2wt == foo= == -= ''=''foo= = - -= = = -!! html += = = +!! html/parsoid

=foo

foo=

=foo=

=foo= bar

=foo

foo=

-

=foo=

-

=

+

=

!!end +!! test +Headings: 4a'. No escaping needed (Parsoid bug T84903) +!! wikitext += ''=''foo= = +!! html/php +

=foo=[edit]

+ +!! html/parsoid +

=foo=

+!! end + !! test Headings: 4b. No escaping needed (inside p-tags) !! options @@ -20288,33 +20304,36 @@ Lists: 5. No unnecessary escapes !! wikitext * bar [[foo]] -*=bar [[foo]] +* =bar [[foo]] -*[[bar [[foo]] +* [[bar [[foo]] -*]]bar [[foo]] +* ]]bar [[foo]] -*=bar foo]]= +* =bar foo]]= * : a + +* ''* foo'' !! html
  • bar [[foo]]
-
  • =bar [[foo]]
-
  • [[bar [[foo]]
-
  • ]]bar [[foo]]
-
  • =bar foo]]=
+
  • =bar [[foo]]
+
  • [[bar [[foo]]
+
  • ]]bar [[foo]]
+
  • =bar foo]]=
  • : a
+
  • * foo
!!end !! test Lists: 6. Escape bullets in SOL position !! options -parsoid +parsoid=html2wt !! wikitext -*foo +*foo !! html -

*foo

+

*foo

!!end !! test @@ -20328,22 +20347,33 @@ a

!!end +!! test +Lists: 8. Escape colons only if not present in tags +!! options +parsoid=html2wt +!! wikitext +; a:b''c:d'' +!! html +
a:bc:d
+!! end + #### --------------- HRs --------------- #### 1. Single line #### ----------------------------------- !! test HRs: 1. Single line -!! options -parsoid !! wikitext -------- ----=foo= ----*foo -!! html -

----

-

=foo=

-

*foo

+!! html+tidy +
+

----

+
+

=foo=

+
+

*foo

!! end #### --------------- Tables --------------- @@ -20407,127 +20437,196 @@ Tables: 1d. No escaping needed Tables: 2a. Nested in td !! options parsoid=html2wt +!! html/parsoid + + + +
foo|bar
x
a|b
!! wikitext {| |foo|bar |- |x
a|b
|} -!! html - - - -
foo|bar
x
a|b
+!! html/php+tidy + + + + + + + +
foo|bar
x +
a|b
+
!! end !! test Tables: 2b. Nested in td !! options -parsoid +parsoid=html2wt +!! html/parsoid + + + + +
foo||barab||ca
b||c
!! wikitext {| |foo||bar -|''it''foo||bar +|a''b||c'' +|a''
b||c
'' |} -!! html - - -
foo||baritfoo||bar
+!! html/php + + + + +
foo||bar +ab||c +a
b||c
+
+ !! end !! test Tables: 2c. Nested in td -- no escaping needed -!! options -parsoid !! wikitext {| + |foo!!bar |} -!! html -
foo!!bar -
+!! html/* + + + +
foo!!bar +
!! end !! test Tables: 3a. Nested in th -!! options -parsoid !! wikitext {| + !foo!bar |} -!! html -
foo!bar -
+!! html/* + + + +
foo!bar +
!! end !! test Tables: 3b. Nested in th !! options -parsoid +parsoid=html2wt +!! html/parsoid + + + + + +
foo!!barfoo|barfoo!!barfoo!!bar
!! wikitext {| !foo!!bar +!''foo|bar'' +!''foo!!bar'' +!''foo!!bar'' |} -!! html +!! html/php - -
foo!!bar
+ +foo!!bar + +foo|bar + +foo!!bar + +foo!!bar + + !! end !! test -Tables: 3c. Nested in th -- no escaping needed +Tables: 3c. Nested in th !! options -parsoid +parsoid=html2wt +!! html/parsoid + + + +
foo||barfoo||bar
!! wikitext {| !foo||bar +!foo||bar |} -!! html - -
foo||bar
+!! html/php + + + +
foo||bar +foo||bar +
+ !! end !! test Tables: 4a. Escape - !! options -parsoid +parsoid=html2wt !! wikitext {| + !-bar + |- |-bar |} -!! html - - +!! html/* +
-bar
+ + + -
-bar +
-bar
+-bar + + !! end !! test Tables: 4b. Escape + !! options -parsoid +parsoid=html2wt !! wikitext {| + !+bar + |- |+bar |} -!! html - - +!! html/* +
+bar
+ -
+bar
++bar + + ++bar + + !! end !! test Tables: 4c. No escaping needed -!! options -parsoid !! wikitext {| |foo-bar @@ -20544,7 +20643,31 @@ bar|baz |x
a|b
|} -!! html +!! html/php + + + + + + + + + + +
foo-bar +foo+bar +
foo-bar +foo+bar +
foo +

bar|baz ++bar +-bar +

+
x +
a|b
+
+ +!! html/parsoid @@ -20559,15 +20682,23 @@ bar|baz !! test Tables: 4d. No escaping needed -!! options -parsoid !! wikitext {| |[[Foo]]-bar ||+1 ||-2 |} -!! html +!! html/php +
foo-barfoo+bar
foo-barfoo+bar
+ + + +
Foo-bar ++1 +-2 +
+ +!! html/parsoid @@ -20814,6 +20945,18 @@ Links 12. Don't add spurious s between text-nodes and ISBN-links (bug 6 ISBN 1234567890's !! end +!! test +Links 13: Protect link-like plain text. (Parsoid bug T78425) +!! options +parsoid=html2wt +!! html/* +

this is not a link: http://example.com +

+!! wikitext +this is not a link: http://example.com +!! end + + #### --------------- Quotes --------------- #### 1. Quotes inside and #### 2. Link fragments separated by and tags @@ -20821,7 +20964,7 @@ ISBN 1234567890's #### 4. No escaping needed #### -------------------------------------- !! test -1. Quotes inside and +1a. Quotes inside and !! options parsoid=html2wt,wt2wt !! wikitext @@ -20834,14 +20977,16 @@ parsoid=html2wt,wt2wt ''''''foo'''''' '''foo'''bar'''baz''' '''foo''''s -'''foo'' +'''foo'' ''foo''' +''foo'''' '''foo''' -''''foo''' +''''foo''' '''foo'''' ''''foo'''' ''fools' errand'' ''fool's errand'' +a|!*#-:;+-~[]{}b'''x'' !! html/*

'foo' ''foo'' @@ -20854,15 +20999,33 @@ parsoid=html2wt,wt2wt foo's 'foo foo' +foo'' 'foo' 'foo foo' 'foo' fools' errand fool's errand +a|!*#-:;+-~[]{}b'x

!! end +!! test +1b. Quotes inside and with other chars +!! options +parsoid=html2wt,wt2wt +!! wikitext +'''a'' foo ''[[bar]]'' +''a''' foo ''[[bar]]'' +''a''' foo '''{{echo|[[bar]]}}''' +[[foo]] x'''[[bar]]'' +!! html +'a foo bar +a' foo bar +a' foo bar +foo x'bar +!! end + !! test 2. Link fragments separated by and tags !! wikitext @@ -20894,9 +21057,11 @@ parsoid=html2wt,wt2wt !! wikitext '''bar''' ''''bar'''' +'a:b'foo !! html

'bar' 'bar' +'a:b'foo

!! end @@ -22400,6 +22565,36 @@ parsoid=html2wt

AB

!! end +!! test +5a. Merge adjacent quote nodes if they've been edited +!! options +parsoid={ + "modes": ["wt2wt"], + "changes": [ + ["p", "contents", "remove", ":contains('b')"] + ] +} +!! wikitext +''a''b''c'' +!! wikitext/edited +''ac'' +!! end + +!! test +5b. Merge adjacent quote nodes if they've been edited +!! options +parsoid={ + "modes": ["wt2wt"], + "changes": [ + ["#x", "remove"] + ] +} +!! wikitext +''a''b''c'' +!! wikitext/edited +''ac'' +!! end + #------------------------------------ # End of I/B quote minimization tests #------------------------------------ -- 2.20.1
Foo-bar +1