From 1b00e01b85e834f361296e17382b5efbae4d4c1b Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Tue, 9 Oct 2018 11:57:03 -0400 Subject: [PATCH] Sync up with Parsoid parserTests.txt This now aligns with Parsoid commit f6c64caaf1becc5b5780c871d495a3d9f5aac7a8 Change-Id: I0d2722c100b522c68a8e35a8701d5bf7ef80dccb --- tests/parser/parserTests.txt | 360 ++++++++++++++++++++++++++--------- 1 file changed, 265 insertions(+), 95 deletions(-) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 83ed27040e..bbd9ecbe99 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -2046,8 +2046,6 @@ x !! test Block tag on one line (
) -!! options -parsoid=wt2html,html2html !! wikitext a
foo
@@ -2079,8 +2077,6 @@ b

foo
!! test Block tag on both lines (
) -!! options -parsoid=wt2html,html2html !! wikitext a
foo
@@ -2494,8 +2490,6 @@ Bar !! test T17491: / in blockquote -!! options -parsoid=wt2html !! wikitext
Foo bar baz quux @@ -2515,8 +2509,6 @@ Foo bar baz quux !! test T17491: / in blockquote (2) -!! options -parsoid=wt2html !! wikitext
Foo bar baz quux
@@ -2851,6 +2843,10 @@ Barack Obama of the United States !! end ## Remex doesn't account for fostered content. +## The difference between Parsoid and the PHP parser can be attributed to core +## commit 674e8388cba and 710618f89af in Parsoid's repo. Parsoid doesn't +## tokenize unmatched extension tags that shadow html tags as strings to ease +## an escaping mechanism. See the comment in `maybeExtensionTag`. !! test Handle broken pre-like tags (T66025) !! options @@ -2869,47 +2865,36 @@ parsoid=wt2html !! html/parsoid
x
-

<pre

+
!! end +## Similar to the above, but shows the difference between extension and html tags !! test -Parsoid: handle pre with space after attribute -!! options -parsoid=wt2html +Less than in attribute position !! wikitext -
{{echo|foo}}
-!! html/php -
{{echo|foo}}
+
123
+
123
+!! html/php+tidy +
123

+<div

123
!! html/parsoid -
{{echo|foo}}
+
123

+ +<div

123
!! end -# TODO / maybe: fix wt2wt for this !! test -Parsoid: Don't paragraph-wrap fosterable content +Parsoid: handle pre with space after attribute !! options parsoid=wt2html !! wikitext -{| - - - - - -|} -!! html - - - - - - - - - +
{{echo|foo}}
+!! html/php +
{{echo|foo}}
-
+!! html/parsoid +
{{echo|foo}}
!! end !! test @@ -2920,7 +2905,7 @@ Self-closed pre

 
 !! html/parsoid
-

+

 !! end
 
 !! test
@@ -3533,8 +3518,6 @@ parsoid=wt2html,html2html
 
 !! test
 3a. Indent-Pre and block tags (single-line html)
-!! options
-parsoid=wt2html,html2html
 !! wikitext
  a 

foo

b
foo
@@ -3654,7 +3637,7 @@ array ( ) !! html/parsoid -

a


+

a


 !! end
 
 !! test
@@ -6170,6 +6153,15 @@ Normal text. '''''Bold italic text.''''' Normal text.
 

!! end +!! test +Quotes wrapping HTML table +!! wikitext +'''
hi
''' +!! html/php+tidy +
hi
+!! html/parsoid +
hi
+!! end # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP # parser strips. The wikitext contains just the first half of the bold @@ -7058,7 +7050,7 @@ T107652: s in templates that also generate table cell attributes should be !! html/parsoid - +
Foo[1]
Foo[1]
  1. ↑ foo
!! end @@ -8825,7 +8817,7 @@ Interwiki links that cannot be represented in wiki syntax !! html/parsoid

meatball:ok ok with fragment -ok ending with ? mark +ok ending with ? mark has query is just fragment

!! end @@ -8908,6 +8900,17 @@ parsoid=wt2html,wt2wt,html2html

local:local:local:local:mi:local:Foo

!! end +!! test +Interwiki link with percent encoded target +!! wikitext +[[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]] +!! html/php +

Nueva Guipúzcoa +

+!! html/parsoid +

Nueva Guipúzcoa

+!! end + ### ### Interlanguage links ### Language links (so that searching for '### language' matches..) @@ -9566,10 +9569,32 @@ Handling html with a div self-closing tag !! html/parsoid
-
+
-
+
+!! end + +!! test +Elements with solidus in various attribute positions +!! options +parsoid=wt2html,html2html +!! wikitext +
ha
+ +
ha
+ +
ha
+!! html/php+tidy +
ha
+
ha
+
ha
+!! html/parsoid +
ha
+ +
ha
+ +
ha
!! end !! test @@ -9979,9 +10004,9 @@ Multiple list tags generated by templates
  • c
  • !! html/parsoid -
  • a -
  • b -
  • c
  • +
  • a
  • +
  • b
  • +
  • c
  • !! end !! test @@ -10228,11 +10253,27 @@ parsoid=wt2html,wt2wt,html2html

    • a
    • b
    !! html/parsoid -

    +

    • a
    • b
    !! end +# Output is ugly because of all the misnested tag fixups. +!! test +3. List embedded in a formatting tag in a misnested way +!! wikitext + + +** 123 +!! html/php+tidy +

    +

      • 123
    +!! html/parsoid +

    + +
      • 123
    +!! end + ### ### Magic Words ### @@ -12042,7 +12083,7 @@ Un-closed !! html/php !! html/parsoid - + !! end ## We used to, but no longer wt2wt this test since the default serializer @@ -12061,6 +12102,10 @@ some *stuff *here + +some* stuff +* here + can have stuff===here=== !! html/php @@ -12069,6 +12114,10 @@ some

    • stuff
    • here
    +


    +some* stuff +

    +
    • here

    here

    !! html/parsoid @@ -12079,7 +12128,11 @@ some
    • stuff
    • here
    -

    here

    + +

    some* stuff

    +
    • here
    + +

    here

    !! end @@ -12734,7 +12787,7 @@ parsoid=wt2html |c |} !!html/parsoid - +
    c
    !!end @@ -12885,6 +12938,18 @@ parsoid

    Bar

    !!end +!! test +Templates: Scopes should not be expanded unnecessarily +!! options +parsoid=wt2html,wt2wt +!! wikitext +{{echo|
    a
    }}b{{echo| +
    c
    }} +!! html +
    a

    b

    +
    c
    +!! end + !!test Templates: Inline Text: 1. Multiple template uses !! wikitext @@ -13448,7 +13513,7 @@ Templates: Wiki Tables: 7. Fosterable s should get fostered !! html/parsoid -

    [1]

    +

    [1]

    @@ -13561,8 +13626,8 @@ Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap o {{echo|
    foo}} {{echo|}} !! html/parsoid -
    foo -
    +
    foo
    +
    !! end @@ -13625,19 +13690,24 @@ Parser Functions: 2. Nested use (only outermost should be marked up) ## Note that the templates inside the references are not wrapped !! test Template nested in extension tag in template +!! options +language=zh !! wikitext {{echo|hi[[ho|{{echo|hi}}]]}} {{echo|hi[http://test.com?q={{echo|ho}}]}} +{{echo|hi-{ho|{{echo|hi}}}-}} !! html/parsoid -

    hi[1] -hi[2]

    -
    1. ↑ hi
    2. ↑
    +

    hi[1] +hi[2] +hi[3]

    +
    1. ↑ hi
    2. ↑
    3. ↑
    !! end ### ### Pre-save transform tests ### + !! test pre-save transform: subst: !! options @@ -14194,11 +14264,20 @@ ab cd ef -!! html -

    <div>[[foo]]

    -

    ab

    -

    cd

    -

    ef

    +!! html/php+tidy +

    <div>[[foo]] +

    a<nowiki / >b +

    cd +

    e<nowiki/ >f +

    +!! html/parsoid +

    <div>[[foo]]

    + +

    a<nowiki / >b

    + +

    cd

    + +

    e<nowiki/ >f

    !! end !! test @@ -15857,7 +15936,7 @@ T93580: 2. inside inline images !! html/parsoid -

    +

    1. ↑ foo
    !! end @@ -17711,9 +17790,9 @@ Media link Media:Video.ogv

    !! html/parsoid -

    Media:Foobar.jpg -Media:Video.ogv -Media:Video.ogv

    +

    Media:Foobar.jpg +Media:Video.ogv +Media:Video.ogv

    !! end !! test @@ -17724,7 +17803,24 @@ Media link with text

    A neat file to look at

    !! html/parsoid -

    A neat file to look at

    +

    A neat file to look at

    +!! end + +!! test +Localized media link +!! options +language=is +!! wikitext +[[Miðill:Foobar.jpg]] + +[[Miðill:Foobar.jpg|Icelandic]] +!! html/php +

    Miðill:Foobar.jpg +

    Icelandic +

    +!! html/parsoid +

    Miðill:Foobar.jpg

    +

    Icelandic

    !! end # FIXME: this is still bad HTML tag nesting @@ -17742,7 +17838,53 @@ parsoid=wt2html,html2html !! html/php+tidy

    Safe Link

    " onmouseover="alert(document.cookie)" onfoo="
    !! html/parsoid -

    Safe Link

    " onmouseover="alert(document.cookie)" onfoo="
    +

    Safe Link

    " onmouseover="alert(document.cookie)" onfoo="
    +!! end + +!! test +Media link from missing resource (parsoid-only) +!! options +parsoid=html2wt +!! html/parsoid +Bat! +!! wikitext +[[Media:Foobar.jpg|Bat!]] +!! end + +!! test +Media link from missing resource, localized (parsoid-only) +!! options +parsoid=html2wt +language=is +!! html/parsoid +Bat! +!! wikitext +[[Miðill:Foobar.jpg|Bat!]] +!! end + +# This is a sanity test to ensure we don't crash or choke when given +# old cached 1.7.0 HTML for media links; we don't require that the +# result be "valid" because wt2wt was completely broken in 1.7.0 +!! test +Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511 +!! options +parsoid=html2wt +!! html/parsoid +

    This is what Parsoid would emit (and we still handle this HTML fine):

    +

    A neat file to look at

    +

    But VisualEditor would mangle the rel attribute, and give us back this:

    +

    A neat file to look at

    +

    But at least we don't crash when trying to handle the mangled HTML!

    +!! wikitext +This is what Parsoid would emit (and we still handle this HTML fine): + +[[Media:Foobar.jpg|A neat file to look at]] + +But VisualEditor would mangle the rel attribute, and give us back this: + +[//example.com/images/3/3a/Foobar.jpg A neat file to look at] + +But at least we don't crash when trying to handle the mangled HTML! !! end !! test @@ -17755,8 +17897,8 @@ Media link to nonexistent file (T3702) Media:No_such file.jpg

    !! html/parsoid -

    Media:No such.jpg -Media:No_such file.jpg

    +

    Media:No such.jpg +Media:No_such file.jpg

    !! end !! test @@ -18385,7 +18527,7 @@ array ( !! html/parsoid -
    
    +
    
     !! end
     
     !! test
    @@ -18400,7 +18542,7 @@ array (
     
     
     !! html/parsoid
    -
    
    +
    
     !! end
     
     !! test
    @@ -18550,7 +18692,7 @@ array (
     text
     
     !! html/parsoid
    -

    text

    +

    text

    !! end ## should be output literally since there is no matching tag that begins it @@ -18577,7 +18719,7 @@ array ( </tag>

    !! html/parsoid -

    other stuff +

    other stuff </tag>

    !! end @@ -18637,7 +18779,7 @@ hello, world

    !! html/parsoid

    -

    hello, world

    +

    hello, world

    !! end !! test @@ -18650,7 +18792,7 @@ Parser hook: static parser hook inside a comment

    !! html/parsoid -

    +

    !! end # Nested template calls; this case was broken by Parser.php rev 1.506, @@ -23504,8 +23646,6 @@ B # T8200:
    should behave like
    with respect to line breaks !! test T8200: paragraphs inside blockquotes (no extra line breaks) -!! options -parsoid=wt2html,html2html !! wikitext
    Line one @@ -23521,8 +23661,6 @@ Line two

    !! test T8200: paragraphs inside blockquotes (extra line break on open) -!! options -parsoid=wt2html,html2html !! wikitext
    Line one @@ -23543,8 +23681,6 @@ Line two

    !! test T8200: paragraphs inside blockquotes (extra line break on close) -!! options -parsoid=wt2html,html2html !! wikitext
    Line one @@ -25180,9 +25316,9 @@ LST Sections: Newfangled approach
    !! html/parsoid -

    +

    - +

    !! end @@ -27326,28 +27462,29 @@ Indented table with an empty td !!end -## We have some newline diffs RT-ing this edge case -## and it is not important enough -- we seem to be emitting -## at most 2 newlines after a and this is unrelated to -## the issue from T85627 that this is testing. -!!test +!! test Indented table with blank lines in between (T85627) -!! options -parsoid=wt2html !! wikitext {| |foo |} -!! html +!! html/php -
    foo +


    +

    -!!end +!! html/parsoid + + +
    foo +

    +

    +!! end !!test Indented block & table @@ -27449,7 +27586,7 @@ New element inserted (without intervening newlines) after an old sol-transparent !! options parsoid=html2wt !! html/parsoid -

    new para

    +

    new para

    new heading

    !! wikitext @@ -27738,9 +27875,11 @@ Properly encapsulate empty-content transclusions in fosterable positions !! end +## No longer captures its original intention !! test Always encapsulate foster box when template range is expanded to table !! options +disabled parsoid=wt2wt !! wikitext {| @@ -28798,6 +28937,23 @@ parsoid={ ''[[Foo]]'' !! end +!! test +7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted +!! options +parsoid={ + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + ["div", "after", "\n

    Foo , placeholder

    "] + ] +} +!! wikitext +
    placeholder
    +!! wikitext/edited +
    placeholder
    +[[Foo]] , placeholder +!! end + #------------------------------ # End of tag minimization tests #------------------------------ @@ -30867,6 +31023,20 @@ T72875: Test for brackets in attributes of elements in internal link texts link span

    !! end +!! test +T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs +!! options +parsoid={ + "modes": ["html2wt"] +} +!! html/parsoid +9 +10 +!! wikitext +[https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9] +[[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]] +!! end + !! test T179544: {{anchorencode:}} output should be always usable in links !! config -- 2.20.1