X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fparser%2FparserTests.txt;h=ffa435c08b55313e3ce23d1c27546b54e8a6ee5f;hb=c243573b5e8eebcd68d978d5d7a7e60b851b5a62;hp=2e1806da580df04adbc0fad0942b4b267ba930eb;hpb=0ea03a7f56070956838ab360a5dccc2a506fc4ff;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 2e1806da58..ffa435c08b 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -838,15 +838,12 @@ parsoid=wt2html !!end # same html as previous, but wikitext adjusted to match parsoid html2wt -# skipping wt2html and html2html because it wants to put before !! test Italics and bold: 5-quote opening sequence: (5,2+3) -!! options -parsoid=wt2wt,html2wt !! wikitext '''''foo''''' -!! html -

foo +!! html/* +

foo

!! end @@ -1460,11 +1457,11 @@ Entities inside !! test Entities inside template parameters -!! options -parsoid !! wikitext {{echo|–}} -!! html +!! html/php+tidy +

–

+!! html/parsoid

!! end @@ -1472,7 +1469,7 @@ parsoid Properly escape nowiki when combined with other wiki markup !! options parsoid=html2wt -!! html +!! html/parsoid

* </nowiki> tag

!! wikitext * </nowiki> tag @@ -1482,7 +1479,7 @@ parsoid=html2wt T93824: Put escaped HTML tags inside nowiki !! options parsoid=html2wt -!! html +!! html/parsoid

<h2>foo</h2>

!! wikitext

foo

@@ -1492,7 +1489,7 @@ parsoid=html2wt T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars !! options parsoid=html2wt -!! html +!! html/parsoid

This text: L'Foo This text: L''Foo This text: L'''Foo''

@@ -1507,7 +1504,7 @@ This text: L'''[[Foo]]'' T71950: 2. Put nowiki as close to cause as possible, after ' :' !! options parsoid=html2wt -!! html +!! html/parsoid

This text : L''Foo

!! wikitext @@ -1550,7 +1547,7 @@ parsoid=html2wt Cases where "!!" needs nowiki protection !! options parsoid=html2wt -!! html +!! html/parsoid
this needs protection !! here
@@ -1803,7 +1800,11 @@ parsoid=wt2html,wt2wt !! wikitext *a *b -!! html +!! html/php +
  • a
  • +
  • b
+ +!! html/parsoid
  • a
  • @@ -2016,7 +2017,7 @@ a [[Category:A1]] [[Category:A2]] [[Category:A4]] !! html/parsoid

    a

    - + !! end !! test @@ -2026,7 +2027,7 @@ parsoid=wt2html !! wikitext [[Category:A1]]a !! html/parsoid -

    a

    +

    a

    !! end ### @@ -2343,13 +2344,17 @@ HTML pre followed by indent-pre !! end +# Note that tidy removes the empty

    tags from the start and end. +# Parsoid does not, by design. !!test Block tag pre -!!options -parsoid !! wikitext

    foo

    -!! html +!! html/php+tidy +
    +foo
    +
    +!! html/parsoid

    foo

    !!end @@ -2472,6 +2477,19 @@ Templates: Indent-Pre: 1f: Wrapping should be based on expanded content !!end +!! test +Pres with newline attributes +!! wikitext +
    hi
    +!! html/php +
    hi
    + +!! html/parsoid +
    hi
    +!! end + !! test Things that look like
     tags aren't treated as such
     !! wikitext
    @@ -2511,7 +2529,10 @@ Parsoid: handle pre with space after attribute
     parsoid=wt2html
     !! wikitext
     
    {{echo|foo}}
    -!! html +!! html/php +
    {{echo|foo}}
    + +!! html/parsoid
    {{echo|foo}}
    !! end @@ -2717,32 +2738,32 @@ Templates: Other wikitext in parameter names (bug 67657) #-------------------------------------------------------------------- !! test Templates: Parsoid parameter escaping test 1 -!! options -parsoid !! wikitext {{echo|[foo]|{{echo|[bar]}}}} -!! html +!! html/php+tidy +

    [foo]

    +!! html/parsoid

    [foo]

    !! end !! test Parsoid: Pipes in external links in template parameter -!! options -parsoid !! wikitext {{echo|[{{echo|http://example.com}} link]}} -!! html +!! html/php+tidy +

    link

    +!! html/parsoid

    link

    !! end !! test Parsoid: pipe in transclusion parameter -!! options -parsoid !! wikitext {{echo|http://foo.com/a|b}} -!! html +!! html/php+tidy +

    http://foo.com/a%7Cb

    +!! html/parsoid

    http://foo.com/a|b

    @@ -2754,7 +2775,9 @@ Parsoid: Pipe in external link target and content in template parameter parsoid=html2wt,wt2wt !! wikitext {{echo|[http://foo.com/a|b a|b]}} -!! html +!! html/php+tidy +

    a|b

    +!! html/parsoid

    |bar"}},"i":0}}]}'}'>foo|bar <div> @@ -2793,18 +2818,20 @@ Templates: '=' char in nested transclusions should not trigger nowiki escapes or parsoid=html2wt,wt2wt !! wikitext {{echo|{{echo|1=bar}}}} -!! html +!! html/php+tidy +

    bar

    +!! html/parsoid

    bar

    !! end ## Bug 56733 !! test Templates parameters with special tokenizing behavior dont get modified because of arg escaping -!! options -parsoid !! wikitext {{echo|a : b}} -!! html +!! html/php+tidy +

    a : b

    +!! html/parsoid

    a : b

    !! end @@ -2813,9 +2840,8 @@ parsoid Templates: Preserve blank parameter names !! wikitext {{echo|=foo}} -!! html/php -

    {{{1}}} -

    +!! html/php+tidy +

    {{{1}}}

    !! html/parsoid

    {{{1}}}

    !! end @@ -2824,10 +2850,8 @@ Templates: Preserve blank parameter names Templates: Preserve blank parameter names in other positions !! wikitext {{blank_param|bar|=foo}} -!! html/php -

    bar -foo -

    +!! html/php+tidy +

    bar foo

    !! html/parsoid

    bar foo

    @@ -3283,6 +3307,7 @@ parsoid=wt2html,wt2wt !! wikitext [[Category:foo]] {{echo| [[Category:foo]]}} +!! html/php+tidy !! html/parsoid @@ -3306,6 +3331,8 @@ Indent-Pre: Newlines in comments shouldn't affect sol state a b +!! html/php+tidy +

    a b

    !! html/parsoid

    a !! endarticle # hmm, fix this or just deprecate msgnw and document its behavior? @@ -10336,6 +10386,7 @@ msgnw keyword <gallery> File:Foobar.jpg </gallery> +<!-- comment -->

    !! end @@ -10589,7 +10640,7 @@ b}} !! end !! test -Parsoid: Merge double tds (bug 50603) +Parsoid: Merge double tds (T52603) !! options parsoid !! wikitext @@ -10603,7 +10654,7 @@ parsoid !! end !! test -Parsoid: Merge double tds in nested transclusion content (bug 50603) +Parsoid: Merge double tds in nested transclusion content (T52603) !! options parsoid !! wikitext @@ -12146,7 +12197,7 @@ parsoid=wt2html Parsoid: Escape nowiki with trailing space in tags !! options parsoid=html2wt -!! html +!! html/parsoid

    <nowiki > foo </nowiki >

    a<nowiki />b

    c<nowiki/ >d

    @@ -12162,7 +12213,7 @@ c<nowiki/ >d Parsoid: Escape weird noWikI capitalizations !! options parsoid=html2wt -!! html +!! html/parsoid

    <noWikI > foo </NoWikI >

    !! wikitext <noWikI > foo </NoWikI > @@ -12603,6 +12654,21 @@ Image with link parameter, protocol-less URL target

    !! end +!! test +Escaping non-block captions (T107435) +!! options +parsoid={ + "modes": ["wt2wt"], + "changes": [ + ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"] + ] +} +!! wikitext +[[Image:Foobar.jpg|caption]] +!! wikitext/edited +[[Image:Foobar.jpg||]] +!! end + !! test Image with link parameter, wgExternalLinkTarget !! wikitext @@ -12791,8 +12857,6 @@ parsoid=wt2html,wt2wt,html2html !! test Image with wiki markup in implicit alt -!! options -parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:Foobar.jpg|testing '''bold''' in alt]] @@ -12802,8 +12866,8 @@ parsoid=wt2html,wt2wt,html2html

    testing bold in alt

    !! html/parsoid -

    -

    testing bold in alt

    +

    +

    testing bold in alt

    !! end !! test @@ -12884,7 +12948,7 @@ parsoid=wt2html,wt2wt,html2html ################### # Image sizing. # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame -# and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258 +# and https://phabricator.wikimedia.org/T64258 # Foobar has actual size of 1941x220 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's # a scalable format. @@ -13041,7 +13105,7 @@ Frameless image caption with a free URL

    http://example.com

    !! html/parsoid -

    +

    !! end !! test @@ -13117,7 +13181,7 @@ BUG 1887: A ISBN with a thumbnail !! html/parsoid -
    ISBN 1235467890
    +
    ISBN 1235467890
    !! end !! test @@ -13151,7 +13215,7 @@ BUG 648: Frameless image caption with a link

    text with a link in it

    !! html/parsoid -

    +

    !! end !! test @@ -13162,7 +13226,7 @@ BUG 648: Frameless image caption with a link (suffix)

    text with a linkfoo in it

    !! html/parsoid -

    +

    !! end !! test @@ -13173,7 +13237,7 @@ BUG 648: Frameless image caption with an interwiki link

    text with a MeatBall:Link in it

    !! html/parsoid -

    +

    !! end !! test @@ -13184,7 +13248,15 @@ BUG 648: Frameless image caption with a piped interwiki link

    text with a link in it

    !! html/parsoid -

    +

    +!! end + +!! test +T107474: Frameless image caption with +!! wikitext +[[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]] +!! html/parsoid +

    !! end !! test @@ -13195,7 +13267,7 @@ Escape HTML special chars in image alt text

    & < > "

    !! html/parsoid -

    +

    !! end !! test @@ -13206,7 +13278,7 @@ BUG 499: Alt text should have Ӓ, not &1234;

    ♀

    !! html/parsoid -

    +

    !! end !! test @@ -13533,7 +13605,7 @@ Parsoid-specific image handling - simple image with a formatted caption !! wikitext [[File:Foobar.jpg|
    ab
    c
    ]] !! html/parsoid -

    +

    !! end !! test @@ -13986,7 +14058,7 @@ parsoid=wt2html !! html/parsoid
    • This and this should be part of the same list item
    • -
    • So should this and this should be part of the same list item
    • +
    • So should this and this should be part of the same list item
    !! end @@ -14095,8 +14167,8 @@ parsoid [[:Category:Foo|Bar]] !! html

    -Category:Foo -Bar +Category:Foo +Bar

    !! end @@ -14140,15 +14212,15 @@ parsoid [[Category:Foo]] [[Category:Foo|Bar]] !! html - - + + !! end !! test Normalize hrefs properly before testing for invalid link targets (bug 70894) !! options parsoid=html2wt -!! html +!! html/parsoid !! wikitext [[Category:Toxine bactérienne]] @@ -15048,11 +15120,8 @@ I always thought &xacute; was a cute letter.

    !! end -# TODO: generalize to PHP parser? !! test HTML5 tags -!! options -parsoid !! wikitext five @@ -15060,7 +15129,8 @@ parsoid !! html

    five -This highlighted text

    +This highlighted text +

    !! end !! test @@ -18060,21 +18130,31 @@ ISBN ISBN 1234567890

    ISBN ISBN 1234567890

    !! end +# Uppercase X and lowercase x as well !! test ISBN with an X !! wikitext ISBN 3-462-04561-X +ISBN 3-462-04561-x ISBN 080442957X +ISBN 080442957x ISBN 978080442957X +ISBN 978080442957x !! html/php

    ISBN 3-462-04561-X +ISBN 3-462-04561-x ISBN 080442957X +ISBN 080442957x ISBN 978080442957X +ISBN 978080442957x

    !! html/parsoid

    ISBN 3-462-04561-X +ISBN 3-462-04561-x ISBN 080442957X -ISBN 978080442957X

    +ISBN 080442957x +ISBN 978080442957X +ISBN 978080442957x

    !! end !! test @@ -18085,7 +18165,7 @@ ISBN 1234567890

    ISBN 1234567890

    !! html/parsoid -

    ISBN 1234567890

    +

    ISBN 1234567890

    !! end !! test @@ -20104,7 +20184,7 @@ percent-encoding and + signs in internal links (Bug 26410) !! html/parsoid

    User:+% Page+title% %+ %20 %+ %+r -% + +% + 3E 3E+

    !! end @@ -20119,7 +20199,7 @@ Special characters in embedded file links (bug 27679)

    !! html/parsoid

    -

    +

    !! end !! test @@ -20891,7 +20971,7 @@ parsoid=wt2html,wt2wt '''foo[[File:Foobar.jpg|thumb|caption]]bar''' !! html/parsoid

    foo

    -
    caption
    +
    caption

    bar

    !! end @@ -20903,7 +20983,7 @@ parsoid=wt2html,wt2wt '''[[Image:Foobar.jpg|right|300px]]''' !! html/parsoid

    -
    +

    !! end @@ -21630,7 +21710,7 @@ parsoid Headings: 1. Nested inside html !! options parsoid=html2wt -!! html +!! html/parsoid

    =foo=

    =foo=

    =foo=

    @@ -21661,7 +21741,7 @@ parsoid=html2wt Headings: 2. Outside heading nest on a single line

    foo

    *bar !! options parsoid=html2wt -!! html +!! html/parsoid

    foo

    *bar

    foo

    =bar

    foo

    =bar= @@ -21719,7 +21799,7 @@ Headings: 4a. No escaping needed (testing just h1 and h2) Headings: 4b. No escaping needed (inside p-tags) !! options parsoid=html2wt -!! html +!! html/parsoid

    === =foo= x =foo= @@ -22036,7 +22116,7 @@ Lists: 5. No unnecessary escapes Lists: 6. Escape bullets in SOL position !! options parsoid=html2wt -!! html +!! html/parsoid

    *foo

    !! wikitext *foo @@ -22057,7 +22137,7 @@ a Lists: 8. Escape colons only if not present in tags !! options parsoid=html2wt -!! html +!! html/parsoid
    a:bc:d
    !! wikitext ; a:b''c:d'' @@ -22433,7 +22513,7 @@ parsoid=wt2html T97430: Don't emit empty nowiki pairs around marker meta tags !! options parsoid=html2wt -!! html +!! html/parsoid

    *This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.

    !! wikitext @@ -22749,7 +22829,7 @@ parsoid=html2wt

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

    !! wikitext -this is not a link: http://example.com +this is not a link: http://example.com !! end !! test @@ -22999,7 +23079,7 @@ parsoid 5. Nowiki escaping should account for indent-pres !! options parsoid=html2wt -!! html +!! html/parsoid
    ==foo==
    !! wikitext ==foo== @@ -23025,7 +23105,7 @@ parsoid 1. Valid behavior switches should be escaped !! options parsoid=html2wt -!! html +!! html/parsoid __TOC__ __TOC__ !! wikitext @@ -23037,7 +23117,7 @@ __TOC__ 2. Invalid behavior switches should not be escaped !! options parsoid=html2wt -!! html +!! html/parsoid __TOO__ __|__ !! wikitext @@ -23872,7 +23952,7 @@ Don't block XML namespace declaration Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869) !! options parsoid=html2wt -!! html +!! html/parsoid

    Foo

    !! wikitext [[Foo]] @@ -23883,7 +23963,7 @@ parsoid=html2wt New wikilinks should be serialized properly !! options parsoid=html2wt -!! html +!! html/parsoid Foo Foo !! wikitext @@ -23895,7 +23975,7 @@ parsoid=html2wt New wiki links (href variations) !! options parsoid=html2wt -!! html +!! html/parsoid Foo_bar Foo_bar Foo_bar @@ -23911,7 +23991,7 @@ parsoid=html2wt New wiki links (content string variations) !! options parsoid=html2wt -!! html +!! html/parsoid Foo_bar Foo bar ./Foo_bar @@ -23925,7 +24005,7 @@ parsoid=html2wt New category links (href variations) !! options parsoid=html2wt -!! html +!! html/parsoid @@ -23940,7 +24020,7 @@ New sol transparent links don't need indent-pre nowiki protection !! options parsoid=html2wt language=de -!! html +!! html/parsoid @@ -23954,7 +24034,7 @@ language=de New interlanguage links (href variations) !! options parsoid=html2wt -!! html +!! html/parsoid @@ -24101,16 +24181,17 @@ parsoid
    bar
    !! end -#!! test -#Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852) -#!! options -#parsoid=html2wt -#language=ar -#!! html -#
    -#!! wikitext -#[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]] -#!! end +!! test +Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852) +!! options +parsoid=html2wt +language=ar +disabled +!! html/parsoid +
    +!! wikitext +[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]] +!! end !! test Image: Block level image should have \n before and after @@ -24202,7 +24283,7 @@ parsoid=html2wt Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does) !! options parsoid=html2wt -!! html +!! html/parsoid
    • foo

    @@ -24214,7 +24295,7 @@ parsoid=html2wt Lists: Serialize correctly even when list tags has unneeded whitespace between tags !! options parsoid=html2wt -!! html +!! html/parsoid
    • foo
    !! wikitext * foo @@ -24224,7 +24305,7 @@ parsoid=html2wt Don't strip leading whitespace when handling indent-pre suppressing tags !! options parsoid=html2wt -!! html +!! html/parsoid
    indented row
    @@ -24257,31 +24338,31 @@ foo Nowiki-wrap leading whitespace when handling indent-pre inducing tags !! options parsoid=html2wt -!! wikitext -foo - bar +!! html/parsoid +

    foo

    + bar foo2 - bar2 + bar2
    foo
    - bar + bar
    - foo + foo
    -!! html -

    foo

    - bar +!! wikitext +foo + bar foo2 - bar2 + bar2
    foo
    - bar + bar
    - foo + foo
    !! end @@ -24289,7 +24370,7 @@ foo Lists: Dont insert newlines in a serialized list item. !! options parsoid=html2wt -!! html +!! html/parsoid
    • a
      b
    • c
    !! wikitext * a
    b @@ -24303,14 +24384,14 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": false } -!! html -

    hello there

    -

    hi pal

    +!! html/parsoid +

    hello there

    +

    hi pal

    -

    how goes it

    -

    it goes well

    +

    how goes it

    +

    it goes well

    -

    howdy

    +

    howdy

    ok

    !! wikitext @@ -24334,14 +24415,12 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html -

    hello there

    -

    hi pal

    - -

    how goes it

    -

    it goes well

    +!! html/parsoid +

    hello there

    +

    hi pal

    -

    howdy

    +

    how goes it

    +

    it goes well

    ok

    !! wikitext @@ -24358,8 +24437,6 @@ parsoid={ == it goes well == [[Category:A4]] -==howdy [[Category:A5]] == - __TOC__ == ok == @@ -24372,7 +24449,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid

    foo

    !! wikitext == {{echo|foo [[Category:Foo]]}} == @@ -24385,7 +24462,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid

    foo [1]

    1. ↑ bar
    @@ -24400,7 +24477,7 @@ parsoid={ Parsoid: Serialize positional parameters with = in them as named parameter !! options parsoid=html2wt -!! html +!! html/parsoid

    foo

    @@ -24424,7 +24501,7 @@ data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"}, Parsoid: Serialize positional parameters with = in extlink as named parameter !! options parsoid=html2wt -!! html +!! html/parsoid

    http://stuff?is=ok

    !! wikitext {{echo|1 = http://stuff?is=ok}} @@ -24434,7 +24511,7 @@ parsoid=html2wt Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes !! options parsoid=html2wt -!! html +!! html/parsoid
    a

    b

    a

    b

    @@ -24459,7 +24536,7 @@ b Substrings resembling wikitext in hrefs should not get nowiki escapes !! options parsoid=html2wt -!! html +!! html/parsoid Foo''bar''baz !! wikitext [[Foo''bar''baz]] @@ -24469,7 +24546,7 @@ parsoid=html2wt Enforce single-line context in the serializer !! options parsoid=html2wt -!! html +!! html/parsoid

    testing 123

    @@ -24528,7 +24605,7 @@ ha Serialize new placeholder space without spans !! options parsoid=html2wt -!! html +!! html/parsoid

    foo : bar

    foo : bar

    @@ -24551,7 +24628,7 @@ foo : bar 1. I/B quote minimization: wikitext-only tags should be combined !! options parsoid=html2wt -!! html +!! html/parsoid

    AB

    AB

    AB

    @@ -24582,7 +24659,7 @@ parsoid=html2wt 2. I/B quote minimization: wikitext and html tags should not be combined !! options parsoid=html2wt -!! html +!! html/parsoid

    AB

    AB

    !! wikitext @@ -24595,7 +24672,7 @@ parsoid=html2wt 3. I/B quote minimization: templated content stops minimization !! options parsoid=html2wt -!! html +!! html/parsoid

    AB

    AB !! wikitext @@ -24608,7 +24685,7 @@ parsoid=html2wt 4. I/B quote minimization: new content should be mimimized with adjacent old content !! options parsoid=html2wt -!! html +!! html/parsoid

    AB

    AB

    AB

    @@ -24657,7 +24734,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid Football Football Football @@ -24674,7 +24751,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid Football !! wikitext [[Football|''Football'']] @@ -24687,7 +24764,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": false } -!! html +!! html/parsoid Football !! wikitext [[Football|Foot]][[Football|ball]] @@ -24701,10 +24778,10 @@ parsoid={ Bug 54262: New entities !! options parsoid=html2wt +!! html/parsoid +  !! wikitext   -!! html -  !! end ## Note that there is no wikitext output for 'unknownproperty' ## @@ -24741,7 +24818,7 @@ __NOCONTENTCONVERT__ Consecutive
    s should not get merged
     !! options
     parsoid=html2wt,html2html
    -!! html
    +!! html/parsoid
     
    a
    b
    c
    @@ -24773,7 +24850,7 @@ f
    Edited ISBN links not serializable as ISBN links should serialize as wikilinks !! options parsoid=html2wt -!! html +!! html/parsoid ISBN 1234567895 !! wikitext [[Special:BookSources/1234567890|ISBN 1234567895]] @@ -24783,7 +24860,7 @@ parsoid=html2wt Edited RFC links not serializable as RFC links should serialize as extlinks !! options parsoid=html2wt -!! html +!! html/parsoid New RFC !! wikitext [//tools.ietf.org/html/rfc123 New RFC] @@ -24793,7 +24870,7 @@ parsoid=html2wt Edited PMID links not serializable as PMID links should serialize as extlinks !! options parsoid=html2wt -!! html +!! html/parsoid New PMID !! wikitext [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID] @@ -24874,11 +24951,21 @@ parsoid=html2wt http://example.com is not a link. !! end +!! test +WTS of autolink-like text after an autolink (T108563) +!! options +parsoid=html2wt +!! html/parsoid +

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

    +!! wikitext +http://example.com http://example.com is not a link. +!! end + !! test Edited Redirect link should emit a non-piped wikitext link !! options parsoid=html2wt -!! html +!! html/parsoid !! wikitext #REDIRECT [[Bar]] @@ -24888,7 +24975,7 @@ parsoid=html2wt T75121: Infer extension name from typeOf if data-mw is not present !! options parsoid=html2wt -!! html +!! html/parsoid
    !! wikitext @@ -24948,7 +25035,7 @@ parsoid=html2wt,wt2wt HTML id attribute with Parsoid-like element ids should not be serialized to wikitext !! options parsoid=html2wt -!! html +!! html/parsoid @@ -24964,7 +25051,7 @@ parsoid=html2wt Parsoid-like element ids should not be serialized to wikitext unless shadowed !! options parsoid=html2wt -!! html +!! html/parsoid
    ok
    !! wikitext
    ok
    @@ -24991,7 +25078,7 @@ parsoid={ Never serialize a-tag as html, regardless of what data-parsoid has to say !! options parsoid=html2wt -!! html +!! html/parsoid Foo !! wikitext [[Foo]] @@ -25005,12 +25092,25 @@ parsoid=html2wt Never serialize a-tag as html, no matter what attributes it has !! options parsoid=html2wt -!! html +!! html/parsoid !! wikitext [http://boo.org http://boohoo.org] !! end +# Misnested is an indication that selser can reuse the source but these have +# shown to sneak through on occasion. See T101768. +# The original wikitext here is: [http://test.com [[one]] two three] +!! test +Strip span tags added to mark as misnested +!! options +parsoid=html2wt +!! html/parsoid +

    one two three

    +!! wikitext +[http://test.com][[one]] two three +!! end + # -------------------------------------------- # Tests spec'ing wikitext serialization norms | # -------------------------------------------- @@ -25019,7 +25119,7 @@ parsoid=html2wt Lists: Add space after bullets !! options parsoid=html2wt -!! html +!! html/parsoid
    • foo
    • bar
    • @@ -25035,7 +25135,7 @@ parsoid=html2wt 1. Headings: Add space before/after == (T53744) !! options parsoid=html2wt -!! html +!! html/parsoid

      foo

      bar

      baz

      @@ -25057,8 +25157,8 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html -

      ok

      +!! html/parsoid +

      ok

      !! wikitext [[Category:A2]] @@ -25072,7 +25172,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid

      !! wikitext !! end @@ -25081,23 +25181,25 @@ parsoid={ 2. Headings: don't suppress empty headings if scrubWikitext is false !! options parsoid=html2wt -!! html +!! html/parsoid

      !! wikitext ==== !! end !! test -3. Headings: don't suppress empty headings for existing headings even if scrubWikitext is true +3. Headings: suppress empty headings on edits !! options parsoid={ - "modes": ["html2wt"], - "scrubWikitext": true + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + [ "#x", "remove"] + ] } -!! html -

      !! wikitext -==== +==foo== +!! wikitext/edited !! end !! test @@ -25107,7 +25209,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid !! wikitext !! end @@ -25116,20 +25218,160 @@ parsoid={ 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false !! options parsoid=html2wt -!! html +!! html/parsoid !! wikitext '''''''''' !! end !! test -1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph +3. WT Quote Tags: suppress empty style tags on edits +!! options +parsoid={ + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + [ "#x", "remove"] + ] +} +!! wikitext +'''foo''' +!! wikitext/edited +!! end + +!! test +1. Anchors: suppress newly created empty anchors +!! options +parsoid={ + "modes": ["html2wt"], + "scrubWikitext": true +} +!! html/parsoid + +!! wikitext +!! end + +!! test +2. Anchors: don't suppress empty anchors if scrubWikitext is false +!! options +parsoid={ + "modes": ["html2wt"], + "scrubWikitext": false +} +!! html/parsoid + +!! wikitext +[[Test|]] +!! end + +!! test +3. Anchors: suppress empty anchors on edits +!! options +parsoid={ + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + [ "#x", "remove"] + ] +} +!! wikitext +[[Test|foo]] +!! wikitext/edited +!! end + +!! test +3a. Anchors: do not suppress numbered extlinks +!! options +parsoid={ + "modes": ["wt2wt"], + "scrubWikitext": true +} +!! wikitext +[http://foo.com] +!! html/parsoid + +!! end + +!! test +3b. Anchors: do not suppress numbered extlinks +!! options +parsoid={ + "modes": ["wt2wt"], + "scrubWikitext": true, + "changes": [ + [ "#x", "remove"] + ] +} +!! wikitext +[http://foo.com foo] +!! wikitext/edited +[http://foo.com] +!! end + +!!test +Normalizations should be restricted to edited content +!!options +parsoid={ + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + [ "h1", "before", ""] + ] +} +!!wikitext +a += = +b +!!wikitext/edited +a += = +b +!!end + +!! test +1. Multiple normalizations (html2wt) !! options parsoid={ "modes": ["html2wt"], "scrubWikitext": true } !! html +

      +

      foo + x

      +!! wikitext + +[[foo]] +x + +!! end + +!! test +2. Multiple normalizations (selser) +!! options +parsoid={ + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + [ "#x", "after", "

      \n

      x

      "] + ] +} +!! wikitext +foo +!! wikitext/edited +foo + +x +!! end + +!! test +1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph +!! options +parsoid={ + "modes": ["html2wt"], + "scrubWikitext": true +} +!! html/parsoid

      hi

      hello

      !! wikitext @@ -25142,7 +25384,7 @@ hello 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false !! options parsoid=html2wt -!! html +!! html/parsoid

      hi

      hello

      !! wikitext @@ -25190,6 +25432,23 @@ foo barboo !! end +!! test +4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs +!! options +parsoid={ + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + [ "p", "html", " a\n b" ] + ] +} +!! wikitext +xyz +!! wikitext/edited +a +b +!! end + !! test 1. New links that end in spaces !! options @@ -25197,13 +25456,16 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": false } -!! html +!! html/parsoid

      Berlin is the capital of Germany.

      Foo bar

      +

      Boston is a city.

      !! wikitext [[Berlin ]]is the capital of Germany. [[Foo ]]'''bar''' + +[[Boston ]] is a city. !! end !! test @@ -25213,30 +25475,195 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid

      Berlin is the capital of Germany.

      Foo bar

      +

      Boston is a city.

      !! wikitext [[Berlin]] is the capital of Germany. [[Foo]] '''bar''' + +[[Boston]] is a city. +!! end + +!! test +1. Table cells with escapable prefixes +!! options +parsoid={ + "modes": ["html2wt"], + "scrubWikitext": false +} +!! html +
    foo bar
    + + + +
    a
    -
    +
    +!! wikitext +{| +|a +|- +|- +|- +|+ +|} !! end !! test -3. Existing links that end in spaces +2. Table cells with escapable prefixes !! options parsoid={ "modes": ["html2wt"], "scrubWikitext": true } !! html -

    Berlin is the capital of Germany.

    + + + + +
    a
    -
    +
    +!! wikitext +{| +|a +|- +| - +|- +| + +|} +!! end + +!! test +3a. Table cells with escapable prefixes after edits +!! options +parsoid={ + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + [ "table tbody tr:first-child td:first-child", "remove"] + ] +} +!! wikitext +{| +|a||- +|} +!! wikitext/edited +{| +| - +|} +!! end -

    Foo bar

    +!! test +3b. Table cells with escapable prefixes after edits +!! options +parsoid={ + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + [ "table tbody tr:first-child td:first-child", "html", "-" ], + [ "#x", "remove" ] + ] +} !! wikitext -[[Berlin ]]is the capital of Germany. +{| +|pqr +|foo+ +|} +!! wikitext/edited +{| +| - +| + +|} +!! end -[[Foo ]]'''bar''' +# FIXME: This test will fail because +# normalization doesn't realize that the id attribute +# will eliminate the escapable scenario +!! test +4a. Table cells without escapable prefixes after edits +!! options +parsoid={ + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + [ "#x", "html", "-" ] + ] +} +!! wikitext +{| +| id="x" |abcd +|} +!! wikitext/edited +{| +| id="x" |- +|} +!! end + +## This tests normalizer's ability to discriminate between +## cells having identical content. +!! test +4b. Table cells without escapable prefixes after edits +!! options +parsoid={ + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + [ "td", "html", "-" ] + ] +} +!! wikitext +{| +|a||b +|} +!! wikitext/edited +{| +| -||- +|} +!! end + +## This tests normalizer's ability to not be tripped by +## comments (and whitespace) +!! test +4c. Table cells without escapable prefixes after edits +!! options +parsoid={ + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + [ "table tbody tr td:first-child", "remove" ] + ] +} +!! wikitext +{| +|- + |a||- +|} +!! wikitext/edited +{| +|- + | - +|} +!! end + +## This tests normalizer's ability to handle HTML cells +!! test +4d. Table cells without escapable prefixes after edits +!! options +parsoid={ + "modes": ["selser"], + "scrubWikitext": true, + "changes": [ + [ "td", "html", "-" ] + ] +} +!! wikitext + + +
    a
    +!! wikitext/edited + + +
    -
    !! end # ---------------------------------------------------