From 335669755d0539ac304270f19c44f9e109bd616b Mon Sep 17 00:00:00 2001
From: Isabelle Hurbain-Palatin
Date: Wed, 29 Sep 2021 16:09:15 +0200
Subject: [PATCH] Sync up with Parsoid mediaParserTests.txt
This now aligns with Parsoid commit 4bd0707f974b664cef5de5c8c54a5f31520bd4df
Change-Id: I016d67683c431a47296d29db6577cd7dc601bc9b
---
tests/parser/mediaParserTests.txt | 526 +++++++++++++++++++++-----------------
1 file changed, 293 insertions(+), 233 deletions(-)
diff --git a/tests/parser/mediaParserTests.txt b/tests/parser/mediaParserTests.txt
index f79b199f69d..74331bd4138 100644
--- a/tests/parser/mediaParserTests.txt
+++ b/tests/parser/mediaParserTests.txt
@@ -55,7 +55,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -63,7 +63,7 @@ Serialize simple image with figure-inline wrapper
!! options
parsoid=html2wt
!! html/parsoid
-
+
!! wikitext
[[File:Foobar.jpg]]
!! end
@@ -78,7 +78,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -90,7 +90,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
!! html/parsoid
-
+
!! end
!! test
@@ -102,7 +102,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
!! html/parsoid
-
+
!! end
!! test
@@ -114,7 +114,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
!! html/parsoid
-
+
!! end
!! test
@@ -126,7 +126,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
!! html/parsoid
-
+
!! end
!! test
@@ -138,7 +138,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
!! html/parsoid
-
+
!! end
!! test
@@ -152,8 +152,8 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
-
+
+
!! end
!! test
@@ -170,7 +170,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
!! html/parsoid
-
456
123
456
!! html/parsoid
-
123456
-
123
456
-123
+
123456
+
123
456
+123
456
!! end
@@ -312,7 +312,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
Caption3 - accepted
!! html/parsoid
-Caption3 - accepted
+Caption3 - accepted
!! end
!! test
@@ -325,7 +325,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -343,8 +343,8 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-caption
-
+caption
+
!! end
!! test
@@ -360,9 +360,9 @@ wgParserEnableLegacyMediaDOM=false
CaptionCaption
!! html/parsoid
-Caption
-Caption
-Caption
+Caption
+Caption
+Caption
!! end
# a sad bit of backward-compatibility
@@ -380,7 +380,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -393,7 +393,7 @@ wgParserEnableLegacyMediaDOM=false
!! end
!! test
@@ -499,7 +499,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -512,7 +512,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -525,7 +525,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -540,7 +540,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
Title
!! html/parsoid
-Title
+Title
!! end
!! test
@@ -554,7 +554,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
Title
!! html/parsoid
-Title
+Title
!! end
!! test
@@ -569,7 +569,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
Title
!! html/parsoid
-Title
+Title
!! end
!! test
@@ -584,7 +584,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
Title
!! html/parsoid
-Title
+Title
!! end
!! test
@@ -599,7 +599,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
Title
!! html/parsoid
-Title
+Title
!! end
!! test
@@ -614,7 +614,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
Title
!! html/parsoid
-Title
+Title
!! end
!! test
@@ -629,7 +629,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
Title
!! html/parsoid
-Title
+Title
!! end
!! test
@@ -643,7 +643,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
This is a test image Main Page
!! html/parsoid
-This is a test image Main Page
+This is a test image Main Page
!! end
!! test
@@ -657,7 +657,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
This is a test image Main Page
!! html/parsoid
-This is a test image Main Page
+This is a test image Main Page
!! end
!! test
@@ -673,9 +673,9 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
-
+
!! end
!! test
@@ -687,7 +687,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
This is the image caption
!! html/parsoid
-This is the image caption
+This is the image caption
!! end
!! test
@@ -712,12 +712,12 @@ File:Foobar.jpg|alt=&
!! html/parsoid
-
!! end
!! test
@@ -1476,7 +1476,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
http://example.com
!! html/parsoid
-http://example.com
+http://example.com
!! end
!! test
@@ -1491,7 +1491,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
http://example.com
!! html/parsoid
-http://example.com
+http://example.com
!! end
!! test
@@ -1503,7 +1503,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
caption
!! html/parsoid
-caption
+caption
!! end
!! test
@@ -1517,7 +1517,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
caption
!! html/parsoid
-caption
+caption
!! end
!! test
@@ -1531,7 +1531,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
lang=invalid:language:code
!! html/parsoid
-lang=invalid:language:code
+lang=invalid:language:code
!! end
!! test
@@ -1569,7 +1569,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
ISBN 1235467890
!! html/parsoid
-ISBN 1235467890
+ISBN 1235467890
!! end
!! test
@@ -1581,7 +1581,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
This is RFC 12354
!! html/parsoid
-This is RFC 12354
+This is RFC 12354
!! end
!! test
@@ -1593,7 +1593,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
Please mailto:nobody@example.com
!! html/parsoid
-Please mailto:nobody@example.com
+Please mailto:nobody@example.com
!! end
# Pending resolution to T2368
@@ -1607,7 +1607,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -1620,7 +1620,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -1633,7 +1633,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -1646,7 +1646,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -1654,7 +1654,7 @@ T107474: Frameless image caption with
!! wikitext
[[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
!! html/parsoid
-
+
!! end
!! test
@@ -1667,7 +1667,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -1682,7 +1682,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -1708,7 +1708,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -1733,7 +1733,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
This is a caption with another inside it!
!! html/parsoid
-This is a caption with another inside it!
+This is a caption with another inside it!
!! end
!! test
@@ -1747,7 +1747,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!!end
## The leading space should not trigger nowiki escaping in wt2wt mode
@@ -1760,7 +1760,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
bar
!! html/parsoid
- bar
+ bar
!!end
# html/php output not have newlines after table, td, th, etc. because
@@ -1784,7 +1784,7 @@ and some more text.]]
!! html/php
This is an example image thumbnail caption with a table
Foo
Bar
Foo1
Bar1
and some more text.
!! html/parsoid
-
This is an example image thumbnail caption with a table
+
This is an example image thumbnail caption with a table
Foo
Bar
@@ -1802,7 +1802,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
This caption has irc and Secure ext links in it.
!! html/parsoid
-This caption has irc and Secure ext links in it.
+This caption has irc and Secure ext links in it.
!! end
!! test
@@ -1817,7 +1817,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -1832,7 +1832,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
caption
!! html/parsoid
-caption
+caption
!! end
!! test
@@ -1848,7 +1848,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
caption
!! html/parsoid
-caption
+caption
!! end
!! test
@@ -1857,7 +1857,7 @@ Localized image handling (3).
language=fa
parsoid=html2wt
!! html/parsoid
-
+
!! wikitext
[[File:Foobar.jpg|بندانگشتی]]
!! end
@@ -1875,7 +1875,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
# Note that 'right' is the default alignment, despite the misspelled 'righ' below
@@ -1897,9 +1897,9 @@ wgParserEnableLegacyMediaDOM=false
captioncaption
!! html/parsoid
-caption
-caption
-caption
+caption
+caption
+caption
!! end
!! article
@@ -1949,7 +1949,7 @@ Parsoid-specific image handling - simple image with size and middle alignment
!! wikitext
[[File:Foobar.jpg|middle|50px]]
!! html/parsoid
-
+
!! end
!! test
@@ -1959,7 +1959,7 @@ parsoid=wt2wt,wt2html,html2html
!! wikitext
[[Image:Foobar.jpg|middle|50px]]
!! html/parsoid
-
+
!! end
!! test
@@ -1967,7 +1967,7 @@ Parsoid-specific image handling - simple image with size and middle alignment (e
!! wikitext
[[File:Foobar.jpg|50px|middle]]
!! html/parsoid
-
+
!! end
!! test
@@ -1977,7 +1977,7 @@ parsoid=wt2html,wt2wt,html2html
!! wikitext
[[Image:Foobar.jpg|50px|middle]]
!! html/parsoid
-
+
!! end
!! test
@@ -1985,7 +1985,7 @@ Parsoid-specific image handling - simple image with both sizes, a baseline align
!! wikitext
[[File:Foobar.jpg|500x10px|baseline|caption]]
!! html/parsoid
-
+
!! end
!! test
@@ -1993,7 +1993,7 @@ Parsoid-specific image handling - simple image with border and size spec
!! wikitext
[[File:Foobar.jpg|50px|border|caption]]
!! html/parsoid
-
+
!! end
!! test
@@ -2003,7 +2003,7 @@ parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|left|baseline|thumb|caption content]]
!! html/parsoid
-caption content
+caption content
!! end
!! test
@@ -2013,7 +2013,7 @@ parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|thumb|left|baseline|caption content]]
!! html/parsoid
-caption content
+caption content
!! end
!! test
@@ -2023,7 +2023,7 @@ parsoid=wt2html,html2html
!! wikitext
[[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
!! html/parsoid
-caption
+caption
!! end
!! test
@@ -2033,7 +2033,7 @@ parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
!! html/parsoid
-caption
+caption
!! end
!! test
@@ -2043,7 +2043,7 @@ parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|frame|500x50px|caption]]
!! html/parsoid
-caption
+caption
!! end
!! test
@@ -2053,7 +2053,7 @@ parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
!! html/parsoid
-caption
+caption
!! end
!! test
@@ -2061,7 +2061,7 @@ Parsoid-specific image handling - frameless image with specific size, border, an
!! wikitext
[[File:Foobar.jpg|frameless|442x50px|border|caption]]
!! html/parsoid
-
+
!! end
!! test
@@ -2069,7 +2069,7 @@ Parsoid-specific image handling - simple image with a formatted caption
!! wikitext
[[File:Foobar.jpg|
a
b
c
]]
!! html/parsoid
-
+
!! end
!! test
@@ -2077,7 +2077,7 @@ Parsoid-specific image handling - caption with a template in it
!! wikitext
[[File:Foobar.jpg|thumb|200x23px|This caption has a {{1x|transclusion}} in it.]]
!! html/parsoid
-This caption has a transclusion in it.
+This caption has a transclusion in it.
!! end
!! test
@@ -2090,7 +2090,7 @@ foo
bar
!! html/parsoid
foo
-This caption has a
unbalanced tag in it.
+This caption has a
unbalanced tag in it.
bar
!! end
@@ -2101,7 +2101,7 @@ parsoid=wt2html,wt2wt
!! wikitext
[[File:Foobar.jpg|thumb|]]
!! html/parsoid
-
+
!! end
# empty captions don't get serialized unless we're in the "round trip" case
@@ -2114,7 +2114,7 @@ parsoid=html2wt
@@ -2128,7 +2128,7 @@ Parsoid-specific image handling - whitespace caption
!! wikitext
[[File:Foobar.jpg|thumb| ]]
!! html/parsoid
-
+
!! end
!! test
@@ -2139,7 +2139,7 @@ foo
bar
!! html/parsoid
foo
-
+
bar
!! end
@@ -2201,7 +2201,7 @@ wgParserEnableLegacyMediaDOM=false
[[Test|]]
!! html/parsoid
-
[[Test|]]
+
[[Test|]]
!! end
!! test
@@ -2228,7 +2228,7 @@ http://example.com [[File:Foobar.jpg]]
!! end
@@ -2917,7 +2917,7 @@ File:Foobar.jpg|link=<
!! html/parsoid
-
+
!! end
@@ -2956,7 +2956,7 @@ File:Foobar.jpg
!! html/parsoid
-
+
!! end
@@ -2982,7 +2982,7 @@ File:Foobar.jpg|foo
!! html/parsoid
No Lines!
-
foo
+
foo
!! end
@@ -3004,7 +3004,7 @@ File:Foobar.jpg
!! html/parsoid
-
+
!! end
@@ -3026,7 +3026,7 @@ File:Foobar.jpg
!! html/parsoid
-
+
!! end
@@ -3052,7 +3052,7 @@ File:Foobar.jpg|foo
!! html/parsoid
Packed Overlay!
-
foo
+
foo
!! end
@@ -3078,7 +3078,7 @@ File:Foobar.jpg|foo
!! html/parsoid
Packed Hover!
-
foo
+
foo
!! end
@@ -3090,8 +3090,8 @@ parsoid={
}
!! html/parsoid
-
hi
ho
-
hi ho
+
hi
ho
+
hi ho
!! wikitext
@@ -3109,7 +3109,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
!! html/parsoid
-
+
!! end
!! test
@@ -3121,7 +3121,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
!! html/parsoid
-
+
!! end
!! test
@@ -3134,7 +3134,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -3147,7 +3147,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -3160,7 +3160,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -3173,7 +3173,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -3191,8 +3191,8 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
-
+
+
!! end
!! test
@@ -3207,7 +3207,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -3263,7 +3263,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
An external URL
!! html/parsoid
-An external URL
+An external URL
!! end
!! test
@@ -3277,7 +3277,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
caption:
!! html/parsoid
-
+
!! end
!! test
@@ -3291,7 +3291,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
blog (hk: WEBJOURNAL, tw: WEBLOG)
!! html/parsoid
-
+
!! end
# XXX html2wt disabled because rich markup in alt is not preserved.
@@ -3326,8 +3326,8 @@ File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=-{R|param}-}}
!! html/parsoid
-
-
This is a test template
+
+
This is a test template
!! end
@@ -3340,7 +3340,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
hello
!! html/parsoid
-hello
+hello
!! end
!! test
@@ -3391,7 +3391,7 @@ wgParserEnableLegacyMediaDOM=false
-Test
+Test
!! end
@@ -3410,9 +3410,9 @@ wgParserEnableLegacyMediaDOM=false
foo
caption
bar
!! html/parsoid
-
foo
caption
bar
+
foo
caption
bar
-
+
!! end
!! test
@@ -3426,7 +3426,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php+tidy
foo
caption
bar
!! html/parsoid
-
foo
caption
bar
+
foo
caption
bar
!! end
!! test
@@ -3440,7 +3440,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php+tidy
!! html/parsoid
-
+
!! end
!! test
@@ -3580,7 +3580,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php+tidy
bar
!! html/parsoid
-bar
+bar
!! end
!! test
@@ -3590,7 +3590,7 @@ parsoid=html2wt
language=ar
disabled
!! html/parsoid
-
+
!! wikitext
[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
!! end
@@ -3603,7 +3603,7 @@ Image: Block level image should have \n before and after
456
!! html/parsoid
123
-
+
456
!! end
@@ -3615,7 +3615,7 @@ Image: New block level image should have \n before and after (existing content)
456
!! html/parsoid
123
-
+
456
!! end
@@ -3626,9 +3626,9 @@ Image: upright option (parsoid)
[[File:Foobar.jpg|thumb|upright=0.5|caption]]
[[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
!! html/parsoid
-caption
-caption
-caption
+caption
+caption
+caption
!! end
!! test
@@ -3636,7 +3636,7 @@ Image: upright option is ignored on inline and frame images (parsoid)
!! wikitext
[[File:Foobar.jpg|500x500px|upright=0.5|caption]]
!! html/parsoid
-
+
!! end
!! test
@@ -3644,7 +3644,7 @@ Image: in template parameter with empty parameter
!! wikitext
{{1x|[[File:Foobar.jpg|link=]]}}
!! html/parsoid
-
+
!! end
!! test
@@ -3699,7 +3699,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
!! end
!! test
@@ -3718,11 +3718,11 @@ wgParserEnableLegacyMediaDOM=false
!! html/parsoid
-
+
-
+
-
+
!! end
!! test
@@ -3740,12 +3740,13 @@ wgParserEnableLegacyMediaDOM=false
PMID 1234ISBN 123456789x
!! html/parsoid
-http://example.com
-RFC 1234
-PMID 1234
-ISBN 123456789x
+http://example.com
+RFC 1234
+PMID 1234
+ISBN 123456789x
!! end
+## FIXME: Parsoid isn't recognizing an Interwiki here
!! test
Interwiki links inside image captions
!! options
@@ -3757,7 +3758,7 @@ wgParserEnableLegacyMediaDOM=false
!! html+tidy
Wikipedia:Foo bar
!! html/parsoid
-Wikipedia:Foo bar
+Wikipedia:Foo bar
!! end
## Don't necessarily expect this to roundtrip, but run serialization to catch crashers
@@ -3779,9 +3780,9 @@ wgParserEnableLegacyMediaDOM=false
123
!! html/parsoid
-
+
-123
+123
!! end
!! test
@@ -3793,7 +3794,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php+tidy
!! html/parsoid
-
+
!! end
## The bogus option here isn't going to roundtrip
@@ -3808,7 +3809,7 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
Test 123
!! html/parsoid
-Test 123
+Test 123
!! end
!! test
@@ -3825,10 +3826,69 @@ wgParserEnableLegacyMediaDOM=false
!! html/php
hi
!! html/parsoid
-
+
hi
!! end
+
+## Expect the media structure to account for cases like this since it's common enough
+!! test
+File in formatting element violating content model
+!! config
+wgParserEnableLegacyMediaDOM=false
+!! wikitext
+
''[[File:Foobar.jpg|thumb]]''
+!! html/php
+
+!! html/parsoid
+
+!! end
+
+!! test
+Table in figcaption nested in table
+!! config
+wgParserEnableLegacyMediaDOM=false
+!! wikitext
+{|
+|foo
+|[[File:Foobar.jpg|thumb|
+{|
+|bar
+|}
+]]
+|}
+!! html/php
+
+
+
foo
+
+
bar
+
+!! html/parsoid
+
+
foo
+
+
+
bar
+
+
+
+!! end
+
+!! test
+Files with case sensitive media options
+!! config
+wgParserEnableLegacyMediaDOM=false
+!! wikitext
+[[File:Foobar.jpg|thumb|left]]
+[[File:Foobar.jpg|thumb|Left]]
+!! html/php
+
+Left
+!! html/parsoid
+
+Left
+!! end
--
2.11.4.GIT