X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fparser%2FparserTests.txt;h=72ee550109ace80421838d2ffe2e96eb4086547a;hb=fd3773685b887dc2b4fa856907a9cf5229df74ac;hp=d47637345d9d961d01f156223f7668206758d1fc;hpb=1e6931aebe91886cf5ca155bfdc57efbf2aa7d17;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index d47637345d..72ee550109 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -546,15 +546,19 @@ Extra newlines between heading and content are swallowed Heading with line break in nowiki !! options parsoid=wt2html +!! config +wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext == A B C == -!! html -

A B +!! html/php +

A B C[edit]

!! html/parsoid -

A B +

A B C

!! end @@ -1912,6 +1916,33 @@ a
foo

b

!! end +!! test +No p-wrappable content +!! wikitext +
x
+
x
+
x
+!! html+tidy +
x
+
x
+
x
+!! html/parsoid +
x
+
x
+
x
+!! end + +# T177612: Parsoid-only test +!! test +Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code +!! wikitext +{{echo|
x
}} +x +!! html/parsoid +
x
+

x

+!! end + !! test Block tag on one line (
) !! wikitext @@ -4338,12 +4369,12 @@ Definition Lists: Mixed Lists: Test 10 !! test Definition Lists: Mixed Lists: Test 11 !! wikitext -;a -:*b -!! html -
a
+; a +:* b +!! html/* +
a
-
  • b
+
  • b
!! end @@ -4806,8 +4837,11 @@ foo//example.com/Foo

!! end +## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia: !! test External links: with no contents +!! options +parsoid=wt2html,wt2wt !! wikitext [http://en.wikipedia.org/wiki/Foo] @@ -4821,8 +4855,8 @@ External links: with no contents

!! html/parsoid

-

Bar

-

Bar

+

Bar

+

Bar

!! end !! test @@ -4911,7 +4945,7 @@ External links: Free with trailing quotes (T113666) news:'a'b''c''d e !! html/php

News: Stuff here -

news:'a'bcd e +

news:'a'bcd e

!! html/parsoid

News: Stuff here

@@ -5557,8 +5591,8 @@ External link containing a single quote. (T65947) [//foo.org/bar'baz bang] !! html/php -

[1] -

bang +

[1] +

bang

!! html/parsoid

@@ -5676,7 +5710,7 @@ Examples from RFC 2732, section 2: !! html/php

http://[2404:130:0:1000::187:2]/index.php -

Examples from RFC 2373, section 2.2: +

Examples from RFC 2373, section 2.2:

-

Examples from RFC 2732, section 2: +

Examples from RFC 2732, section 2:

  • http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
  • http://[1080:0:0:0:8:800:200C:417A]/index.html
  • @@ -5697,7 +5731,7 @@ Examples from RFC 2732, section 2: !! html/parsoid

    http://[2404:130:0:1000::187:2]/index.php

    -

    Examples from RFC 2373, section 2.2:

    +

    Examples from RFC 2373, section 2.2:

    -

    Examples from RFC 2732, section 2:

    +

    Examples from RFC 2732, section 2:

    • http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
    • http://[1080:0:0:0:8:800:200C:417A]/index.html
    • http://[3ffe:2a00:100:7031::1]
    • @@ -5739,7 +5773,7 @@ Examples from RFC 2732, section 2: !! html/php

      test -

      Examples from RFC 2373, section 2.2: +

      Examples from RFC 2373, section 2.2:

      -

      Examples from RFC 2732, section 2: +

      Examples from RFC 2732, section 2:

      • 1
      • 2
      • @@ -5760,7 +5794,7 @@ Examples from RFC 2732, section 2: !! html/parsoid

        test

        -

        Examples from RFC 2373, section 2.2:

        +

        Examples from RFC 2373, section 2.2:

        -

        Examples from RFC 2732, section 2:

        +

        Examples from RFC 2732, section 2:

        • 1
        • 2
        • 3
        • @@ -5935,11 +5969,11 @@ parsoid=html2wt !! wikitext [[Foo|Bar]] [[Foo|Bar]] -[[wikipedia:Foo|Bar]] -[[wikipedia:Foo|Bar]] +[[:en:Foo|Bar]] +[[:en:Foo|Bar]] -[[wikipedia:European_Robin|European Robin]] -[[wikipedia:European_Robin|European Robin]] +[[:en:European_Robin|European Robin]] +[[:en:European_Robin|European Robin]] !! end !! test @@ -6320,7 +6354,7 @@ Accept "!!" in table data !! html/parsoid - +
          Foo!!
          Foo!!
          !! end @@ -6596,7 +6630,7 @@ parsoid=wt2html,html2html !! html/parsoid -
          [ftp://%7Cx]" onmouseover="alert(document.cookie)">test
          +[ftp://%7Cx]" onmouseover="alert(document.cookie)">test !! end !! test @@ -6653,7 +6687,7 @@ parsoid=wt2html !! html/parsoid - +
          style="color: red !important;" data-contrived="put this here foo
          style="color: red !important;" data-contrived="put this here foo
          !! end @@ -6685,9 +6719,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. @@ -7795,13 +7829,15 @@ Link with multiple pipes !! test Anchor containing a #. (T65430) +!! config +wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext [[Main Page#And#Link]] !! html/php -

          Main Page#And#Link +

          Main Page#And#Link

          !! html/parsoid -

          Main Page#And#Link

          +

          Main Page#And#Link

          !! end !! test @@ -7919,13 +7955,27 @@ 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 +!! config +wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext [[%23%3c]][[%23%3e]] !! html/php -

          #<#> +

          #<#>

          !! html/parsoid -

          #<#>

          +

          #<#>

          +!! end + +## Example for such a section: == < == +!! test +Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy) +!! config +wgFragmentMode=[ 'legacy' ] +!! wikitext +[[%23%3c]][[%23%3e]] +!! html/php +

          #<#> +

          !! end !! test @@ -7973,7 +8023,7 @@ Link containing double-single-quotes '' (T6598) !! wikitext [[Lista d''e paise d''o munno]] !! html/php -

          Lista d''e paise d''o munno +

          Lista d''e paise d''o munno

          !! html/parsoid

          Lista d''e paise d''o munno

          @@ -7987,7 +8037,7 @@ Link containing double quotes and spaces

          Cool "Gator"

          !! html/parsoid -

          Cool "Gator"

          +

          Cool "Gator"

          !! end !! test @@ -7995,7 +8045,7 @@ File containing double quotes and spaces !! wikitext [[File:Cool "Gator".png]] !! html/parsoid -

          +

          !! end !! test @@ -8038,12 +8088,12 @@ Link with double quotes in title part (literal) and alternate part (interpreted) [[''Pentecoste''|''Pentecoste'']] !! html/php

          File:Denys Savchenko Pentecoste.jpg -

          ''Pentecoste'' -

          Pentecoste -

          Pentecoste +

          ''Pentecoste'' +

          Pentecoste +

          Pentecoste

          !! html/parsoid -

          +

          ''Pentecoste''

          Pentecoste

          Pentecoste

          @@ -8063,10 +8113,10 @@ Broken image links with HTML captions (T41700) abc

          !! html/parsoid -

          - - -

          +

          + + +

          !! end !! test @@ -8333,7 +8383,7 @@ language=kaa !! wikitext [[Something]]'nice !! html -

          Something'nice +

          Something'nice

          !! end @@ -8517,6 +8567,31 @@ parsoid=html2wt,html2html Aðrir mótmælenda[[söfnuður]] !! end +!! test +Parsoid link bracket escaping +!! options +parsoid=html2wt,html2html +!! html/parsoid +

          Test

          +

          [Test]

          +

          [[Test]]

          +

          [[[Test]]]

          +

          [[[[Test]]]]

          +

          [[[[[Test]]]]]

          +!! wikitext +[[Test]] + +[[[Test]]] + +[[[[Test]]]] + +[[[[[Test]]]]] + +[[[[[[Test]]]]]] + +[[[[[[[Test]]]]]]] +!! end + !! test Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved !! wikitext @@ -8545,13 +8620,26 @@ Parsoid: Scoped parsing should handle mixed transclusions and plain text !! test Link with angle bracket after anchor +!! config +wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext [[Foo#]] !! html/php -

          Foo#<bar> +

          Foo#<bar>

          !! html/parsoid -

          Foo#<bar>

          +

          Foo#<bar>

          +!! end + +!! test +Link with angle bracket after anchor (legacy) +!! config +wgFragmentMode=[ 'legacy' ] +!! wikitext +[[Foo#]] +!! html/php +

          Foo#<bar> +

          !! end ### @@ -8568,7 +8656,7 @@ parsoid=wt2html,wt2wt,html2html

          MeatBall:SoftSecurity

          !! html/parsoid -

          MeatBall:SoftSecurity

          +

          MeatBall:SoftSecurity

          !! end !! test @@ -8581,11 +8669,14 @@ parsoid=wt2html,wt2wt,html2html

          MeatBall:

          !! html/parsoid -

          MeatBall:

          +

          MeatBall:

          !! end +## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia: !! test Interwiki link encoding conversion (T3636) +!! options +parsoid=wt2html,wt2wt !! wikitext *[[Wikipedia:ro:Olteniţa]] *[[Wikipedia:ro:Olteniţa]] @@ -8598,6 +8689,11 @@ Interwiki link encoding conversion (T3636)
        • Wikipedia:ro:OlteniÅ£a
        • Wikipedia:ro:OlteniÅ£a
        +!! html/parsoid + !! end !! test @@ -8611,6 +8707,27 @@ Interwiki link with fragment (T4130) !! test Link scenarios with escaped fragments +!! config +wgFragmentMode=[ 'html5', 'legacy' ] +!! wikitext +[[#Is this great?]] +[[Foo#Is this great?]] +[[meatball:Foo#Is this great?]] +!! html/php +

        #Is this great? +Foo#Is this great? +meatball:Foo#Is this great? +

        +!! html/parsoid +

        #Is this great? +Foo#Is this great? +meatball:Foo#Is this great?

        +!! end + +!! test +Link scenarios with escaped fragments (legacy) +!! config +wgFragmentMode=[ 'legacy' ] !! wikitext [[#Is this great?]] [[Foo#Is this great?]] @@ -8620,10 +8737,6 @@ Link scenarios with escaped fragments Foo#Is this great? meatball:Foo#Is this great?

        -!! html/parsoid -

        #Is this great? -Foo#Is this great? -meatball:Foo#Is this great?

        !! end # Ideally the wikipedia: prefix here should be proto-relative too @@ -8648,19 +8761,19 @@ Different interwiki prefixes mapping to the same URL [[ wikiPEdia :Foo]] !! html/parsoid -

        en:Foo

        +

        en:Foo

        -

        Foo

        +

        Foo

        -

        wikipedia:Foo

        +

        wikipedia:Foo

        -

        Foo

        +

        Foo

        -

        wikipedia:en:Foo

        +

        wikipedia:en:Foo

        -

        wikipedia:en:Foo

        +

        wikipedia:en:Foo

        -

        wikiPEdia :Foo

        +

        wikiPEdia :Foo

        !! end !! test @@ -8680,9 +8793,9 @@ Interwiki links that cannot be represented in wiki syntax is just fragment

        !! html/parsoid -

        meatball:ok -ok with fragment -ok ending with ? mark +

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

        !! end @@ -8695,7 +8808,7 @@ Interwiki links: trail

        Bar

        !! html/parsoid -

        Bar

        +

        Bar

        !! end !! test @@ -8749,7 +8862,7 @@ parsoid=wt2html,wt2wt,html2html

        local:meatball:Hello

        !! html/parsoid -

        local:meatball:Hello

        +

        local:meatball:Hello

        !! end !! test @@ -8847,8 +8960,8 @@ Blah blah blah

        !! html/parsoid

        Blah blah blah -es:Spanish - zh : Chinese

        +es:Spanish + zh : Chinese

        !! end !! test @@ -8865,7 +8978,7 @@ parsoid=wt2html [[:::es:Spanish]]

        !! html/parsoid -

        es:Spanish +

        es:Spanish [[::es:Spanish]] [[:::es:Spanish]]

        !! end @@ -8942,7 +9055,7 @@ parsoid=wt2html,wt2wt,html2html Blah blah blah [[zh:Chinese]] !! html/parsoid -

        Blah blah blah zh:Chinese

        +

        Blah blah blah zh:Chinese

        !! end ## PHP parser tests script needs an update @@ -8956,7 +9069,7 @@ parsoid=wt2html,wt2wt,html2html Blah blah blah [[zh:Chinese]] !! html/parsoid -

        Blah blah blah zh:Chinese

        +

        Blah blah blah zh:Chinese

        !! end !! test @@ -9043,7 +9156,7 @@ parsoid=wt2html,wt2wt,html2html

        ko:

        !! html/parsoid -

        es:

        +

        es:

        ko:

        !! end @@ -9071,7 +9184,7 @@ Blah blah blah

        !! html/parsoid

        Blah blah blah -local:es:Spanish

        +local:es:Spanish

        !! end !! test @@ -9114,10 +9227,12 @@ Blah blah blah # This tests the Parsoid bail-out code. !! test 3. Other redirect variants +!! options +parsoid=wt2html !! wikitext #REDIRECT [[[[Bar]]]] !! html/parsoid -
        1. REDIRECT [[[[Bar]]]]
        +
        1. REDIRECT [[[[Bar]]]]
        !! end !! test @@ -9411,7 +9526,7 @@ Handling html with a div self-closing tag !! html/parsoid
        -
        +
        @@ -10935,10 +11050,10 @@ Magic links: RFC (T2479) !! wikitext RFC 822 !! html/php -

        RFC 822 +

        RFC 822

        !! html/parsoid -

        RFC 822

        +

        RFC 822

        !! end !! test @@ -10946,10 +11061,10 @@ Magic links: RFC (T67278) !! wikitext This is RFC 822 but thisRFC 822 is not RFC 822linked. !! html/php -

        This is RFC 822 but thisRFC 822 is not RFC 822linked. +

        This is RFC 822 but thisRFC 822 is not RFC 822linked.

        !! html/parsoid -

        This is RFC 822 but thisRFC 822 is not RFC 822linked.

        +

        This is RFC 822 but thisRFC 822 is not RFC 822linked.

        !! end !! test @@ -10959,12 +11074,12 @@ RFC       822 RFC 822 !! html/php -

        RFC 822 +

        RFC 822 RFC 822

        !! html/parsoid -

        RFC       822 +

        RFC       822 RFC 822

        !! end @@ -11060,14 +11175,14 @@ Magic links: use appropriate serialization for "almost" magic links. !! wikitext X[[Special:BookSources/0978739256|foo]] -X[//tools.ietf.org/html/rfc1234 foo] +X[https://tools.ietf.org/html/rfc1234 foo] !! html/php

        Xfoo -

        Xfoo +

        Xfoo

        !! html/parsoid

        Xfoo

        -

        Xfoo

        +

        Xfoo

        !! end !! test @@ -11324,6 +11439,15 @@ Templates with templated name
        • item 1
        !! end +## Regression test; the output here isn't really that interesting. +!! test +Templates with templated name and top level template args +!! wikitext +{{1{{2{{{3}}}|4=5}}}} +!! html/parsoid +

        {{1{{2{{{3}}}|4=5}}}}

        +!! end + # Parsoid markup is deliberate "broken". This is an edge case. # See long comment in TemplateHandler.js:convertAttribsToString. !! test @@ -11420,9 +11544,9 @@ Abort table cell attribute parsing on wikilink !! html/parsoid - - - + + +
        testing two | three four three four testing="two" | three four
        testing two | three four three four testing="two" | three four
        !! end @@ -11917,14 +12041,14 @@ some

        here

        !! html/parsoid -

        hu

        +

        hu

        some

        • stuff
        • here
        -

        here

        +

        here

        !! end @@ -12448,6 +12572,8 @@ Preprocessor precedence 14: broken language converter in comment !! test Preprocessor precedence 15: broken brace markup in headings +!! config +wgFragmentMode=[ 'html5', 'legacy' ] !! options parsoid=wt2html !! wikitext @@ -12465,32 +12591,31 @@ __NOTOC__ __NOEDITSECTION__ ===6 foo-{bar 6=== 6 !! html/php+tidy -

        1 foo[bar 1

        +

        1 foo[bar 1

        1

        -

        2 foo[[bar 2

        +

        2 foo[[bar 2

        2

        -

        3 foo{bar 3

        +

        3 foo{bar 3

        3

        -

        4 foo{{bar 4

        +

        4 foo{{bar 4

        4

        -

        5 foo{{{bar 5

        +

        5 foo{{{bar 5

        5

        -

        6 foo-{bar 6

        +

        6 foo-{bar 6

        6

        !! html/parsoid - -

        1 foo[bar 1

        + +

        1 foo[bar 1

        1

        -

        2 foo[[bar 2

        +

        2 foo[[bar 2

        2

        -

        3 foo{bar 3

        +

        3 foo{bar 3

        3

        -

        4 foo{{bar 4

        +

        4 foo{{bar 4

        4

        -

        5 foo{{{bar 5

        +

        5 foo{{{bar 5

        5

        -

        6 foo-{bar 6

        +

        6 foo-{bar 6

        6

        !! end @@ -14192,15 +14317,15 @@ parsoid=wt2html,wt2wt,html2html

        Foobar.jpg

        !! html/parsoid -

        +

        !! end !! test -Serialize simple image with figure-inline wrapper +Serialize simple image with span wrapper !! options parsoid=html2wt !! html/parsoid -

        +

        !! wikitext [[File:Foobar.jpg]] !! end @@ -14213,7 +14338,7 @@ Simple image (using File: namespace, now canonical)

        Foobar.jpg

        !! html/parsoid -

        +

        !! end !! test @@ -14330,7 +14455,7 @@ Linktrails should not work for images: [[File:Foobar.jpg]]s

        Linktrails should not work for images: Foobar.jpgs

        !! html/parsoid -

        Linktrails should not work for images: s

        +

        Linktrails should not work for images: s

        !! end !! test @@ -14376,7 +14501,7 @@ parsoid=wt2html,wt2wt,html2html

        Foobar.jpg

        !! html/parsoid -

        +

        !! end ## Parsoid does not provide editing support for images where templates produce multiple image attributes. @@ -14420,7 +14545,7 @@ thumbsize=220

        456

        !! html/parsoid -

        123456

        +

        123456

        123

        456

        123

        456

        !! end @@ -14444,7 +14569,7 @@ Image with multiple widths -- use last

        caption

        !! html/parsoid -

        +

        !! end !! test @@ -14461,7 +14586,7 @@ thumbsize=220

        !! html/parsoid
        caption
        -

        +

        !! end !! test @@ -14494,7 +14619,7 @@ parsoid=wt2html,wt2wt,html2html Foobar.jpg

        !! html/parsoid -

        +

        !! end !! test @@ -14505,7 +14630,7 @@ Image with link parameter, wiki target

        Foobar.jpg

        !! html/parsoid -

        +

        !! end # parsoid T51293 (part 1) @@ -14517,7 +14642,7 @@ Image with link parameter, URL target

        Foobar.jpg

        !! html/parsoid -

        +

        !! end # parsoid T51293 (part 2) @@ -14529,7 +14654,7 @@ Image with link parameter, protocol-less URL target

        Foobar.jpg

        !! html/parsoid -

        +

        !! end !! test @@ -14601,7 +14726,7 @@ Image with empty link parameter

        Foobar.jpg

        !! html/parsoid -

        +

        !! end !! test @@ -14612,7 +14737,7 @@ Image with link parameter (wiki target) and unnamed parameter

        Title

        !! html/parsoid -

        +

        !! end !! test @@ -14623,7 +14748,7 @@ Image with link parameter (URL target) and unnamed parameter

        Title

        !! html/parsoid -

        +

        !! end !! test @@ -14746,9 +14871,9 @@ Image with wiki markup in implicit alt

        testing bold in alt

        !! html/parsoid -

        +

        -

        testing bold in alt

        +

        testing bold in alt

        !! end !! test @@ -14759,7 +14884,65 @@ Alt image option should handle most kinds of wikitext without barfing
        This is a link and a bold template.
        This is the image caption
        !! html/parsoid -
        This is a link and a bold template.
        This is the image caption
        +
        This is a link and a bold template.
        This is the image caption
        +!! end + +!! test +Image with table with attributes in caption +!! options +parsoid=wt2html,html2html +!! wikitext +[[File:Foobar.jpg|thumb| +{| class="123" | +|- class="456" | +| ha +|} +]] +!! html/parsoid +
        + + + +
        ha
        +
        +!! end + +!! test +Image with table with rows from templates in caption +!! wikitext +[[File:Foobar.jpg|thumb| +{| +{{echo|{{!}} hi}} +|} +]] +!! html/parsoid +
        + + +
        hi
        +
        +!! end + +!! test +Image with nested tables in caption +!! wikitext +[[File:Foobar.jpg|thumb|Foo
        +{| +| +{| +|z +|} +|} +]] +!! html/parsoid +
        Foo
        + + +
        + + +
        z
        +
        !! end ################### @@ -14783,9 +14966,9 @@ parsoid=wt2html,wt2wt,html2html

        caption

        !! html/parsoid -

        -

        -

        +

        +

        +

        !! end !! test @@ -14850,8 +15033,8 @@ parsoid=wt2html,wt2wt,html2html

        Foobar.jpg

        !! html/parsoid -

        -

        +

        +

        !! end !! test @@ -14867,8 +15050,8 @@ parsoid=wt2html,wt2wt,html2html

        Foobar.jpg

        !! html/parsoid -

        -

        +

        +

        !! end !! test @@ -14911,7 +15094,7 @@ parsoid=wt2html,wt2wt,html2html

        Foobar.jpg

        !! html/parsoid -

        +

        !! end !! test @@ -14927,8 +15110,8 @@ parsoid=wt2html,wt2wt,html2html

        Foobar.svg

        !! html/parsoid -

        -

        +

        +

        !! end !! test @@ -14986,7 +15169,7 @@ Frameless image caption with a free URL

        http://example.com

        !! html/parsoid -

        +

        !! end !! test @@ -15046,12 +15229,12 @@ SVG thumbnails with invalid language code !! options parsoid=wt2html,wt2wt,html2html !! wikitext -[[File:Foobar.svg|thumb|caption|lang=invalid.language.code]] +[[File:Foobar.svg|thumb|caption|lang=invalid:language:code]] !! html/php -
        lang=invalid.language.code
        +
        lang=invalid:language:code
        !! html/parsoid -
        lang=invalid.language.code
        +
        lang=invalid:language:code
        !! end !! test @@ -15070,10 +15253,10 @@ T3887: A RFC with a thumbnail !! wikitext [[File:Foobar.jpg|thumb|This is RFC 12354]] !! html/php -
        This is RFC 12354
        +
        This is RFC 12354
        !! html/parsoid -
        This is RFC 12354
        +
        This is RFC 12354
        !! end !! test @@ -15096,7 +15279,7 @@ T2648: Frameless image caption with a link

        text with a link in it

        !! html/parsoid -

        +

        !! end !! test @@ -15107,7 +15290,7 @@ T2648: Frameless image caption with a link (suffix)

        text with a linkfoo in it

        !! html/parsoid -

        +

        !! end !! test @@ -15118,7 +15301,7 @@ T2648: Frameless image caption with an interwiki link

        text with a MeatBall:Link in it

        !! html/parsoid -

        +

        !! end !! test @@ -15129,7 +15312,7 @@ T2648: Frameless image caption with a piped interwiki link

        text with a link in it

        !! html/parsoid -

        +

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

        +

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

        & < > "

        !! html/parsoid -

        +

        !! end !! test @@ -15161,7 +15344,7 @@ language=zh

        & < > "

        !! html/parsoid -

        +

        !! end !! test @@ -15172,7 +15355,7 @@ Entities in file name and attributes

        7% solution

        !! html/parsoid -

        +

        !! end !! test @@ -15183,7 +15366,7 @@ T2499: Alt text should have Ӓ, not &1234;

        ♀

        !! html/parsoid -

        +

        !! end !! test @@ -15207,7 +15390,7 @@ Image caption containing another image
        This is a caption with another image inside it!
        !! html/parsoid -
        This is a caption with another inside it!
        +
        This is a caption with another inside it!
        !! end !! test @@ -15219,7 +15402,7 @@ Image: caption containing a newline

        This *is some text

        !! html/parsoid -

        +

        !!end !!test @@ -15280,7 +15463,7 @@ parsoid=wt2html,wt2wt,html2html

        a

        !! html/parsoid -

        +

        !! end !! test @@ -15334,7 +15517,7 @@ parsoid=wt2html,wt2wt,html2html

        caption

        !! html/parsoid -

        +

        !! end # Note that 'right' is the default alignment, despite the misspelled 'righ' below @@ -15387,7 +15570,7 @@ wgEnableUploads=0

        File:Foobaz.jpg

        !! html/parsoid -

        +

        !! end # Parsoid-specific testing for images @@ -15402,7 +15585,7 @@ Parsoid-specific image handling - simple image with size and middle alignment !! wikitext [[File:Foobar.jpg|middle|50px]] !! html/parsoid -

        +

        !! end !! test @@ -15413,7 +15596,7 @@ parsoid=wt2wt,wt2html,html2html !! wikitext [[Image:Foobar.jpg|middle|50px]] !! html/parsoid -

        +

        !! end !! test @@ -15422,7 +15605,7 @@ Parsoid-specific image handling - simple image with size and middle alignment !! wikitext [[File:Foobar.jpg|50px|middle]] !! html/parsoid -

        +

        !! end !! test @@ -15433,7 +15616,7 @@ parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:Foobar.jpg|50px|middle]] !! html/parsoid -

        +

        !! end !! test @@ -15441,7 +15624,7 @@ Parsoid-specific image handling - simple image with both sizes, a baseline align !! wikitext [[File:Foobar.jpg|500x10px|baseline|caption]] !! html/parsoid -

        +

        !! end !! test @@ -15449,7 +15632,7 @@ Parsoid-specific image handling - simple image with border and size spec !! wikitext [[File:Foobar.jpg|50px|border|caption]] !! html/parsoid -

        +

        !! end !! test @@ -15513,7 +15696,7 @@ Parsoid-specific image handling - frameless image with specific size, border, an !! wikitext [[File:Foobar.jpg|frameless|442x50px|border|caption]] !! html/parsoid -

        +

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

        +

        !! end !! test @@ -15591,7 +15774,7 @@ foo bar !! html/parsoid

        foo - + bar

        !! end @@ -15615,9 +15798,9 @@ T93580: 2. inside inline images !! html/parsoid -

        +

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

        +

        -
        1. ↑ foo
        +
        1. ↑ foo
        !! end ### @@ -15817,7 +16000,7 @@ Link to category !! wikitext [[:Category:MediaWiki User's Guide]] !! html -

        Category:MediaWiki User's Guide +

        Category:MediaWiki User's Guide

        !! end @@ -16142,6 +16325,68 @@ parsoid=wt2html !! end +!! test +9. Categories and newlines: should behave properly with linkprefix (T87753) +!! options +language=ar +!! wikitext +foo bar +foo bar +[[تصنيف:Foo]] +[[تصنيف:Bar]] +!! html/php +

        foo bar +foo bar +

        +!! html/parsoid +

        foo bar +foo bar

        + + +!! end + +!! test +10. No regressions on internal links following category (T174639) +!! options +parsoid=wt2html,html2html +!! wikitext +[[Category:Foo]]
        a + +[[Foo]]
        +!! html/php +
        a +Foo
        + +!! html/parsoid +
        a + +Foo
        +!! end + +# Note that Parsoid differs slightly from PHP due to T175421 +!! test +11. Special case where only newlines separate links (T175416) +!! options +parsoid=wt2html,html2html +!! wikitext +[[Category:Foo]] + +[[Foo]][[es:Alimento]] + +[[Foo]] +!! html/php +


        +Foo +

        Foo +

        +!! html/parsoid + + +

        Foo

        + +

        Foo

        +!! end + !! test Category links with multiple namespaces !! wikitext @@ -16189,6 +16434,20 @@ x[[Category:Foo]]y

        xy

        !! end +!! test +Link prefix/suffixes aren't applied to language links +!! options +parsoid=wt2html +language=is +!! wikitext +x[[es:Foo]]y +!! html/php +

        xy +

        +!! html/parsoid +

        xy

        +!! end + !! test Parsoid: Serialize link to file page with colon escape !! options @@ -16379,8 +16638,11 @@ __FORCETOC__ !! end # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10' +# Parsoid html2wt direction adds for level 7 and up. !! test Handling of sections up to level 6 and beyond +!! options +parsoid=wt2html !! wikitext = Level 1 Heading= == Level 2 Heading== @@ -16392,7 +16654,7 @@ Handling of sections up to level 6 and beyond ======== Level 8 Heading======== ========= Level 9 Heading========= ========== Level 10 Heading========== -!! html +!! html/php

        Contents

        • 1 Level 1 Heading @@ -16434,6 +16696,17 @@ Handling of sections up to level 6 and beyond
          === Level 9 Heading===[edit]
          ==== Level 10 Heading====[edit]
          +!! html/parsoid +

          Level 1 Heading

          +

          Level 2 Heading

          +

          Level 3 Heading

          +

          Level 4 Heading

          +
          Level 5 Heading
          +
          Level 6 Heading
          +
          = Level 7 Heading=
          +
          == Level 8 Heading==
          +
          === Level 9 Heading===
          +
          ==== Level 10 Heading====
          !! end !! test @@ -16657,24 +16930,33 @@ http://example.com [[File:Foobar.jpg]]

          http://example.com Foobar.jpg

          !! html/parsoid -

          http://example.com

          +

          http://example.com

          !!end +# Parsoid doesn't wt2wt this cleanly because it adds s. !! test Short headings with trailing space should match behavior of Parser::doHeadings (T21910) +!! options +parsoid=wt2html,html2html !! wikitext === The line above must have a trailing space! === But just in case it doesn't... -!! html +!! html/php

          =[edit]

          The line above must have a trailing space!

          =[edit]

          But just in case it doesn't...

          +!! html/parsoid +

          =

          +

          The line above must have a trailing space!

          +

          =

          +

          But just in case it doesn't...

          !! end !! test @@ -16696,7 +16978,7 @@ section 4 == text " text == section 5 -!! html +!! html/php

          The tooltips shall not show entities to the user (ie. be double escaped)

          Contents

          @@ -16718,12 +17000,29 @@ section 5

          text & text[edit]

          section 3

          -

          text ' text[edit]

          +

          text ' text[edit]

          section 4

          text " text[edit]

          section 5

          +!! html/parsoid +

          The tooltips shall not show entities to the user (ie. be double escaped)

          + +

          text > text

          +

          section 1

          + +

          text < text

          +

          section 2

          + +

          text & text

          +

          section 3

          + +

          text ' text

          +

          section 4

          + +

          text " text

          +

          section 5

          !! end !! test @@ -16755,7 +17054,7 @@ section 6 [[#Plus-Entity+between+Text]] [[#Underscore_between_Text]] [[#Underscore-Entity_between_Text]] -!! html +!! html/php

          Id should not contain + for spaces

          Contents

          @@ -16793,17 +17092,47 @@ section 6 #Underscore_between_Text #Underscore-Entity_between_Text

          +!! html/parsoid +

          Id should not contain + for spaces

          + +

          Space between Text

          +

          section 1

          + +

          Space-Entity between Text

          +

          section 2

          + +

          Plus+between+Text

          +

          section 3

          + +

          Plus-Entity+between+Text

          +

          section 4

          + +

          Underscore_between_Text

          +

          section 5

          + +

          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

          !! end +# Parsoid html2wt disabled because it adds padding spaces around = !! test Headers with excess '=' characters (Are similar tests necessary beyond the 1st level?) +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext =foo== ==foo= =''italic'' heading== ==''italic'' heading= -!! html +!! html/php

          Contents

          • 1 foo=
          • @@ -16818,6 +17147,11 @@ Headers with excess '=' characters

            italic heading=[edit]

            =italic heading[edit]

            +!! html/parsoid +

            foo=

            +

            =foo

            +

            italic heading=

            +

            =italic heading

            !! end !! test @@ -16833,7 +17167,7 @@ HTML headers vs TOC (T25393) == Header 2.1 == == Header 2.2 == __NOEDITSECTION__ -!! html +!! html/php

            Contents

            • 1 Header 1 @@ -16858,6 +17192,16 @@ __NOEDITSECTION__

              Header 2.1

              Header 2.2

              +!! html/parsoid +

              Header 1

              +

              Header 1.1

              +

              Header 1.2

              + +

              Header 2 +

              +

              Header 2.1

              +

              Header 2.2

              + !! end !! test @@ -16870,11 +17214,17 @@ parsoid=wt2html,wt2wt ==baz== -!! html -

              foo

              -

              bar

              -

              baz

              +!! html/php +

              foo[edit]

              +

              bar[edit]

              +

              baz[edit]

              +!! html/parsoid +

              foo

              +

              bar

              +

              baz

              !! end !! test @@ -16885,7 +17235,7 @@ http://example.com[[File:Foobar.jpg]]

              http://example.comFoobar.jpg

              !! html/parsoid -

              http://example.com

              +

              http://example.com

              !!end !! test @@ -16981,15 +17331,17 @@ parsoid=wt2html,html2html !! test div with multiple empty attribute values +!! config +wgFragmentMode=[ 'html5', 'legacy' ] !! options parsoid=wt2html,html2html !! wikitext
              HTML rocks
              !! html/php -
              HTML rocks
              +
              HTML rocks
              !! html/parsoid -
              HTML rocks
              +
              HTML rocks
              !! end !! test @@ -17315,7 +17667,7 @@ Image link to nonexistent file (T3850 - good)

              File:No such.jpg

              !! html/parsoid -

              +

              !! end !! test @@ -17567,9 +17919,11 @@ T4304: HTML attribute safety (unsafe breakout parameter 2; 2309) T4304: HTML attribute safety (link) !! wikitext
              -!! html -
              +!! html/php +
              +!! html/parsoid +
              !! end !! test @@ -17630,9 +17984,11 @@ T4304: HTML attribute safety (web link) T4304: HTML attribute safety (named web link) !! wikitext
              -!! html -
              +!! html/php +
              +!! html/parsoid +
              !! end !! test @@ -18196,18 +18552,16 @@ Nested template calls ### Sanitizer ### -# HTML+Tidy effectively strips out the empty tags completely -# But since Parsoid doesn't it wraps the tags in p-tags -# which Tidy would have done for the PHP parser had there been content inside it. +# HTML+Tidy strips out empty tags completely. Parsoid doesn't. +# FIXME: Wikitext for this first test doesn't match its title. !! test Sanitizer: Closing of open tags !! wikitext
              -!! html -
              +!! html/php+tidy !! html/parsoid -

              +
              !! end !! test @@ -18243,24 +18597,37 @@ Table not started !! test Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" +!! config +wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext byte[[#æ: v|backlink]] !! html/php -

              bytebacklink +

              bytebacklink

              !! html/parsoid -

              bytebacklink

              +

              bytebacklink

              !! end -# In HTML5, the restrictions are that id must contain at least one character, -# and must not contain any space characters. !! test -Sanitizer: Validating the contents of the id attribute (T6515) -!! options -disabled +Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy) +!! config +wgFragmentMode=[ 'legacy' ] !! wikitext -

              -!! html +byte[[#æ: v|backlink]] +!! html/php +

              bytebacklink +

              +!! end + +# In HTML5, the restrictions are that id must contain at least one character, +# and must not contain any space characters. +!! test +Sanitizer: Validating the contents of the id attribute (T6515) +!! options +disabled +!! wikitext +

              +!! html Something ... !! end @@ -18312,6 +18679,37 @@ parsoid=wt2html,wt2wt

              2013

              !! end +!! test +Sanitizer: Avoid unnecessary percent encoded characters in interwiki links +!! wikitext +[[meatball:Soft"Security]] +!! html/php +

              meatball:Soft"Security +

              +!! html/parsoid +

              meatball:Soft"Security

              +!! end + +!! test +Sanitizer: angle brackets are invalid, even in interwiki links (T182338) +!! wikitext +[[meatball:FooBar]] +[[meatball:Foo<bar]] +[[meatball:Foo>bar]] +!! html/php +

              [[meatball:Foo<Bar]] +[[meatball:Foo>Bar]] +[[meatball:Foo<bar]] +[[meatball:Foo>bar]] +

              +!! html/parsoid +

              [[meatball:Foo<Bar]] +[[meatball:Foo>Bar]] +[[meatball:Foo<bar]] +[[meatball:Foo>bar]]

              +!! end + !! test Language converter: output gets cut off unexpectedly (T7757) !! options @@ -18337,6 +18735,24 @@ all additional text is vanished

              all additional text is vanished

              !! end +!! test +Language converter glossary rules inside attributes (T119158) +!! options +language=sr variant=sr-el +!! wikitext +-{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}- + +[[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]] +!! html/php +

              +

              " onload="alert(1)" data-foo=" +

              +!! html/parsoid +

              + +

              foAjrjvi

              +!! end + !! test Self closed html pairs (T7487) !! wikitext @@ -18655,12 +19071,15 @@ Fuzz testing: Parser13 !! end +# Note that Parsoid output differs from the PHP parser here: the PHP +# parser breaks the URL for the magic word, while in Parsoid the URL +# production takes precedence. !! test Fuzz testing: Parser14 !! wikitext == onmouseover= == http://__TOC__ -!! html +!! html/php

              onmouseover=[edit]

              http://

              Contents

                @@ -18669,7 +19088,7 @@ http://

                Contents

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

                onmouseover=[edit]

                http://

                @@ -18681,6 +19100,9 @@ http://

                Contents

              +!! html/parsoid +

              onmouseover=

              +

              http://__TOC__

              !! end !! test @@ -18704,7 +19126,7 @@ parsoid=wt2html,html2html !! html/parsoid -

              a

              +

              a

              !! end @@ -18879,15 +19301,45 @@ Fuzz testing: image with bogus manual thumbnail
              !! end +# Parsoid will emit the newline literally in wt2wt; see next test case. !! test Fuzz testing: encoded newline in generated HTML replacements (T8577) +!! options +parsoid=wt2html !! wikitext
              
               !! html/php
               
              
               
               !! html/parsoid
              -
              
              +
              
              +!! end
              +
              +!! test
              +Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
              +!! options
              +parsoid=html2wt
              +!! html/parsoid
              +
              
              +!! wikitext
              +
              
              +!! html/php
              +
              
              +
              +!! end
              +
              +!! test
              +Templates in extension attributes are not expanded
              +!! wikitext
              +
              
              +!! html/php
              +
              
              +
              +!! html/parsoid
              +
              
               !! end
               
               !! test
              @@ -19917,7 +20369,7 @@ parsoid=wt2html
               '''''
               !! html/php
               !! html/parsoid
              -

              + !! end # same html as previous, but wikitext adjusted to match parsoid html2wt @@ -20041,7 +20493,7 @@ File:File:Foobar.jpg !! html/parsoid !! end @@ -20104,12 +20556,12 @@ image4 |300px| centre !! html/parsoid !! end @@ -20167,11 +20619,11 @@ image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla. !! html/parsoid !! end @@ -20228,11 +20680,11 @@ image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla. !! html/parsoid !! end @@ -20272,9 +20724,9 @@ image:foobar.jpg|link=Main Page#section|caption !! html/parsoid !! end @@ -20304,7 +20756,7 @@ File:Foobar.jpg|{{echo|ho}} !! html/parsoid !! end @@ -20339,8 +20791,8 @@ File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}} !! html/parsoid !! end @@ -20393,10 +20845,10 @@ some caption Main Page !! html/parsoid !! end @@ -20441,27 +20893,27 @@ foobar.jpg !! html/parsoid !! end !! test -Gallery override link with WikiLink (T36852) +Gallery override link with wikilink (T36852) !! options parsoid={ "nativeGallery": true } !! wikitext -File:Foobar.jpg|alt=galleryalt|link=InterWikiLink +File:Foobar.jpg|alt=galleryalt|link=Wikilink !! html/php !! html/parsoid -
          @@ -28024,7 +28580,7 @@ Magic links inside image captions (autolinked)
          !! html/parsoid
          http://example.com
          -
          RFC 1234
          +
          RFC 1234
          PMID 1234
          ISBN 123456789x
          !! end @@ -28124,17 +28680,17 @@ parsoid=html2wt a b -c +c

          x

          -y +y + +
          a b -c
          c

          x -

          y
          y
          !! wikitext {| @@ -28299,6 +28855,14 @@ parsoid=wt2html

          hiho

          !! end +!! test +Catch regression when unpacking with trailing content +!! wikitext +{{echo|Foo bar}} +!! html/parsoid +

          Foo

            bar

            +!! end + !! test Use data-parsoid.firstWikitextNode to compute newline constraints for template content !! options @@ -29300,6 +29864,24 @@ wgRawHtml=1 !! test Decoding of HTML entities in headings and links for IDs and link fragments (T103714) +!! config +wgFragmentMode=[ 'html5', 'legacy' ] +!! wikitext +== A&B&C&amp;D&amp;amp;E == +[[#A&B&C&amp;D&amp;amp;E]] +!! html/php +

            A&B&C&amp;D&amp;amp;E[edit]

            +

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

            +!! html/parsoid +

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

            +

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

            +!! end + +!! test +Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy) +!! config +wgFragmentMode=[ 'legacy' ] !! wikitext == A&B&C&amp;D&amp;amp;E == [[#A&B&C&amp;D&amp;amp;E]] @@ -29309,17 +29891,46 @@ Decoding of HTML entities in headings and links for IDs and link fragments (T103

            !! end +!! test +Decoding of HTML entities in embedded HTML tags +!! wikitext +
            x
            +!! html/php +
            x
            + +!! html/parsoid +
            x
            +!! end + !! test Decoding of HTML entities in indicator names for IDs (T104196) !! options +parsoid=wt2html,html2html showindicators !! wikitext Indicator !! html/php 1&2&3&4&amp;5=Indicator +!! html/parsoid +

            !! end +# this version of the test strips out the ambiguity so Parsoid rts cleanly +!! test +Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196) +!! options +showindicators +!! wikitext +Indicator +!! html/php +1&2&3&4&amp;5=Indicator + +!! html/parsoid +

            +!! end + +# This fragment mode is what Parsoid supports. !! test HTML5 ids: fallback to legacy !! config @@ -29351,7 +29962,7 @@ wgFragmentMode=[ 'html5', 'legacy' ]
          1. 3 Тест
          2. 4 Тест
          3. 5 тест
          4. -
          5. 6 Hey < # " > % : '
          6. +
          7. 6 Hey < # " > % : '
          @@ -29360,13 +29971,32 @@ wgFragmentMode=[ 'html5', 'legacy' ]

          Тест[edit]

          Тест[edit]

          тест[edit]

          -

          Hey < # " > % : '[edit]

          -

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

          Hey < # " > % : '[edit]

          +

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

          💩

          #啤酒 #啤酒

          +!! html/parsoid +

          Foo bar

          + +

          foo Bar

          + +

          Тест

          + +

          Тест

          + +

          тест

          + +

          Hey < # " > % : '

          +

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

          + +

          💩

          + + +

          #啤酒 #啤酒

          !! end +# Parsoid doesn't support this mode !! test HTML5 ids: legacy with a fallback to modern !! config @@ -29407,13 +30037,14 @@ wgFragmentMode=[ 'legacy', 'html5' ]

          Тест[edit]

          Тест[edit]

          тест[edit]

          -

          Hey < # " > % : '[edit]

          +

          Hey < # " > % : '[edit]

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

          .F0.9F.92.A9

          #啤酒 #啤酒

          !! end +# Parsoid doesn't support this mode. !! test HTML5 ids: no legacy !! config @@ -29445,7 +30076,7 @@ wgFragmentMode=[ 'html5' ]
        • 3 Тест
        • 4 Тест
        • 5 тест
        • -
        • 6 Hey < # " > % : '
        • +
        • 6 Hey < # " > % : '
        @@ -29454,9 +30085,526 @@ wgFragmentMode=[ 'html5' ]

        Тест[edit]

        Тест[edit]

        тест[edit]

        -

        Hey < # " > % : '[edit]

        -

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

        Hey < # " > % : '[edit]

        +

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

        💩

        #啤酒 #啤酒

        !! end + +!! test +T90902: Normalize weird characters in section IDs +!! config +wgFragmentMode=[ 'html5', 'legacy' ] +!! wikitext +== Foo bar == +[[#Foo bar]] + +!! html/php +

        Foo bar[edit]

        +

        #Foo bar +

        +!! end + +!! test +T51672: Test for brackets in attributes of elements in external link texts +!! wikitext +[http://example.com/ link span] +[http://example.com/ link span] + +!! html/php +

        link span +link span +

        +!! html/parsoid +

        link span +link span

        +!! end + +!! test +T72875: Test for brackets in attributes of elements in internal link texts +!! wikitext +[[Foo|link span]] +[[Foo|link span]] + +!! html/php +

        link span +link span +

        +!! html/parsoid +

        link span +link span

        +!! end + +!! test +T179544: {{anchorencode:}} output should be always usable in links +!! config +wgFragmentMode=[ 'html5' ] +!! wikitext +[[#{{anchorencode:[foo]}}]] +!! html/php +

        #[foo] +

        +!! html/parsoid +

        #[foo]

        +!! end + +## ------------------------------ +## Parsoid section-wrapping tests +## ------------------------------ +!! test +Section wrapping for well-nested sections (no leading content) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext += 1 = +a + += 2 = +b + +== 2.1 == +c + +== 2.2 == +d + +=== 2.2.1 === +e + += 3 = +f +!! html/parsoid +

        1

        +

        a

        + +

        2

        +

        b

        + +

        2.1

        +

        c

        + +

        2.2

        +

        d

        + +

        2.2.1

        +

        e

        + +

        3

        +

        f

        + +
        +!! end + +!! test +Section wrapping for well-nested sections (with leading content) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +Para 1. + +Para 2 with a
        nested in it
        + +Para 3. + += 1 = +a + += 2 = +b + +== 2.1 == +c +!! html/parsoid +

        Para 1.

        + +

        Para 2 with a

        nested in it
        + +

        Para 3.

        + +

        1

        +

        a

        + +

        2

        +

        b

        + +

        2.1

        +

        c

        + +
        +!! end + +!! test +Section wrapping with template-generated sections (good nesting 1) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext += 1 = +a + +{{echo|1= +== 1.1 == +b +}} + +== 1.2 == +c + += 2 = +d +!! html/parsoid +

        1

        +

        a

        + +

        1.1

        +

        b

        +

        1.2

        +

        c

        + +

        2

        +

        d

        +!! end + +# In this example, the template scope is mildly expanded to incorporate the +# trailing newline after the transclusion since that is part of section 1.1.1 +!! test +Section wrapping with template-generated sections (good nesting 2) +!! options +parsoid={ + "wrapSections": true, + "modes": ["wt2html", "wt2wt"] +} +!! wikitext += 1 = +a + +{{echo|1= +== 1.1 == +b +=== 1.1.1 === +d +}} += 2 = +e +!! html/parsoid +

        1

        +

        a

        + +

        1.1

        +

        b

        +

        1.1.1

        +

        d

        +

        2

        +

        e

        +!! end + +# In this example, the template scope is mildly expanded to incorporate the +# trailing newline after the transclusion since that is part of section 1.2.1 +!! test +Section wrapping with template-generated sections (good nesting 3) +!! options +parsoid={ + "wrapSections": true, + "modes": ["wt2html", "wt2wt"] +} +!! wikitext += 1 = +a + +{{echo|1= +x +== 1.1 == +b +==1.2== +c +===1.2.1=== +d +}} += 2 = +e +!! html/parsoid +

        1

        +

        a

        + +

        x

        +

        1.1

        +

        b

        +

        1.2

        +

        c

        +

        1.2.1

        +

        d

        +

        2

        +

        e

        +!! end + +# Because of section-wrapping and template-wrapping interactions, +# the scope of the template is expanded so that the template markup +# is valid in the presence of
        tags. +# This exercises the s1 is null scenario in the wrapSections code +!! test +Section wrapping with template-generated sections (bad nesting 1) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +
        +a + +{{echo| += 1 = +b +}} + +c +
        +!! html/parsoid +
        +

        a

        + + +

        1

        +

        b +

        + +

        c

        +
        +!! end + +# Because of section-wrapping and template-wrapping interactions, +# the scope of the template is expanded so that the template markup +# is valid in the presence of
        tags. +# This exercises the s1 is ancestor of s2 scenario in the wrapSections code +!! test +Section wrapping with template-generated sections (bad nesting 2) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext += 1 = +a + +{{echo|1= += 2 = +b +== 2.1 == +c +}} + +d + += 3 = +e +!! html/parsoid +

        1

        +

        a

        + +

        2

        +

        b

        +

        2.1

        +

        c

        + +

        d

        + +

        3

        +

        e

        +!! end + +# Because of section-wrapping and template-wrapping interactions, +# additional template wrappers are added to
        tags +# so that template wrapping semantics are valid whether section +# tags are retained or stripped. But, the template scope can expand +# greatly when accounting for section tags. +# This exercises the s1 and s2 are in different subtrees scenario +!! test +Section wrapping with template-generated sections (bad nesting 3) +!! options +parsoid={ + "wrapSections": true, + "modes": ["wt2html", "wt2wt"] +} +!! wikitext += 1 = +a + +{{echo|1= +== 1.2 == +b += 2 = +c +}} + +d + += 3 = +e +!! html/parsoid +

        1

        +

        a

        + +

        1.2

        +

        b

        +

        2

        +

        c

        + +

        d

        +

        3

        +

        e

        +!! end + +!! test +Section wrapping with uneditable lead section + div wrapping multiple sections +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +foo + +
        += 1 = +a + +== 1.1 == +b + += 2 = +c +
        + += 3 = +d + +== 3.1 == +e +!! html/parsoid +

        foo

        + +
        +

        1

        +

        a

        + +

        1.1

        +

        b

        + +

        2

        +

        c

        +
        + +

        3

        +

        d

        + +

        3.1

        +

        e

        +
        +!! end + +!! test +Section wrapping with editable lead section + div overlapping multiple sections +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +foo + += 1 = +a +
        +b + +== 1.1 == +c + += 2 = +d +
        +e + += 3 = +f + +== 3.1 == +g +!! html/parsoid +

        foo

        + +

        1

        +

        a

        +
        +

        b

        + +

        1.1

        +

        c

        + +

        2

        +

        d

        +
        +

        e

        + +

        3

        +

        f

        + +

        3.1

        +

        g

        +
        +!! end + +!! test +HTML header tags should not be wrapped in section tags +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +foo + +

        a

        + += b = + +

        c

        + += d = +!! html/parsoid +

        foo

        + +

        a

        + +

        b

        + +

        c

        + +

        d

        +!! end + +!! test +Lead section containing only whitespace and comments. +!! options +parsoid={ + "wrapSections": true +} +!! wikitext + + += 1 = +a + += 2 = +b +!! html/parsoid +
        + +

        1

        +

        a

        + +

        2

        +

        b

        +!! end