X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fparser%2FparserTests.txt;h=3fd61588bb5247ebef0d6590ebb8b17bbe84a0e8;hb=f2d4db9d03a984d998db9044e63e548597511eb6;hp=6d5054e6ce47b455c3cc39347f4437889073a429;hpb=c65b486b580aaab5d7321b4c0e1d5d1915fca05e;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 6d5054e6ce..3fd61588bb 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -1435,7 +1435,7 @@ Non-word characters don't terminate tag names !! end ### -### See tests/parser/parserTestsParserHook.php for the extension) +### See tests/parser/ParserTestParserHook.php for the extension) ### This checks that HTML5 tags (with non-word characters in the tag ### name) make it safely through the parser -- the Sanitizer will ### munge them later, as it should. @@ -2359,6 +2359,17 @@ parsoid=wt2html,html2html

ho

!! end +!! test +P-wrapping non-breaking spaces +!! wikitext +  +!! html/php+tidy +

  +

+!! html/parsoid +

 

+!! end + ### ### Preformatted text ### @@ -2834,7 +2845,7 @@ two">hi
hi
!! html/parsoid -
hi
+
hi
!! end !! test @@ -2869,7 +2880,7 @@ parsoid=wt2html
x
<pre
!! html/parsoid -
x
+
x
!! end @@ -3681,7 +3692,7 @@ array (
hi
!! html/parsoid -
hi
+
hi
!! end !!test @@ -6273,8 +6284,6 @@ parsoid=wt2html !! end -# Note that the PHP parser output appears to be broken when the table -# end tag is not separated by a space from the style attribute !! test A table with stray table end tags on start tag line (wt2html) !! options @@ -6294,13 +6303,13 @@ parsoid=wt2html |foo |} !! html/php+tidy - +
foo
- +
foo
@@ -6925,9 +6934,9 @@ Don't break on | in extension attribute in template !! html/parsoid -

[1]

+

[1]

-
  1. ↑ ha
+
  1. ↑ ha
!! end ## We don't support roundtripping of these attributes in Parsoid. @@ -7100,9 +7109,9 @@ T107652: s in templates that also generate table cell attributes should be !! html/parsoid - +
Foo[1]
Foo[1]
-
  1. ↑ foo
+
  1. ↑ foo
!! end !! test @@ -8044,6 +8053,8 @@ Link containing % as a double hex sequence interpreted to hex sequence ## Example for such a section: == < == !! test Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors +!! options +title=[[Main Page]] !! config wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext @@ -8822,6 +8833,8 @@ Interwiki link with fragment (T4130) !! test Link scenarios with escaped fragments +!! options +title=[[Main Page]] !! config wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext @@ -9648,17 +9661,14 @@ Handling html with a div self-closing tag
-!! html/php -

<div title /> -<div title/> -

-
-

<div title=bar /> -<div title=bar/> -

-
-
- +!! html/php+tidy +
+
+
+
+
+
+
!! html/parsoid
@@ -9699,10 +9709,10 @@ Handling html with a br self-closing tag


-!! html/php +!! html/php+tidy



-
+



@@ -9717,6 +9727,18 @@ Handling html with a br self-closing tag

!! end +!! test +Quoted attributes without spaces +!! options +parsoid=wt2html +!! wikitext +
red
+!! html/php+tidy +
red
+!! html/parsoid +
red
+!! end + !! test Horizontal ruler (should it add that extra space?) !! wikitext @@ -11024,7 +11046,7 @@ wgRestrictDisplayTitle=false Parser test !! html/parsoid - + !! end # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better. @@ -12725,7 +12747,7 @@ array (
  • foo-{bar}bat
  • foo-{bar}bat
  • foo-{bar}bat
  • -
  • foo-{bar}bat
  • +
  • foo-{bar}bat
  •  
    
     !! end
    @@ -13647,11 +13669,11 @@ Templates: Wiki Tables: 7. Fosterable s should get fostered
     
     
     !! html/parsoid
    -

    [1]

    +

    [1]

    -
    1. ↑ foo
    +
    1. ↑ foo
    !! end !! test @@ -13827,6 +13849,7 @@ Parser Functions: 2. Nested use (only outermost should be marked up) !! test Template nested in extension tag in template !! options +title=[[Main Page]] language=zh !! wikitext {{echo|hi[[ho|{{echo|hi}}]]}} @@ -13834,10 +13857,10 @@ language=zh {{echo|hi-{ho|{{echo|hi}}}-}} !! html/parsoid -

    hi[1] -hi[2] -hi[3]

    -
    1. ↑ hi
    2. ↑
    3. ↑
    +

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

    +
    1. ↑ hi
    2. ↑
    3. ↑
    !! end ### @@ -15471,6 +15494,37 @@ File:Foobar.jpg|link=Foo''s_bar''s|caption !! end +!! test +HTML entity prefix in link markup (T209236) +!! wikitext +[[File:Foobar.jpg|link=https://example.com?foo¶ms=bar]] + + + +File:Foobar.jpg|link=https://example.com?foo¶ms=bar + +!! html/php+tidy +

    Foobar.jpg +

    + +!! html/parsoid +

    + + + +!! end + !! test Image with table with attributes in caption !! options @@ -16418,9 +16472,9 @@ T93580: 1. Templated inside block images !! html/parsoid -
    Caption with templated ref: [1]
    +
    Caption with templated ref: [1]
    -
    1. ↑ foo
    +
    1. ↑ foo
    !! end !! test @@ -16430,9 +16484,9 @@ T93580: 2. inside inline images !! html/parsoid -

    +

    -
    1. ↑ foo
    +
    1. ↑ foo
    !! end !! test @@ -16442,9 +16496,9 @@ T93580: 3. Templated inside inline images !! html/parsoid -

    +

    -
    1. ↑ foo
    +
    1. ↑ foo
    !! end ### @@ -17779,12 +17833,12 @@ section 6

    Underscore-Entity_between_Text

    section 6

    -

    #Space between Text -#Space-Entity between Text -#Plus+between+Text -#Plus-Entity+between+Text -#Underscore_between_Text -#Underscore-Entity_between_Text

    +

    #Space between Text +#Space-Entity between Text +#Plus+between+Text +#Plus-Entity+between+Text +#Underscore_between_Text +#Underscore-Entity_between_Text

    !! end # Parsoid html2wt disabled because it adds padding spaces around = @@ -18177,8 +18231,7 @@ HTML tag with leading space is parsed as text

    !! end -## Don't expect Parsoid and PHP to match, since PHP isn't exactly following -## the HTML5 parsing spec. +## FIXME: The untrimmed attribute in Parsoid is T205737 !! test Element with broken attribute syntax !! options @@ -18187,7 +18240,7 @@ parsoid=wt2html
    hi
    ho
    !! html/php -
    hi
    +
    hi
    ho
    !! html/parsoid @@ -18991,7 +19044,7 @@ Tags which are hidden from tidiers cannot pass through the Sanitizer !! end ### -### Parser hooks (see tests/parser/parserTestsParserHook.php for the extension) +### Parser hooks (see tests/parser/ParserTestParserHook.php for the extension) ### !! test @@ -19261,7 +19314,7 @@ array ( !! end ### -### (see tests/parser/parserTestsParserHook.php for the extension) +### (see tests/parser/ParserTestParserHook.php for the extension) ### !! test @@ -19275,8 +19328,8 @@ Parser hook: static parser hook not inside a comment hello, world

    !! html/parsoid -

    -

    hello, world

    +

    +

    hello, world

    !! end !! test @@ -19289,7 +19342,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, @@ -19364,6 +19417,8 @@ Table not started !! test Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" +!! options +title=[[Main Page]] !! config wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext @@ -20055,8 +20110,8 @@ parsoid=wt2html
    
     
     !! html/parsoid
    -
    
    +
    
     !! end
     
     !! test
    @@ -20082,7 +20137,7 @@ Templates in extension attributes are not expanded
     
    
     
     !! html/parsoid
    -
    
    +
    
     !! end
     
     !! test
    @@ -21519,7 +21574,6 @@ image:foobar.jpg|link=Main Page#section|caption
     
     !! end
     
    -## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
     !! test
     Gallery with template inside caption
     !! options
    @@ -21532,7 +21586,7 @@ File:Foobar.jpg|{{echo|ho}}
     
     !! html/php
     
     !! end
     
    +!! test
    +Gallery with wikitext inside gallery caption
    +!! wikitext
    +
    +File:Foobar.jpg|Image caption
    +
    +!! html/php
    +
    +
    +!! end
    +
     !! test
     Gallery with wikitext inside caption
     !! options
    @@ -22931,6 +23009,19 @@ language=zh variant=zh-tw
     

    , not China

    !! end +!! test +Explicit definition of language variant alternatives (BCP 47 codes) +!! options +language=zh variant=zh-tw +!! wikitext +-{zh:China;zh-Hant-TW:Taiwan}-, not China +!! html/php +

    Taiwan, not China +

    +!! html/parsoid +

    , not China

    +!! end + !! test Filter syntax for language variants !! options @@ -24422,7 +24513,7 @@ comment title=[[Main Page]] !! wikitext /* External links */ removed bogus entries !! html/php -→‎External links: removed bogus entries +→‎External links: removed bogus entries !!end !! test @@ -24432,7 +24523,7 @@ comment title=[[Main Page]] !! wikitext pre-comment text /* External links */ removed bogus entries !! html/php -pre-comment text →‎External links: removed bogus entries +pre-comment text →‎External links: removed bogus entries !!end !! test @@ -24442,9 +24533,29 @@ comment local title=[[Main Page]] !! wikitext /* External links */ removed bogus entries !! html/php -→‎External links: removed bogus entries +→‎External links: removed bogus entries !!end +!! test +Edit comment with section link that has a link in it +!! options +comment local title=[[Main Page]] +!! wikitext +/* [[A link]] */ +!! html/php +→‎[[A link]] +!! end + +!! test +Edit comment with section link that has a template in it +!! options +comment local title=[[Main Page]] +!! wikitext +/* {{foobar|param}} */ +!! html/php +→‎{{foobar|param}} +!! end + !! test Edit comment with subpage link (T16080) !! options @@ -24553,7 +24664,7 @@ title=[[Main Page]] !! wikitext /* __hello__world__ */ !! html/php -→‎__hello__world__ +→‎__hello__world__ !! end !! test @@ -26801,6 +26912,33 @@ parsoid=html2wt !! end +!! test +Tables: 4e. Escape } +!! options +parsoid=html2wt +!! html/parsoid + + +
    }
    x}
    + +!! wikitext +{| +|} +|- +|x||} +|} +!! html/php + + + + + +
    } +
    x} +
    + +!! end + !! test Tables: 5. Empty table cells should get whitespace to avoid need for nowikis !! options @@ -28881,6 +29019,27 @@ Image: Invalid title as link

    !! end +!! test +Various link types in alt and link options +!! wikitext +[[File:Foobar.jpg|link=[[Main Page]]|alt=[[Main Page]]|caption]] + +[[File:Foobar.jpg|link=[[Media:Thumb.png]]|alt=[[Media:Thumb.png]]|caption]] + +[[File:Foobar.jpg|link=[[wikipedia:Foo]]|alt=[[wikipedia:Foo]]|caption]] +!! html/php+tidy +

    Main Page +

    Media:Thumb.png +

    wikipedia:Foo +

    +!! html/parsoid +

    Main Page

    + +

    Media:Thumb.png

    + +

    wikipedia:Foo

    +!! end + !! test Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does) !! options @@ -30693,6 +30852,7 @@ parsoid={ a - + +} !! wikitext {| @@ -30701,6 +30861,8 @@ parsoid={ |- |- |+ +|- +|} |} !! end @@ -30716,6 +30878,7 @@ parsoid={ a - + +} !! wikitext {| @@ -30724,6 +30887,8 @@ parsoid={ | - |- | + +|- +| } |} !! end @@ -30891,6 +31056,170 @@ parsoid={ foo !! end +!! test +Ignore empty

    when scrubWikitext is false +!! options +parsoid={ + "modes": ["html2wt"], + "scrubWikitext": false +} +!! html/parsoid +
    1
    +

    a

    b

    +
    2
    +

    a

    +

    +

    b

    +
    3
    +

    a

    +

    +

    +

    +

    +

    b

    +!! wikitext +
    1
    +a + +b +
    2
    +a + +b +
    3
    +a + +b +!! html/php+tidy +
    1
    +

    a +

    b +

    +
    2
    +

    a +

    b +

    +
    3
    +

    a +

    b +

    +!! end + +!! test +Normalize empty paragraphs to HTML form that html2wt expects +!! options +parsoid={ + "modes": ["html2wt"], + "scrubWikitext": true +} +!! html/parsoid +
    1
    +

    a

    b

    +
    2
    +

    a

    +

    +

    b

    +
    3
    +

    a

    +

    +

    +

    +

    +

    b

    +
    4
    +

    a

    +

    +
    foo
    +!! wikitext +
    1
    +a + + +b +
    2
    +a + + +b +
    3
    +a + + + + + +b +
    4
    +a + +
    +
    foo
    +!! html/php+tidy +
    1
    +

    a +


    +b +

    +
    2
    +

    a +


    +b +

    +
    3
    +

    a +


    +


    +

    b +

    +
    4
    +

    a +


    +

    +
    foo
    +!! end + +!! test +Empty paragraphs (marked with mw-empty-elt) found in source should not be normalized away +!! options +parsoid={ + "modes": ["html2wt"], + "scrubWikitext": true +} +!! html/parsoid + + + + + + + +
    foo +
    +

    +
    +!! wikitext +{| +|
    foo +
    +|+ +|} +!! end + +!! test +Templated content should be skipped over by normalization +!! options +parsoid={ + "modes": ["html2wt"], + "scrubWikitext": true +} +!! html/parsoid +

    foobar

    foobar

    +

    + +!! wikitext +{{SomeTemplate1|boo}}{{SomeTemplate2|booboo}} +!! end + !! test Escape nowiki DOM elements !! options @@ -31350,7 +31679,7 @@ wgFragmentMode=[ 'html5', 'legacy' ]

    !! html/parsoid

    A&B&C&amp;D&amp;amp;E

    -

    #A&B&C&amp;D&amp;amp;E

    +

    #A&B&C&amp;D&amp;amp;E

    !! end !! test @@ -31463,12 +31792,12 @@ wgFragmentMode=[ 'html5', 'legacy' ]

    тест

    Hey < # " > % : '

    -

    #Foo bar #foo Bar #Тест #тест #Hey < # " > % : '

    +

    #Foo bar #foo Bar #Тест #тест #Hey < # " > % : '

    💩

    -

    #啤酒 #啤酒

    +

    #啤酒 #啤酒

    !! end # Parsoid doesn't support this mode @@ -31581,7 +31910,7 @@ wgFragmentMode=[ 'html5', 'legacy' ]

    !! html/parsoid

    Foo bar

    -

    #Foo bar

    +

    #Foo bar

    !! end !! test @@ -31638,7 +31967,7 @@ wgFragmentMode=[ 'html5' ]

    #[foo]

    !! html/parsoid -

    #[foo]

    +

    #[foo]

    !! end ## ------------------------------