From 59e8147b67f2d9b3d6db6132917b27ea2463e8aa Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Mon, 17 Aug 2015 16:52:33 -0400 Subject: [PATCH] Sync up with Parsoid parserTests. This now aligns with Parsoid commit 48617c40c2eb9c7a421bb9c5b3ba0907fdec9c21 Change-Id: I565886079e64985844fc0a7c67ab74340b42f84a --- tests/parser/parserTests.txt | 847 ++++++++++++++++++++++++++--------- 1 file changed, 636 insertions(+), 211 deletions(-) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 1d331dff50..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 *foo

    !! wikitext *foo @@ -22059,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'' @@ -22435,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 @@ -22751,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 @@ -23001,7 +23079,7 @@ parsoid 5. Nowiki escaping should account for indent-pres !! options parsoid=html2wt -!! html +!! html/parsoid
    ==foo==
    !! wikitext ==foo== @@ -23027,7 +23105,7 @@ parsoid 1. Valid behavior switches should be escaped !! options parsoid=html2wt -!! html +!! html/parsoid __TOC__ __TOC__ !! wikitext @@ -23039,7 +23117,7 @@ __TOC__ 2. Invalid behavior switches should not be escaped !! options parsoid=html2wt -!! html +!! html/parsoid __TOO__ __|__ !! wikitext @@ -23874,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]] @@ -23885,7 +23963,7 @@ parsoid=html2wt New wikilinks should be serialized properly !! options parsoid=html2wt -!! html +!! html/parsoid Foo Foo !! wikitext @@ -23897,7 +23975,7 @@ parsoid=html2wt New wiki links (href variations) !! options parsoid=html2wt -!! html +!! html/parsoid Foo_bar Foo_bar Foo_bar @@ -23913,7 +23991,7 @@ parsoid=html2wt New wiki links (content string variations) !! options parsoid=html2wt -!! html +!! html/parsoid Foo_bar Foo bar ./Foo_bar @@ -23927,7 +24005,7 @@ parsoid=html2wt New category links (href variations) !! options parsoid=html2wt -!! html +!! html/parsoid @@ -23942,7 +24020,7 @@ New sol transparent links don't need indent-pre nowiki protection !! options parsoid=html2wt language=de -!! html +!! html/parsoid @@ -23956,7 +24034,7 @@ language=de New interlanguage links (href variations) !! options parsoid=html2wt -!! html +!! html/parsoid @@ -24103,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 @@ -24204,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

    @@ -24216,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 @@ -24226,7 +24305,7 @@ parsoid=html2wt Don't strip leading whitespace when handling indent-pre suppressing tags !! options parsoid=html2wt -!! html +!! html/parsoid
    indented row
    @@ -24259,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 @@ -24291,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 @@ -24305,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 @@ -24336,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 @@ -24360,8 +24437,6 @@ parsoid={ == it goes well == [[Category:A4]] -==howdy [[Category:A5]] == - __TOC__ == ok == @@ -24374,7 +24449,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid

    foo

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

    foo [1]

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

    foo

    @@ -24426,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}} @@ -24436,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

    @@ -24461,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]] @@ -24471,7 +24546,7 @@ parsoid=html2wt Enforce single-line context in the serializer !! options parsoid=html2wt -!! html +!! html/parsoid

    testing 123

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

    foo : bar

    foo : bar

    @@ -24553,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

    @@ -24584,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 @@ -24597,7 +24672,7 @@ parsoid=html2wt 3. I/B quote minimization: templated content stops minimization !! options parsoid=html2wt -!! html +!! html/parsoid

    AB

    AB !! wikitext @@ -24610,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

    @@ -24659,7 +24734,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid Football Football Football @@ -24676,7 +24751,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid Football !! wikitext [[Football|''Football'']] @@ -24689,7 +24764,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": false } -!! html +!! html/parsoid Football !! wikitext [[Football|Foot]][[Football|ball]] @@ -24703,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' ## @@ -24743,7 +24818,7 @@ __NOCONTENTCONVERT__ Consecutive
    s should not get merged
     !! options
     parsoid=html2wt,html2html
    -!! html
    +!! html/parsoid
     
    a
    b
    c
    @@ -24775,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]] @@ -24785,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] @@ -24795,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] @@ -24876,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]] @@ -24890,7 +24975,7 @@ parsoid=html2wt T75121: Infer extension name from typeOf if data-mw is not present !! options parsoid=html2wt -!! html +!! html/parsoid
    !! wikitext @@ -24950,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 @@ -24966,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
    @@ -24993,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]] @@ -25007,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 | # -------------------------------------------- @@ -25021,7 +25119,7 @@ parsoid=html2wt Lists: Add space after bullets !! options parsoid=html2wt -!! html +!! html/parsoid
    • foo
    • bar
    • @@ -25037,7 +25135,7 @@ parsoid=html2wt 1. Headings: Add space before/after == (T53744) !! options parsoid=html2wt -!! html +!! html/parsoid

      foo

      bar

      baz

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

      ok

      +!! html/parsoid +

      ok

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

      !! wikitext !! end @@ -25083,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 @@ -25109,7 +25209,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid !! wikitext !! end @@ -25118,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 @@ -25144,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 @@ -25192,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 @@ -25199,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 @@ -25215,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 # --------------------------------------------------- -- 2.20.1