!!end
!!test
@@ -2156,7 +2156,7 @@ c
!!end
!!test
-3c. Indent-Pre and block tags (multi-line html)
+3b. Indent-Pre and block tags (multi-line html)
!!input
a foo
b
foo
@@ -2168,7 +2168,7 @@ c
!!end
!!test
-3b. Indent-Pre and block tags (pre-content on separate line)
+3c. Indent-Pre and block tags (pre-content on separate line)
!!input
foo
@@ -2231,6 +2231,78 @@ foo
!!end
+!!test
+4. Indent-Pre and extension tags
+!!input
+ a
+File:foobar.jpg
+
+!!result
+ a
+
+
+
+
+
+
+
+!!end
+
+!! test
+Leading pipes outside of tables
+!! options
+parsoid
+!! input
+| foo
+!! result
+
| foo
+!! end
+
+!! test
+Leading pipes outside of tables 2
+!! options
+parsoid
+!! input
+a
+| foo
+b
+!! result
+
a
+| foo
+b
+!! end
+
+!! test
+Leading pipes outside of tables 3
+!! options
+parsoid
+!! input
+a
+| class="foo bar" | baz
+b
+!! result
+
a
+| class="foo bar" | baz
+b
+!! end
+
+!!test
+Render paragraphs when indent-pre is suppressed in blocklevels
+!!input
+
+ foo
+
+ bar
+
+!! result
+
+
foo
+
bar
+
+
+
+!!end
+
!!test
4. Multiple spaces at start-of-line
!!input
@@ -4153,9 +4225,9 @@ parsoid
(http://example.com)
!! result
-
!! end
###
@@ -5174,9 +5246,18 @@ Link with HTML entity in suffix / tail
!! test
Link with 3 brackets
!! input
-[[[main page]]]
+[[[Main Page]]]
+!! result
+
[[[Main Page]]]
+
+!! end
+
+!! test
+Link with 4 brackets
+!! input
+[[[[Main Page]]]]
!! result
-
!! end
@@ -5599,6 +5680,36 @@ language=kaa
!! end
+!! test
+1. Interaction of linktrail and template encapsulation
+!! options
+parsoid
+!! input
+{{echo|[[Foo]]}}l
+!! result
+
+!! end
+
+!! test
+3. Interaction of linktrail and template encapsulation
+!! options
+parsoid
+!! input
+{{echo|Some [[Fool]]s are '''bold and foolish'''}}
+!! result
+
!! end
!! test
@@ -5771,6 +5881,15 @@ parsoid
is just fragment
!! end
+!! test
+Interwiki links: trail
+!! options
+parsoid
+!! input
+[[wikipedia:Foo|Ba]]r
+!! result
+
!! end
+!! test
+Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
+!! options
+parsoid
+!! input
+[[en:Foo]]
+!! result
+
+!! end
+
###
### Redirects, Parsoid-only
###
!! test
-Simple redirect to page
+1. Simple redirect to page
!! options
parsoid
!! input
@@ -5896,6 +6024,19 @@ parsoid
!! end
+# Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
+!! test
+2. Other redirect variants
+!! options
+parsoid=wt2html,wt2wt
+!! input
+#REDIRECT [[Main_Page]]
+#REDIRECT [[[[Bar]]]]
+!! result
+
+
+!! end
+
!! test
Optional colon in #REDIRECT
!! options
@@ -6017,6 +6158,17 @@ language=is
!! end
+!! test
+New redirect
+!! options
+parsoid=html2wt
+!! input
+Foo
+#REDIRECT [[Foo]]
+!! result
+
Foo
+!! end
+
##
## XHTML tidiness
###
@@ -7513,6 +7665,39 @@ hi+world%3F%21
!! end
+!! test
+Magic Word: prioritize type info over data-parsoid
+!! options
+parsoid=html2wt
+!! input
+__FORCETOC__
+!! result
+
+!! end
+
+!! test
+Magic Word: serialize on separate line (parsoid)
+!! options
+parsoid=wt2wt,html2wt
+!! input
+foo
+__NOTOC__
+bar
+!! result
+foobar
+!! end
+
+!! test
+Magic Word: rt non-english wikis
+!! options
+parsoid=wt2wt
+language=de
+!! input
+__NOEDITSECTION__
+!! result
+
+!! end
+
###
### Magic links
###
@@ -7583,6 +7768,27 @@ Template with invalid target containing unclosed tag
!! end
+!! test
+Template with invalid target containing wikilink (php)
+!! options
+php
+!! input
+{{[[Main Page]]}}
+!! result
+
+!! end
+
!! article
Template:test
!! text
@@ -8874,8 +9080,8 @@ parsoid
foo
-bar
-
+|bar
+|}
!!end
!!test
@@ -9767,6 +9973,31 @@ parsoid
!! end
+!! test
+Allow empty links in image captions (Bug 60753) (parsoid)
+!! options
+parsoid
+!!input
+[[File:Foobar.jpg|thumb|Caption [[Link1]]
+[[]]
+[[Link2]]
+]]
+!! result
+
+!! end
+
+!! test
+Link with empty target
+!! input
+[[]]
+!! result
+
[[]]
+
+!! end
+
!! test
Image with empty attribute (php)
!! options
@@ -9789,7 +10020,37 @@ parsoid=wt2html
!! end
!! test
-Image with attributes from template (php)
+1. Block image with individual attributes from templates
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
+!! result
+
+!! end
+
+!! test
+2. Block Image with individual attributes from templates
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
+!! result
+
+!! end
+
+!! test
+3. Inline image with individual attributes from templates
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|{{echo|50px}}]]
+!! result
+
+!! end
+
+!! test
+Image with multiple attributes from the same template (php)
!! options
php
!! input
@@ -9799,14 +10060,16 @@ php
!! end
+## Parsoid does not provide editing support for images where templates produce multiple image attributes.
+## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
!! test
-Image with attributes from template (parsoid)
+Image with multiple attributes from the same template (parsoid)
!! options
parsoid
!! input
[[File:Foobar.jpg|{{image_attribs}}]]
!! result
-
+
!! end
!! test
@@ -9836,7 +10099,7 @@ parsoid
!! result
123456
123456
-123456
+123456
!! end
!! test
@@ -9860,6 +10123,54 @@ parsoid
!! end
+!! test
+Image with multiple widths -- use last (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|200px|300px|caption]]
+!! result
+
+
+!! end
+
+!! test
+Image with multiple widths -- use last (parsoid)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|200px|300px|caption]]
+!! result
+
+!! end
+
+!! test
+Image with multiple alignments -- use first (bug 48664) (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|thumb|left|right|center|caption]]
+
+[[File:Foobar.jpg|middle|text-top|caption]]
+!! result
+
caption
+
+
+!! end
+
+!! test
+Image with multiple alignments -- use first (bug 48664) (parsoid)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|thumb|left|right|center|caption]]
+
+[[File:Foobar.jpg|middle|text-top|caption]]
+!! result
+
+
+!! end
+
!! test
Image with width attribute at different positions (php)
!! options
@@ -9880,15 +10191,40 @@ Image with width attribute at different positions (parsoid)
!! options
parsoid
!! input
-[[File:Foobar.jpg|200px|right|Caption]]
-[[File:Foobar.jpg|right|200px|Caption]]
-[[File:Foobar.jpg|right|Caption|200px]]
+[[File:Foobar.jpg|200x200px|right|Caption]]
+[[File:Foobar.jpg|right|200x200px|Caption]]
+[[File:Foobar.jpg|right|Caption|200x200px]]
!! result
!! end
+# a sad bit of backward-compatibility
+!! test
+Image with size specified with pxpx (bug 13500, 51628) (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|20pxpx]]
+[[File:Foobar.jpg|200x20pxpx]]
+!! result
+
+
+
+!! end
+
+!! test
+Image with size specified with pxpx (bug 13500, 51628) (parsoid)
+!! options
+parsoid=wt2html,wt2wt
+!! input
+[[File:Foobar.jpg|20pxpx]]
+[[File:Foobar.jpg|200x20pxpx]]
+!! result
+
+!! end
+
!! test
Image with link parameter, wiki target (php)
!! options
@@ -10360,6 +10696,45 @@ Parsoid: Image caption containing leading space
!!end
+!! test
+Image caption containing a table (php)
+!! options
+php
+!! input
+[[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
+{|
+! Foo !! Bar
+|-
+| Foo1 || Bar1
+|}
+and some more text.]]
+!! result
+
This is an example image thumbnail caption with a table
Foo
Bar
Foo1
Bar1
and some more text.
+
+!!end
+
+!! test
+Image caption containing a table (parsoid)
+!! options
+parsoid
+!! input
+[[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
+{|
+! Foo !! Bar
+|-
+| Foo1 || Bar1
+|}
+and some more text.]]
+!! result
+
This is an example image thumbnail caption with a table
+
+
+
Foo
Bar
+
+
Foo1
+
Bar1
and some more text.
+!! end
+
!! test
Bug 3090: External links other than http: in image captions
!! input
@@ -10447,10 +10822,9 @@ Parsoid-specific image handling - simple image with size and middle alignment
!! options
parsoid
!! input
-[[Image:Foobar.jpg|50px|middle]]
+[[File:Foobar.jpg|middle|50px]]
!! result
-
-
+
@@ -10459,30 +10833,41 @@ parsoid
!! end
!! test
-Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
+Parsoid-specific image handling - simple image with size, middle alignment,
+non-standard namespace alias
!! options
-parsoid
+parsoid=wt2wt,wt2html,html2html
!! input
-[[Image:Foobar.jpg|500x10px|baseline|caption]]
+[[Image:Foobar.jpg|middle|50px]]
!! result
-
!! end
!! test
-Parsoid-specific image handling - simple image with border and size spec
+Parsoid-specific image handling - simple image with size and middle alignment
+(existing content)
!! options
parsoid
!! input
-[[Image:Foobar.jpg|50px|border|caption]]
+[[File:Foobar.jpg|50px|middle]]
!! result
-
-
+
+!! end
+
+!! test
+Parsoid-specific image handling - simple image with size and middle alignment
+and non-standard namespace name
+!! options
+parsoid=wt2html,wt2wt,html2html
+!! input
+[[Image:Foobar.jpg|50px|middle]]
+!! result
+
@@ -10490,27 +10875,58 @@ parsoid
!! end
+!! test
+Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|500x10px|baseline|caption]]
+!! result
+
+!! end
+
+!! test
+Parsoid-specific image handling - simple image with border and size spec
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|50px|border|caption]]
+!! result
+
+!! end
+
!! test
Parsoid-specific image handling - thumbnail with halign, valign, and caption
!! options
parsoid
!! input
-[[Image:Foobar.jpg|thumb|left|baseline|caption content]]
+[[File:Foobar.jpg|left|baseline|thumb|caption content]]
!! result
!! end
+!! test
+Parsoid-specific image handling - thumbnail with halign, valign, and caption
+(existing content)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|thumb|left|baseline|caption content]]
+!! result
+
+!! end
+
!! test
Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
!! options
parsoid
!! input
-[[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
+[[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
!! result
!! end
+!! test
+Parsoid-specific image handling - thumbnail with specific size, halign,
+valign, and caption (existing content)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
+!! result
+
+!! end
+
!! test
Parsoid-specific image handling - framed image with specific size and caption
!! options
parsoid
!! input
-[[Image:Foobar.jpg|500x50px|frame|caption]]
+[[Image:Foobar.jpg|frame|500x50px|caption]]
!! result
!! end
+!! test
+Parsoid-specific image handling - framed image with specific size and caption
+(existing content)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|442x50px|frame|caption]]
+!! result
+
+!! end
+
!! test
Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
!! options
parsoid
!! input
-[[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
+[[Image:Foobar.jpg|left|baseline|frame|500x50px|caption]]
!! result
!! end
+!! test
+Parsoid-specific image handling - framed image with specific size, halign,
+valign, and caption (existing content)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|442x50px|frame|left|baseline|caption]]
+!! result
+
+!! end
+
!! test
Parsoid-specific image handling - frameless image with specific size, border, and caption
!! options
parsoid
!! input
-[[Image:Foobar.jpg|frameless|500x50px|border|caption]]
+[[File:Foobar.jpg|frameless|442x50px|border|caption]]
!! result
-
+!! end
!! test
Parsoid-specific image handling - caption with a template in it
!! options
parsoid
!! input
-[[File:Foobar.jpg|thumb|200x200px|This caption has a {{echo|transclusion}} in it.]]
+[[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
!! result
!! end
@@ -10605,6 +11046,40 @@ bar
bar
!! end
+!! test
+Parsoid-specific image handling - empty caption
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|thumb|]]
+!! result
+
+!! end
+
+!! test
+Parsoid-specific image handling - whitespace caption
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|thumb| ]]
+!! result
+
+!! end
+
+!! test
+Parsoid-specific image handling - lang option
+!! options
+parsoid
+!! input
+foo
+[[File:Foobar.svg|lang=de|caption]]
+bar
+!! result
+
foo
+
+bar
+!! end
+
###
### Subpages
@@ -12117,7 +12592,7 @@ MSIE CSS safety test: comment in expression
!! end
!! test
-CSS safety test: vertical tab
+CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
!! input
A
!! result
@@ -12126,7 +12601,7 @@ CSS safety test: vertical tab
!! end
!! test
-MSIE CSS safety test: Fullwidth
+MSIE 6 CSS safety test: Fullwidth (bug 55332)
!! input
+!! end
+
!! test
Bug 22905: followed by ISBN followed by
!! input
@@ -16687,6 +17182,19 @@ language=be-tarask
!! end
+!! test
+Wrong option for formatNum (bug 56199)
+!! input
+{{formatnum:1,234.56|Random}}
+{{formatnum:1,234.56|EVERYTHING}}
+{{formatnum:1234.56|any argument that has the string 'NOSEP'}}
+!! result
+
1,234.56
+1,234.56
+1,234.56
+
+!! end
+
!! test
Strip marker in grammar
!! options
@@ -17012,10 +17520,10 @@ A
!!result
-
!! 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
+Generate references for unclosed references tag
+!! options
+parsoid=wt2html
+!! input
+afoo
+
+
+!! result
+
+!! end
+
+!! test
+New reference serializes on its own line
+!! options
+parsoid=wt2wt,html2wt
+!! input
+foo
+
+!! result
+foo
+!! end
+
#### ----------------------------------------------------------------
#### The following section of tests are primarily to test
#### wikitext escaping capabilities of Parsoid. Given that
@@ -18087,6 +18624,21 @@ parsoid
!! end
+!! test
+Tables: Digest broken attributes on table and tr tag
+!! options
+parsoid=wt2html
+!! input
+{| || |} ++
+|- || || ++ --
+|}
+!! result
+
+
+
+
+!! end
+
#### --------------- Links ----------------
#### 1. Quote marks in link text
#### 2. Wikilinks: Escapes needed
@@ -18109,15 +18661,17 @@ Links 2. WikiLinks: Escapes needed
!! options
parsoid
!! input
-[[Foo|[Foobar]]]
+[[Foo|[Foobar]]]
[[Foo|Foobar]]]
[[Foo|x [Foobar] x]]
-[[Foo|x [http://google.com g] x]]
+[[Foo|x [http://google.com g] x]]
[[Foo|[[Bar]]]]
[[Foo|x [[Bar]] x]]
[[Foo||Bar]]
[[Foo|]]bar]]
[[Foo|[[bar]]
+[[Foo|x [[ y]]
+[[Foo|x ]] y]]
[[Foo|x ]] y [[ z]]
!! result
[Foobar]
@@ -18129,6 +18683,8 @@ parsoid
|Bar]]bar[[bar
+x [[ y
+x ]] yx ]] y [[ z
!! end
@@ -18805,7 +19361,7 @@ plain text
!!end
!!test
-Ensure fostered text content is wrapped in spans
+1. Ensure fostered text content is wrapped in spans
!!options
parsoid=wt2html
!!input
@@ -18817,6 +19373,24 @@ parsoid=wt2html
!!end
+!!test
+2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
+!!options
+parsoid=wt2html,wt2wt
+!!input
+