From 2d26a0c535191d5261e5b379230c89ad3b988935 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Tue, 29 Apr 2014 15:59:43 -0400 Subject: [PATCH] Sync up with Parsoid parserTests. This now aligns with Parsoid commit c257ad0880a19df3f10d9942896da9a40f57b17c Change-Id: I64786aeb0ed264b8f8638106be114a8a2a1cd682 --- tests/parser/parserTests.txt | 478 ++++++++++++++++++++++++++++++----- 1 file changed, 414 insertions(+), 64 deletions(-) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index c4bd12d50d..569c165321 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -3042,6 +3042,38 @@ should be left alone

!! end +!! test +Definition Lists: Hacky use to indent tables, with comments (bug 63979) +!! wikitext + +::{| +|foo +|bar +|} +this text +should be left alone +!! html/parsoid + +
+ + +
foobar
+

this text +should be left alone

+!! end + +!! test +Definition Lists: Hacky use to indent tables, with comment before table +!! wikitext +::{| +|foo +|} +!! html/parsoid +
+ +
foo
+!! end + # Bug 52473 !! test Definition Lists: Hacky use to indent tables (WS-insensitive) @@ -3645,17 +3677,22 @@ Non-bracketed: http://example.com

!! end +# parsoid doesn't explicitly mark autonumbered links, see bug 53505 !! test External links: numbered !! wikitext Numbered: [http://example.com] Numbered: [http://example.net] Numbered: [http://example.com] -!! html +!! html/php

Numbered: [1] Numbered: [2] Numbered: [3]

+!! html/parsoid +

Numbered: +Numbered: +Numbered:

!!end !! test @@ -3685,28 +3722,50 @@ http://example.com/1$2345

!! end +# parsoid doesn't explicitly mark autonumbered links, see bug 53505 !! test -External links: dollar sign in URL (named) +External links: dollar sign in URL (autonumber) !! wikitext [http://example.com/1$2345] -!! html +!! html/php

[1]

+!! html/parsoid +

!!end !! test External links: open square bracket forbidden in URL (bug 4377) +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext http://example.com/1[2345 -!! html +!! html/php

http://example.com/1[2345

+!! html/parsoid +

http://example.com/1[2345

!! end !! test External links: open square bracket forbidden in URL (named) (bug 4377) +!! options +parsoid=wt2html,html2html !! wikitext [http://example.com/1[2345] +!! html/php +

[2345 +

+!! html/parsoid +

[2345

+!!end + +# parsoid adds a space before the link name +!! test +External links: open square bracket forbidden in URL (named) (bug 4377) +Parsoid variant. +!! wikitext +[http://example.com/1 [2345] !! html

[2345

@@ -3750,13 +3809,16 @@ External links: protocol-relative URL in brackets

!! end +# parsoid doesn't explicitly mark autonumbered links, see bug 53505 !! test External links: protocol-relative URL in brackets without text !! wikitext [//example.com] -!! html +!! html/php

[1]

+!! html/parsoid +

!! end !! test @@ -3882,54 +3944,95 @@ Old & use: http://x&y External links: encoded ampersand !! wikitext Old & use: http://x&y -!! html +!! html/php

Old & use: http://x&y

+!! html/parsoid +

Old & use: http://x&y

!! end !! test External links: encoded equals (bug 6102) !! wikitext http://example.com/?foo=bar -!! html +!! html/php

http://example.com/?foo=bar

+!! html/parsoid +

http://example.com/?foo=bar

!! end +## +## Note that parsoid doesn't explicit mark autonumbered links, nor +## does it number them. As discussed in bug 53505, we can identify +## autonumbered links via CSS. +## + !! test External links: [raw ampersand] !! wikitext Old & use: [http://x&y] -!! html +!! html/php

Old & use: [1]

+!! html/parsoid +

Old & use:

!! end +# note that parsoid html is identical to [raw ampersand] case; so html2wt +# mode will return the [raw ampersand] wikitext !! test External links: [encoded ampersand] +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext Old & use: [http://x&y] -!! html +!! html/php

Old & use: [1]

+!! html/parsoid +

Old & use:

+!! end + +!! test +External links: [raw equals] +!! wikitext +[http://example.com/?foo=bar] +!! html/php +

[1] +

+!! html/parsoid +

!! end +# note that parsoid html is identical to [raw equals] case; so html2wt +# mode will return the [raw equals] wikitext !! test External links: [encoded equals] (bug 6102) +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext [http://example.com/?foo=bar] -!! html +!! html/php

[1]

+!! html/parsoid +

!! end +# xxx parsoid strips the IDN character, so the round-trip tests will +# obviously fail and are disabled. --cscott !! test External links: [IDN ignored character reference in hostname; strip it right off] +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext [http://e‌xample.com/] -!! html +!! html/php

[1]

+!! html/parsoid +

!! end # FIXME: This test (the IDN characters in the text of a link) is an inconsistency. @@ -3949,13 +4052,19 @@ External links: [IDN ignored character reference in hostname; strip it right off # # All our love, # The Parsoid team. +# xxx parsoid strips the IDN character, so the round-trip tests will +# obviously fail and are disabled. --cscott !! test External links: IDN ignored character reference in hostname; strip it right off +!! options +parsoid=wt2html,html2html !! wikitext http://e‌xample.com/ -!! html +!! html/php

http://example.com/

+!! html/parsoid +

http://example.com/

!! end !! test @@ -3967,13 +4076,16 @@ http://www.jpeg.org

!! end +# parsoid doesn't explicitly mark autonumbered links, see bug 53505 !! test External links: URL within URL (original bug 2) !! wikitext [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp] -!! html +!! html/php

[1]

+!! html/parsoid +

!! end !! test @@ -4122,9 +4234,11 @@ Bug 2702: Mismatched , and tags are invalid Bug 4781: %26 in URL !! wikitext http://www.example.com/?title=AT%26T -!! html +!! html/php

http://www.example.com/?title=AT%26T

+!! html/parsoid +

http://www.example.com/?title=AT%26T

!! end # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain @@ -4133,18 +4247,22 @@ http://www.example.com/?title=AT%26T Bug 4781, 5267: %25 in URL !! wikitext http://www.example.com/?title=100%25_Bran -!! html +!! html/php

http://www.example.com/?title=100%25_Bran

+!! html/parsoid +

http://www.example.com/?title=100%25_Bran

!! end !! test Bug 4781, 5267: %28, %29 in URL !! wikitext http://www.example.com/?title=Ben-Hur_%281959_film%29 -!! html +!! html/php

http://www.example.com/?title=Ben-Hur_%281959_film%29

+!! html/parsoid +

http://www.example.com/?title=Ben-Hur_%281959_film%29

!! end @@ -4152,27 +4270,33 @@ http://www.example.com/?title=Ben-Hur_%281959_film%29 Bug 4781: %26 in autonumber URL !! wikitext [http://www.example.com/?title=AT%26T] -!! html +!! html/php

[1]

+!! html/parsoid +

!! end !! test Bug 4781, 5267: %26 in autonumber URL !! wikitext [http://www.example.com/?title=100%25_Bran] -!! html +!! html/php

[1]

+!! html/parsoid +

!! end !! test Bug 4781, 5267: %28, %29 in autonumber URL !! wikitext [http://www.example.com/?title=Ben-Hur_%281959_film%29] -!! html +!! html/php

[1]

+!! html/parsoid +

!! end @@ -4180,13 +4304,15 @@ Bug 4781, 5267: %28, %29 in autonumber URL Bug 4781: %26 in bracketed URL !! wikitext [http://www.example.com/?title=AT%26T link] -!! html +!! html/php

link

+!! html/parsoid +

link

!! end !! test -Bug 4781, 5267: %26 in bracketed URL +Bug 4781, 5267: %25 in bracketed URL !! wikitext [http://www.example.com/?title=100%25_Bran link] !! html @@ -4198,11 +4324,57 @@ Bug 4781, 5267: %26 in bracketed URL Bug 4781, 5267: %28, %29 in bracketed URL !! wikitext [http://www.example.com/?title=Ben-Hur_%281959_film%29 link] -!! html +!! html/php

link

+!! html/parsoid +

link

+!! end + +# Note that parsoid does not munge anchor text; all non-space +# characters are valid in HTML5 ids. +!! test +Anchor containing a #. (bug 63430) +!! wikitext +[[Main Page#And#Link]] +!! html/php +

Main Page#And#Link +

+!! html/parsoid +

Main Page#And#Link

!! end +!! test +External link containing a period in the anchor. (bug 63947) +!! wikitext +[//foo.org/bar#baz. bang] + +[//foo.org/bar. bang] +!! html/php +

bang +

bang +

+!! html/parsoid +

bang

+

bang

+!! end + +!! test +External link containing a single quote. (bug 63947) +!! wikitext +[//foo.org/bar'baz] + +[//foo.org/bar'baz bang] +!! html/php +

[1] +

bang +

+!! html/parsoid +

+

bang

+!! end + + !! test External link containing double-single-quotes in text '' (bug 4598 sanity check) !! wikitext @@ -4265,10 +4437,14 @@ Brackets in urls http://example.com/index.php?foozoid%5B%5D=bar http://example.com/index.php?foozoid[]=bar -!! html +!! html/php

http://example.com/index.php?foozoid%5B%5D=bar

http://example.com/index.php?foozoid%5B%5D=bar

+!! html/parsoid +

http://example.com/index.php?foozoid%5B%5D=bar

+ +

http://example.com/index.php?foozoid[]=bar

!! end !! test @@ -4902,12 +5078,16 @@ Invalid attributes in table cell (bug 1830) !! end +# The "|}" to close the table is missing from the input, so parsoid's +# *2wt modes will fail. !! test Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html) +!! options +parsoid=wt2html,html2html !! wikitext {| | |[ftp://|x||]" onmouseover="alert(document.cookie)">test -!! html +!! html/php @@ -4916,6 +5096,10 @@ Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitec
[ftp://%7Cx
+!! html/parsoid + + +
" onmouseover="alert(document.cookie)">test
!! end @@ -5266,6 +5450,17 @@ Piped link with comment in link text

!! end +!! test +Piped link with multiple pipe characters in link text +!! wikitext +[[Main Page||The|Main|Page|]] +!! html/php +

|The|Main|Page| +

+!! html/parsoid +

|The|Main|Page|

+!! end + !! test Broken link !! wikitext @@ -5454,22 +5649,37 @@ Link containing }

!! end +!! article +7% Solution +!! text +Just a test of an article title containing a percent. +!! endarticle + !! test Link containing % (not as a hex sequence) !! wikitext [[7% Solution]] -!! html -

7% Solution +!! html/php +

7% Solution

+!! html/parsoid +

7% Solution

!! end +# note that the parsoid HTML is identical to the previous test output, +# so the previous test ensures that the html2wt mode will generate the +# "not as a hex sequence" wikitext. !! test Link containing % as a single hex sequence interpreted to char +!! options +parsoid=wt2wt,wt2html,html2html !! wikitext [[7%25 Solution]] -!! html -

7% Solution +!! html/php +

7% Solution

+!! html/parsoid +

7% Solution

!!end !! test @@ -5481,14 +5691,18 @@ Link containing % as a double hex sequence interpreted to hex sequence

!!end +# note that parsoid does not munge anchor text; all non-space +# characters are valid in HTML5 anchors. !! test Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors Example for such a section: == < == !! wikitext [[%23%3c]][[%23%3e]] -!! html +!! html/php

#<#>

+!! html/parsoid +

#<#>

!! end !! test @@ -5504,9 +5718,11 @@ Link containing "<#" and ">#" as a hex sequences Link containing an equals sign !! wikitext [[Special:BookSources/isbn=4-00-026157-6]] -!! html +!! html/php

Special:BookSources/isbn=4-00-026157-6

+!! html/parsoid +

Special:BookSources/isbn=4-00-026157-6

!! end !! article @@ -5522,33 +5738,39 @@ Just a test of an article title containing a tilde. Link containing a tilde !! wikitext [[Foo~bar]] -!! html +!! html/php

Foo~bar

+!! html/parsoid +

Foo~bar

!! end !! test Link containing double-single-quotes '' (bug 4598) !! wikitext [[Lista d''e paise d''o munno]] -!! html +!! html/php

Lista d''e paise d''o munno

+!! html/parsoid +

Lista d''e paise d''o munno

!! end !! test Link containing double-single-quotes '' in text (bug 4598 sanity check) !! wikitext Some [[Link|pretty ''italics'' and stuff]]! -!! html +!! html/php

Some pretty italics and stuff!

+!! html/parsoid +

Some pretty italics and stuff!

!! end !! test Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check) !! wikitext -''Some [[Link|pretty ''italics'' and stuff]]! +''Some [[Link|pretty ''italics'' and stuff]]!'' !! html

Some pretty italics and stuff!

@@ -5564,12 +5786,17 @@ Link with double quotes in title part (literal) and alternate part (interpreted) [[''Pentecoste''|Pentecoste]] [[''Pentecoste''|''Pentecoste'']] -!! html +!! html/php

File:Denys Savchenko Pentecoste.jpg

''Pentecoste''

Pentecoste

Pentecoste

+!! html/parsoid + +

''Pentecoste''

+

Pentecoste

+

Pentecoste

!! end !! test @@ -5591,9 +5818,11 @@ Broken image links with HTML captions (bug 39700) Plain link to URL !! wikitext [[http://www.example.com]] -!! html +!! html/php

[[1]]

+!! html/parsoid +

[]

!! end !! test @@ -5609,9 +5838,11 @@ Plain link to URL with link text Plain link to protocol-relative URL !! wikitext [[//www.example.com]] -!! html +!! html/php

[[1]]

+!! html/parsoid +

[]

!! end !! test @@ -5651,29 +5882,36 @@ Plain link to page with question mark in title Piped link to URL !! wikitext Piped link to URL: [[http://www.example.com|an example URL]] -!! html +!! html/php

Piped link to URL: [example URL]

+!! html/parsoid +

Piped link to URL: [example URL]

!! end !! test BUG 2: [[page|http://url/]] should link to page, not http://url/ !! wikitext [[Main Page|http://url/]] -!! html +!! html/php

http://url/

+!! html/parsoid +

http://url/

!! end +# Parsoid does not mark self-links, by design. !! test BUG 337: Escaped self-links should be bold !! options title=[[Bug462]] !! wikitext [[Bug462]] [[Bug462]] -!! html +!! html/php

Bug462 Bug462

+!! html/parsoid +

Bug462 Bug462

!! end !! test @@ -5997,8 +6235,6 @@ Different interwiki prefixes mapping to the same URL !! test Interwiki links that cannot be represented in wiki syntax -!! options -parsoid !! wikitext [[meatball:ok]] [[meatball:ok#foo|ok with fragment]] @@ -6006,10 +6242,10 @@ parsoid [http://de.wikipedia.org/wiki/Foo?action=history has query] [http://de.wikipedia.org/wiki/#foo is just fragment] -!! html +!! html/parsoid

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

!! end @@ -8748,7 +8984,7 @@ parsoid !!end !!test -Templates: Inline Text: 1. Multiple tmeplate uses +Templates: Inline Text: 1. Multiple template uses !! wikitext {{echo|Foo}}bar{{echo|baz}} !! html @@ -9263,6 +9499,33 @@ Templates: Ugly templates: 4. newline-only template parameter inconsistency

!! end +# Bug 64017 -- ugly wikitext with fostered content generates two template ranges that +# have a true overlap (T1-start - T2-start - T1-end - T2-end). +!! test +Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled +!! wikitext +{{echo|}} +{{echo|
foo}} +{{echo|
}} +!! html/parsoid +
foo +
+
+!! end + +# Bug 64017 -- ugly wikitext with fostered content generates two template ranges +# that are "identical" and generate nesting cycles in the algorithm +!! test +Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled +!! wikitext +{{echo|
}} +{{echo|
}} +{{echo|
}} +!! html/parsoid +
+
+
+!! end !!test Parser Functions: 1. Simple example @@ -10473,6 +10736,8 @@ parsoid=wt2html,wt2wt,html2html !! test Image with 'frameless' first. +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frameless|caption]] @@ -10484,10 +10749,16 @@ Image with 'frameless' first.

caption

caption

+!! html/parsoid +

+

+

!! end !! test Image with 'frame' first. +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frame|caption]] [[File:Foobar.jpg|frame|frameless|caption]] @@ -10497,10 +10768,14 @@ Image with 'frame' first.
caption
caption
+!! html/parsoid +
caption
caption
caption
!! end !! test Image with 'thumb' first. +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb|caption]] [[File:Foobar.jpg|thumb|frameless|caption]] @@ -10510,6 +10785,8 @@ Image with 'thumb' first.
caption
caption
+!! html/parsoid +
caption
caption
caption
!! end ################### @@ -12612,27 +12889,33 @@ Attribute test: no value Bug 2095: link with three closing brackets !! wikitext [[Main Page]]] -!! html +!! html/php

Main Page]

+!! html/parsoid +

Main Page]

!! end !! test Bug 2095: link with pipe and three closing brackets !! wikitext [[Main Page|link]]] -!! html +!! html/php

link]

+!! html/parsoid +

link]

!! end !! test Bug 2095: link with pipe and three closing brackets, version 2 !! wikitext [[Main Page|[http://example.com/]]] -!! html +!! html/php

[http://example.com/]

+!! html/parsoid +

[http://example.com/]

!! end @@ -13565,6 +13848,7 @@ HTML ordered list item with parameters oddity !! end +# parsoid doesn't explicitly mark autonumbered links, see bug 53505 !!test bug 5918: autonumbering !! wikitext @@ -13577,13 +13861,19 @@ ftp://inlineftp [mailto:enclosed@mail.tld] mailto:inline@mail.tld -!! html +!! html/php

[1] [2] [3]

ftp://inlineftp

With target

[4]

mailto:inline@mail.tld

+!! html/parsoid +

+

ftp://inlineftp

+

With target

+

+

mailto:inline@mail.tld

!! end @@ -14786,17 +15076,39 @@ xxx !! test Handling of in URLs !! wikitext -**irc:// a -!! html +** irc:// a +!! html/php -!!end +!! html/parsoid + +!! end + +!! test +Handling of %0A in URLs +!! wikitext +** irc://%0Aa +!! html/php + + +!! html/parsoid + +!! end + # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test @@ -15136,29 +15448,39 @@ foobar.jpg !! test HTML Hex character encoding (spells the word "JavaScript") +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext JavaScript -!! html +!! html/php

JavaScript

+!! html/parsoid +

JavaScript

!! end !! test HTML Hex character encoding bogus encoding (bug 26437 regression check) !! wikitext &#xsee;&#XSEE; -!! html +!! html/php

&#xsee;&#XSEE;

+!! html/parsoid +

&#xsee;&#XSEE;

!! end !! test HTML Hex character encoding mixed case +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext îî -!! html +!! html/php

îî

+!! html/parsoid +

îî

!! end !! test @@ -15362,11 +15684,13 @@ disabled !! test Images with the "|" character in the comment !! wikitext -[[image:Foobar.jpg|thumb|An [http://test/?param1=|left|¶m2=|x external] URL]] -!! html +[[File:Foobar.jpg|thumb|An [http://test/?param1=|left|¶m2=|x external] URL]] +!! html/php
An external URL
-!!end +!! html/parsoid +
An external URL
+!! end !! test [Before] HTML without raw HTML enabled ($wgRawHtml==false) @@ -16637,9 +16961,11 @@ Bug 15196: localised external link numbers language=fa !! wikitext [http://en.wikipedia.org/] -!! html +!! html/php

[Û±]

+!! html/parsoid +

!! end !! test @@ -17671,9 +17997,11 @@ Special:Foobar Bug 34939 - Case insensitive link parsing ([HttP://]) !! wikitext [HttP://MediaWiki.Org/] -!! html +!! html/php

[1]

+!! html/parsoid +

!! end !!test @@ -17689,9 +18017,11 @@ Bug 34939 - Case insensitive link parsing ([HttP:// title]) Bug 34939 - Case insensitive link parsing (HttP://) !! wikitext HttP://MediaWiki.Org/ -!! html +!! html/php

HttP://MediaWiki.Org/

+!! html/parsoid +

HttP://MediaWiki.Org/

!! end !!test @@ -18152,6 +18482,16 @@ B \n<ref name=\"b\">foo</ref>\n</references>","group":"X"}' data-mw='{"name":"references","body":{"extsrc":"<ref name=\"b\">foo</ref>","html":"\n<span about=\"#mwt10\" class=\"reference\" data-mw='{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}' rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-b-1\">[1]</a></span>\n"},"attrs":{"group":"X"}}'>
  • ↑
  • !! end +!! test +Entities in ref name +!! options +parsoid +!! wikitext +hi +!! html +

    [1]

    +!! end + # This test is wt2html only because we're permitting the serializer to produce # dirty diffs, normalizing the unclosed references to the self-closed version. !! test @@ -20333,6 +20673,16 @@ a

    b

    !! end +!! test +Substrings resembling wikitext in hrefs should not get nowiki escapes +!! options +parsoid=html2wt +!! wikitext +[[Foo''bar''baz]] +!! html +Foo''bar''baz +!! end + #----------------------------- # I/B quote minimization tests #----------------------------- @@ -20419,9 +20769,9 @@ Bug 54262: New entities !! options parsoid=html2wt !! wikitext -foo +  !! html -foo +  !! end ## Note that there is no wikitext output for 'unknownproperty' ## -- 2.20.1