From f9de807e28c5194ef4e2ddbcf31375041816fab6 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Tue, 16 May 2017 15:12:22 -0400 Subject: [PATCH] Sync up with Parsoid parserTests.txt This now aligns with Parsoid commit d163deefa3aaeb0926af09a91075d6a611b36363 Change-Id: I9e543f0803247ffc264e634bf66b6bd0e143f187 --- tests/parser/parserTests.txt | 314 +++++++++++++++++++++++++++++------ 1 file changed, 266 insertions(+), 48 deletions(-) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 6477356c8a..2d107e7752 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -2736,6 +2736,39 @@ Templates: Don't strip whitespace from positional-param values !! end +!! test +Templates: Don't recognize targets split by newlines +!! options +parsoid=wt2html +!! wikitext +{{ech +o|foo}} +!! html/php +

{{ech +o|foo}} +

+!! html/parsoid +

{{ech +o|foo}}

+!! end + +!! test +Templates: Recognize targets when newlines and comments don't split the target +!! options +parsoid=wt2html +!! wikitext +{{ + echo + + + |foo}} +!! html/php +

foo +

+!! html/parsoid +

foo

+!! end + !! test Templates: Handle empty comment-and-ws-only lines correctly !! wikitext @@ -5272,6 +5305,49 @@ Bracketed external links with template-generated invalid target

!! end +# wt2html only because Parsoid would want to add s coming from html +!! test +Broken wikilinks (but not external links) prevent templates from closing +!! options +parsoid=wt2html +!! wikitext +[http://example.com x + +{{echo|[http://example.com x}} + +[[Foo + +{{echo|[[Foo}} +!! html/php +

[http://example.com x +

[http://example.com x +

[[Foo +

{{echo|[[Foo}} +

+!! html/parsoid +

[http://example.com x

+

[http://example.com x

+

[[Foo

+

{{echo|[[Foo}}

+!! end + +!! test +Broken templates +!! options +parsoid=wt2html +!! wikitext +{{echo|[[Foo|}}]] + +[[Foo|{{echo|]]}} +!! html/php +

{{echo|}} +

[[Foo|]] +

+!! html/parsoid +

{{echo|}}

+

[[Foo|]]

+!! end + !! test T4702: Mismatched , and tags are invalid !! wikitext @@ -7848,7 +7924,7 @@ File containing double quotes and spaces !! wikitext [[File:Cool "Gator".png]] !! html/parsoid -

+

!! end !! test @@ -7896,7 +7972,7 @@ Link with double quotes in title part (literal) and alternate part (interpreted)

Pentecoste

!! html/parsoid -

+

''Pentecoste''

Pentecoste

Pentecoste

@@ -7916,10 +7992,10 @@ Broken image links with HTML captions (T41700) abc

!! html/parsoid -

- - -

+

+ + +

!! end !! test @@ -10435,15 +10511,26 @@ Parsoid: Page property magic word with magic word contents !! wikitext {{DISPLAYTITLE:''{{PAGENAME}}''}} !! html/parsoid - + !! end +# NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better. +# But, this is a limitation of our representation and is documented in +# TemplateHandler.js in processSpecialMagicWord !! test Parsoid: Template-generated DISPLAYTITLE !! wikitext {{{{echo|DISPLAYTITLE}}:Foo}} +!! options +showtitle +!! config +wgAllowDisplayTitle=true +wgRestrictDisplayTitle=false +!! html/php +Foo + !! html/parsoid - + !! end !! test @@ -11006,6 +11093,39 @@ Template with complex template as argument

!! end +!! test +Templates with templated name +!! wikitext +{{{{echo|echo}}|foo}} +{{{{echo|inner list}} }} +!! html +

foo +

+
  • item 1
+ +!! html/parsoid +

foo

+
  • item 1
+!! end + +# Parsoid markup is deliberate "broken". This is an edge case. +# See long comment in TemplateHandler.js:convertAttribsToString. +!! test +Templates with invalid templated targets +!! wikitext +{{echo +{{echo|foo}} +}} +!! html/php +

{{echo +foo +}} +

+!! html/parsoid +

{{echo +foo }}

+!! end + !! test Template with thumb image (with link in description) !! wikitext @@ -11021,7 +11141,7 @@ This is a test template with parameter
This is a test template with parameter

link caption
+

This is a test template with parameter

link caption
!! end !! article @@ -11253,17 +11373,23 @@ T2041: Template parameters shown as broken links !! test Template with targets containing wikilinks +!! options +parsoid=wt2html !! wikitext {{[[foo]]}} {{[[{{echo|foo}}]]}} {{{{echo|[[foo}}]]}} -!! html +!! html/php

{{foo}}

{{foo}}

{{[[foo}}]]

+!! html/parsoid +

{{foo}}

+

{{foo}}

+

{{[[foo}}]]

!! end !! article @@ -13112,6 +13238,17 @@ pst [[:Bar:Article (context),context|Article]] !! end +!! test +Parsoid: backwards pipe trick +!! wikitext +[[|'''bar''']] +!! html/php +

[[|bar]] +

+!! html/parsoid +

[[|bar]]

+!! end + !! test pre-save transform: trim trailing empty lines !! options @@ -14318,7 +14455,7 @@ Entities in file name and attributes

7% solution

!! html/parsoid -

+

!! end !! test @@ -14533,7 +14670,7 @@ wgEnableUploads=0

File:Foobaz.jpg

!! html/parsoid -

+

!! end # Parsoid-specific testing for images @@ -14866,6 +15003,7 @@ Render invalid page names as plain text (T53090) [[.]] [[..]] [[foo././bar]] +[[foo[http://example.com]xyz]] [[{{echo|./../foo}}|bar]] [[{{echo|foo/.}}|bar]] @@ -14889,6 +15027,7 @@ Render invalid page names as plain text (T53090) [[.]] [[..]] [[foo././bar]] +[[foo[1]xyz]]

[[./../foo|bar]] [[foo/.|bar]] [[foo/..|bar]] @@ -14911,7 +15050,8 @@ Render invalid page names as plain text (T53090) [[foo[bar]] [[.]] [[..]] -[[foo././bar]]

+[[foo././bar]] +[[fooxyz]]

[[./../foo|bar]] [[foo/.|bar]] @@ -15377,12 +15517,15 @@ Parsoid: Defaultsort !! end +# NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better. +# But, this is a limitation of our representation and is documented in +# TemplateHandler.js in processSpecialMagicWord !! test Parsoid: Defaultsort (template-generated) !! wikitext {{{{echo|DEFAULTSORT}}:Foo}} !! html/parsoid - + !! end ### @@ -16374,18 +16517,22 @@ Nesting of Media link !! wikitext [[Media:Foobar.jpg]] -!! html +!! html/php

Media:Foobar.jpg

+!! html/parsoid +

Media:Foobar.jpg

!! end !! test Media link with text !! wikitext [[Media:Foobar.jpg|A neat file to look at]] -!! html +!! html/php

A neat file to look at

+!! html/parsoid +

A neat file to look at

!! end # FIXME: this is still bad HTML tag nesting @@ -16394,21 +16541,29 @@ Media link with text Media link with nasty text !! wikitext [[Media:Foobar.jpg|Safe Link
" onmouseover="alert(document.cookie)" onfoo="
]] -!! html +!! html/php Safe Link<div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div> -!! html+tidy +!! html+php/tidy

Safe Link

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

Safe Link

+ !! end !! test Media link to nonexistent file (T3702) !! wikitext [[Media:No such.jpg]] -!! html +[[Media:No_such file.jpg]] +!! html/php

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

+!! html/parsoid +

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

!! end !! test @@ -16419,7 +16574,7 @@ Image link to nonexistent file (T3850 - good)

File:No such.jpg

!! html/parsoid -

+

!! end !! test @@ -17427,14 +17582,12 @@ all additional text is vanished !! test Self closed html pairs (T7487) -!! options !! wikitext
Centered text
In div text
-!! html -
<font id="bug" />Centered text
-
<font id="bug2" />In div text
- +!! html+tidy +
Centered text
+
In div text
!! end # @@ -17888,8 +18041,8 @@ MOVE YOUR MOUSE CURSOR OVER THIS TEXT !! html/parsoid

{{{| - -

MOVE YOUR MOUSE CURSOR OVER THIS TEXT

+}}}} > +

MOVE YOUR MOUSE CURSOR OVER THIS TEXT

@@ -17966,7 +18119,7 @@ Fuzz testing: image with bogus manual thumbnail
Error creating thumbnail:
!! html/parsoid -
+
!! end !! test @@ -19988,7 +20141,7 @@ djvu

LoremIpsum.djvu

!! html/parsoid -

+

!! end !! test @@ -20287,9 +20440,11 @@ ISBN --- ISBN with space-delimited number !! wikitext ISBN 92 9017 032 8 -!! html +!! html/php

ISBN 92 9017 032 8

+!! html/parsoid +

ISBN 92 9017 032 8

!! end @@ -20311,11 +20466,17 @@ ISBN 123456789 ISBN 1234567890 ISBN 12345678901 -!! html +!! html/php

ISBN 123456789

ISBN 1234567890

ISBN 12345678901

+!! html/parsoid +

ISBN 123456789

+ +

ISBN 1234567890

+ +

ISBN 12345678901

!! end @@ -20325,10 +20486,14 @@ ISBN with trailing year (T9110) ISBN 1-234-56789-0 - 2006 ISBN 1 234 56789 0 - 2006 -!! html +!! html/php

ISBN 1-234-56789-0 - 2006

ISBN 1 234 56789 0 - 2006

+!! html/parsoid +

ISBN 1-234-56789-0 - 2006

+ +

ISBN 1 234 56789 0 - 2006

!! end @@ -22082,7 +22247,7 @@ percent-encoding and + signs in internal links (T28410) !! html/parsoid

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

!! end @@ -22096,8 +22261,8 @@ Special characters in embedded file links (T29679) Title with & ampersand

!! html/parsoid -

-

+

+

!! end !! test @@ -22220,6 +22385,12 @@ language=en

!! end +# Note that Parsoid doesn't emit an explicit TOC. +# Note also that the html2wt direction tends to emit an extra newline +# between the __TOC__ magicword and the first heading unless *both* +# the and the

have a data-parsoid attribute set (even if +# it's "{}"). + !! test T28375: TOC with italics !! options @@ -22227,7 +22398,7 @@ title=[[Main Page]] !! wikitext __TOC__ == ''Lost'' episodes == -!! html +!! html/php

Contents

  • 1 Lost episodes
  • @@ -22236,6 +22407,9 @@ __TOC__

    Lost episodes[edit]

    +!! html/parsoid + +

    Lost episodes

    !! end !! test @@ -22245,7 +22419,7 @@ title=[[Main Page]] !! wikitext __TOC__ == '''should be bold''' then normal text == -!! html +!! html/php

    Contents

    • 1 should be bold then normal text
    • @@ -22254,6 +22428,9 @@ __TOC__

      should be bold then normal text[edit]

      +!! html/parsoid + +

      should be bold then normal text

      !! end !! test @@ -22263,7 +22440,7 @@ title=[[Main Page]] !! wikitext __TOC__ == Image [[Image:foobar.jpg]] == -!! html +!! html/php

      Contents

      • 1 Image
      • @@ -22272,6 +22449,9 @@ __TOC__

        Image Foobar.jpg[edit]

        +!! html/parsoid + +

        Image

        !! end !! test @@ -22281,7 +22461,7 @@ title=[[Main Page]] !! wikitext __TOC__ ==
        Quote
        == -!! html +!! html/php

        Contents

        • 1 Quote
        • @@ -22290,7 +22470,7 @@ __TOC__

          Quote
          [edit]

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

          @@ -22306,6 +22486,9 @@ __TOC__

          Quote

          [edit]

          +!! html/parsoid + +

          Quote

          !! end !! test @@ -22317,7 +22500,7 @@ __TOC__ == Proof: 2 < 3 == Hanc marginis exiguitas non caperet. QED -!! html +!! html/php

          Contents

          • 1 Proof: 2 < 3
          • @@ -22328,6 +22511,11 @@ QED

            Hanc marginis exiguitas non caperet. QED

            +!! html/parsoid + +

            Proof: 2 < 3

            +

            Hanc marginis exiguitas non caperet. +QED

            !! end !! test @@ -22337,7 +22525,7 @@ __TOC__ == Foo Bar == == Foo
            Bar
            == -!! html +!! html/php

            Contents

            • 1 Foo Bar
            • @@ -22348,7 +22536,7 @@ __TOC__

              Foo Bar[edit]

              Foo
              Bar
              [edit]

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

              @@ -22366,6 +22554,10 @@ __TOC__

              Bar

              [edit]

              +!! html/parsoid + +

              Foo Bar

              +

              Foo
              Bar

              !! end # Don't expect Parsoid to roundtrip this until the php parser comes closer to @@ -22410,7 +22602,7 @@ __TOC__ == All attributes on these span tags must be deleted from the TOC == == Attributes after dir on these span tags must be deleted from the TOC == -!! html +!! html/php

              Contents

              • 1 C++
              • @@ -22427,6 +22619,13 @@ __TOC__

                All attributes on these span tags must be deleted from the TOC[edit]

                Attributes after dir on these span tags must be deleted from the TOC[edit]

                +!! html/parsoid + +

                C++

                +

                זבנג!

                +

                The attributes on these span tags must be deleted from the TOC

                +

                All attributes on these span tags must be deleted from the TOC

                +

                Attributes after dir on these span tags must be deleted from the TOC

                !! end !! test @@ -22434,7 +22633,7 @@ T74884: bdi element in ToC !! wikitext __TOC__ == test == -!! html +!! html/php

                Contents

                • 1 test
                • @@ -22443,6 +22642,9 @@ __TOC__

                  test[edit]

                  +!! html/parsoid + +

                  test

                  !! end !! test @@ -22450,7 +22652,7 @@ T35715: s/strike element in ToC !! wikitext __TOC__ == test test test == -!! html +!! html/php

                  Contents

                  • 1 test test test
                  • @@ -22459,6 +22661,9 @@ __TOC__

                    test test test[edit]

                    +!! html/parsoid + +

                    test test test

                    !! end # Note that the html output does not have the

                    , but the @@ -22469,7 +22674,7 @@ Empty

                    tag in TOC, removed by Sanitizer (T92892) !! wikitext __TOC__ == x == -!! html +!! html/php

                    Contents

                    • 1 x
                    • @@ -22478,7 +22683,7 @@ __TOC__

                      x[edit]

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

                      @@ -22490,6 +22695,9 @@ __TOC__

                      x[edit]

                      +!! html/parsoid + +

                      x

                      !! end !! article @@ -26700,6 +26908,16 @@ parsoid=html2wt [http://test.com][[one]] two three !! end +!! test +Catch regression when unpacking misnested links +!! options +parsoid=wt2html +!! wikitext +{{echo|hi}}[http://example.com [[ho]]] +!! html/parsoid +

                      hiho

                      +!! end + !! test Use data-parsoid.firstWikitextNode to compute newline constraints for template content !! options -- 2.20.1