!! options
version=2
parsoid-compatible=wt2html,wt2wt
!! end
!! article
Main Page
!! text
blah blah
!! endarticle
!! article
Foo''s bar''s
!! text
Article titles can contain single quotes!
!! endarticle
!! article
Template:1x
!! text
{{{1}}}
!! endarticle
!! article
Template:image_attribs
!! text
[[File:foobar.jpg|right|Caption text]]
!! endarticle
!! article
Template:paramtest
!! text
This is a test template with parameter {{{param}}}
!! endarticle
!! article
Template:test
!! text
This is a test template
!! endarticle
!! article
MediaWiki:bad image list
!! text
* [[File:Bad.jpg]] except [[Nasty page]]
!! endarticle
!! article
File:Redirect to foobar.jpg
!! text
#REDIRECT[[File:Foobar.jpg]]
!! endarticle
###
### Images
###
### For Parsoid-specific tests, see
### https://www.mediawiki.org/wiki/Specs/HTML#Images
!! test
Simple image
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:foobar.jpg]]
!! html/php
!! html/parsoid
!! end
!! test
Simple image redirect
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:Redirect to foobar.jpg]]
!! html/php
!! html/parsoid+integrated
!! end
!! test
Serialize simple image with figure-inline wrapper
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
[[File:Foobar.jpg]]
!! end
!! test
Simple image (using File: namespace, now canonical)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg]]
!! html/php
!! html/parsoid
!! end
!! test
Right-aligned image
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|right]]
!! html/php
!! html/parsoid
!! end
!! test
Image with caption
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|right|Caption text]]
!! html/php
!! html/parsoid
!! end
!! test
Image with caption, T55312 #1
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|right|Caption page stuff]]
!! html/php
!! html/parsoid
!! end
!! test
Image with caption, T55312 #2
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|right|Caption page=]]
!! html/php
!! html/parsoid
!! end
!! test
Image with caption, T55312 #3
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|right|Caption page=stuff]]
!! html/php
!! html/parsoid
!! end
!! test
Image caption with pipe entity
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|one | two]]
[[File:Foobar.jpg|thumb|one ''two'' | three]]
!! html/php
one | two
one two | three
!! html/parsoid
!! end
!! test
Bad images - basic functionality
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Bad.jpg]]
!! html/php
!! end
!! test
Bad images - T18039: text after bad image disappears
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
Foo bar
[[File:Bad.jpg]]
Bar foo
!! html/php
!! end
!! article
Link1
!! text
Dummy article to suppress redlinks in tests
!! end
!! article
Link2
!! text
Dummy article to suppress redlinks in tests
!! end
!! test
Allow empty links in image captions (T62753)
!! options
thumbsize=220
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|Caption [[Link1]]
[[]]
[[Link2]]
]]
!! html/php
!! html/parsoid
!! end
!! test
Titles in unlinked images (T23454)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|link=|stuff]]
!! html/php
!! html/parsoid
!! end
!! test
Link with empty target
!! wikitext
[[]]
!! html
[[]]
!! end
!! test
Image with link trail
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
Linktrails should not work for images: [[File:Foobar.jpg]]s
!! html/php
Linktrails should not work for images: s
!! html/parsoid
Linktrails should not work for images: s
!! end
!! test
Image with empty attribute
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|right||Caption text]]
!! html/php
!! html/parsoid
!! end
!! test
1. Block image with individual attributes from templates
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|{{1x|137px}}|This is a caption]]
!! html/php
This is a caption
!! html/parsoid
!! end
!! test
2. Block Image with individual attributes from templates
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|{{1x|thumb}}|{{1x|137px}}|This is a caption]]
!! html/php
This is a caption
!! html/parsoid
!! end
!! test
3. Inline image with individual attributes from templates
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|{{1x|50px}}]]
!! html/php
!! html/parsoid
!! 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 multiple attributes from the same template
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|{{image_attribs}}]]
!! html/php
!! html/parsoid
!! end
!! test
Image with link tails
!! options
thumbsize=220
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
123[[File:Foobar.jpg]]456
123[[File:Foobar.jpg|right]]456
123[[File:Foobar.jpg|thumb]]456
!! html/php
123456
123
456
123
456
!! html/parsoid
123456
123
456
123
456
!! end
!! test
Image with multiple captions -- only last one is accepted
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
!! html/php
!! html/parsoid
!! end
!! test
Image with multiple widths -- use last
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|200px|300px|caption]]
!! html/php
!! html/parsoid
!! end
!! test
Image with multiple alignments -- use first (T50664)
!! options
thumbsize=220
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|left|right|center|caption]]
[[File:Foobar.jpg|middle|text-top|caption]]
!! html/php
caption
!! html/parsoid
!! end
!! test
Image with width attribute at different positions
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|200px|right|Caption]]
[[File:Foobar.jpg|right|200px|Caption]]
[[File:Foobar.jpg|right|Caption|200px]]
!! html/php
!! html/parsoid
!! end
# a sad bit of backward-compatibility
!! test
Image with size specified with pxpx (T15500, T53628)
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|20pxpx]]
[[File:Foobar.jpg|200x20pxpx]]
!! html/php
!! html/parsoid
!! end
!! test
Image with link parameter, wiki target
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|link=Main Page]]
!! html/php
!! html/parsoid
!! end
# parsoid T51293 (part 1)
!! test
Image with link parameter, URL target
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|link=http://example.com/]]
!! html/php
!! html/parsoid
!! end
# parsoid T51293 (part 2)
!! test
Image with link parameter, protocol-less URL target
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|link=//example.com/]]
!! html/php
!! html/parsoid
!! end
!! test
Escaping non-block captions (T107435)
!! options
parsoid={
"modes": ["wt2wt"],
"changes": [
["[typeof~='mw:File']", "attr", "data-mw", "{\"caption\": \"|\"}"]
]
}
!! wikitext
[[Image:Foobar.jpg|alt=123|caption]]
!! wikitext/edited
[[Image:Foobar.jpg|alt=123||]]
!! end
# wgExternalLinkTarget not supported by Parsoid
!! test
Image with link parameter, wgExternalLinkTarget
!! wikitext
[[Image:foobar.jpg|link=http://example.com/]]
!! config
wgExternalLinkTarget="foobar"
wgParserEnableLegacyMediaDOM=true
!! html/php
!! end
!! test
Image with link parameter, wgNoFollowLinks set to false
!! wikitext
[[Image:foobar.jpg|link=http://example.com/]]
!! config
wgNoFollowLinks=false
wgParserEnableLegacyMediaDOM=true
!! html/php
!! end
!! test
Image with link parameter, wgNoFollowDomainExceptions
!! wikitext
[[Image:foobar.jpg|link=http://example.com/]]
!! config
wgNoFollowDomainExceptions="example.com"
wgParserEnableLegacyMediaDOM=true
!! html/php
!! end
# wgExternalLinkTarget not supported by Parsoid
!! test
Image with link parameter, wgExternalLinkTarget, unnamed parameter
!! wikitext
[[Image:foobar.jpg|link=http://example.com/|Title]]
!! config
wgExternalLinkTarget="foobar"
wgParserEnableLegacyMediaDOM=true
!! html/php
!! end
!! test
Image with empty link parameter
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|link=]]
!! html/php
!! html/parsoid
!! end
!! test
Image with link parameter (wiki target) and unnamed parameter
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|link=Main_Page|Title]]
!! html/php
!! html/parsoid
!! end
!! test
Image with link parameter (URL target) and unnamed parameter
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|link=http://example.com/|Title]]
!! html/php
!! html/parsoid
!! end
!! test
Thumbnail image with link parameter
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
!! html/php
Title
!! html/parsoid
!! end
!! test
Manually-specified thumbnail image
!! options
thumbsize=220
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
!! html/php
!! html/parsoid
!! end
!! test
Manually-specified thumbnail image with explicit link to wiki page
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
!! html/php
Title
!! html/parsoid
!! end
!! test
Manually-specified thumbnail image with explicit link to url
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
!! html/php
Title
!! html/parsoid
!! end
!! test
Manually-specified thumbnail image with explicit no link
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
!! html/php
Title
!! html/parsoid
!! end
!! test
Manually-specified thumbnail image with explicit link and alt text
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
!! html/php
Title
!! html/parsoid
!! end
!! test
Image with frame and link
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
!! html/php
!! html/parsoid
!! end
!! test
Image with frame and link and explicit alt
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
!! html/php
!! html/parsoid
!! end
!! test
Image with wiki markup in implicit alt
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:Foobar.jpg|testing '''bold''' in alt]]
[[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
!! html/php
!! html/parsoid
!! end
!! test
Alt image option should handle most kinds of wikitext without barfing
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{1x|''bold template''}}.]]
!! html/php
This is the image caption
!! html/parsoid
!! end
!! test
Ampersand in alt attribute (T206940)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|alt=&]]
File:Foobar.jpg|alt=&
!! html/php
!! html/parsoid
!! end
## FIXME: The inconsistency in the gallery extension on the php side is T49646
# Parsoid test is only wt2html because it inserts around the
# alt text when serializing (which is fine).
!! test
Link with encoded pipe in alt option
!! options
parsoid=wt2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|alt=http://testing.123?4=5|6|caption]]
[[File:Foobar.jpg|alt=http://testing.123?4=5|6|caption]]
File:Foobar.jpg|alt=http://testing.123?4=5|6|caption
File:Foobar.jpg|alt=http://testing.123?4=5|6|caption
!! html/php
!! html/parsoid
caption
caption
!! end
!! test
Italics markup in alt attribute (T206940)
!! options
parsoid=wt2html,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|alt=''x''|caption]]
File:Foobar.jpg|alt=''x''|caption
!! html/php
caption
!! html/parsoid
caption
!! end
!! test
Nowiki markup in alt attribute (edited html, no data-parsoid) (T206940)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|alt=''x''|caption]]
File:Foobar.jpg|alt=''x''|caption
!! html/php
caption
!! html/parsoid
caption
!! end
!! test
Ampersand in link attribute (edited html, no data-parsoid) (T206940)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|link=Foo_&_bar]]
File:Foobar.jpg|link=Foo_&_bar
!! html/php
!! html/parsoid
!! end
!! test
Italics markup in link attribute (T206940)
!! options
parsoid=wt2html,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Foo''s bar''s]]
[[File:Foobar.jpg|link=Foo''s bar''s|caption1]]
[[File:Foobar.jpg|link=''Main Page''|caption2]]
File:Foobar.jpg|link=Foo''s bar''s|caption1
File:Foobar.jpg|link=''Main Page''|caption2
!! html/php
!! end
!! test
Nowiki markup in link attribute (edited html, no data-parsoid) (T206940)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|link=Foo''s_bar''s|caption]]
File:Foobar.jpg|link=Foo''s_bar''s|caption
!! html/php
caption
!! html/parsoid
caption
!! end
!! test
HTML entity prefix in link markup (T209236)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|link=https://example.com?foo¶ms=bar]]
File:Foobar.jpg|link=https://example.com?foo¶ms=bar
!! html/php
!! html/parsoid
!! end
!! test
Image link markup is not generated when redundant (T108504) - encoded href
!! options
parsoid=html2wt,wt2wt
language=sr
!! wikitext
[[Датотека:Foobar.jpg]]
!! html/parsoid
!! 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|
{|
{{1x|{{!}} hi}}
|}
]]
!! html/parsoid
hi
!! end
!! test
Image with nested tables in caption
!! wikitext
[[File:Foobar.jpg|thumb|Foo
{|
|
{|
|z
|}
|}
]]
!! html/parsoid
Foo
z
!! end
!! test
Image with heading and horizontal rule in caption
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|
===Testing===
123
--------------
]]
!! html/php
!! html/parsoid
!! end
###################
# Conflicting image format options.
# First option specified should 'win'.
# All three cases in each test should be identical.
!! test
Image with 'frameless' first.
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|frameless|caption]]
[[File:Foobar.jpg|frameless|frame|caption]]
[[File:Foobar.jpg|frameless|thumb|caption]]
[[File:Foobar.jpg|frameless|thumbnail=Thumb.png|caption]]
!! html/php
!! html/parsoid
!! end
!! test
Image with 'frame' first.
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|frame|caption]]
[[File:Foobar.jpg|frame|frameless|caption]]
[[File:Foobar.jpg|frame|thumb|caption]]
[[File:Foobar.jpg|frame|thumbnail=Thumb.png|caption]]
!! html/php
caption
caption
caption
caption
!! html/parsoid
!! end
!! test
Image with 'thumb' first.
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|caption]]
[[File:Foobar.jpg|thumb|frameless|caption]]
[[File:Foobar.jpg|thumb|frame|caption]]
[[File:Foobar.jpg|thumb|thumbnail=Thumb.png|caption]]
!! html/php
caption
caption
caption
caption
!! html/parsoid
!! end
!! test
Image with 'thumbnail=' first.
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumbnail=Thumb.png|caption]]
[[File:Foobar.jpg|thumbnail=Thumb.png|frameless|caption]]
[[File:Foobar.jpg|thumbnail=Thumb.png|frame|caption]]
[[File:Foobar.jpg|thumbnail=Thumb.png|thumb|caption]]
!! html/php
caption
caption
caption
caption
!! html/parsoid
!! end
###################
# Image sizing.
# See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
# and https://phabricator.wikimedia.org/T64258
# Foobar has actual size of 1941x220
# 1. Thumbs & frameless always reduce, can't be enlarged unless it's
# a scalable format.
# 2. Framed & manual images always ignore size options; always
# render at original size.
# 3. "Unspecified format" and border are the only types which can be
# enlarged.
# 4. The srcset attribute doesn't occur if image is being enlarged
!! test
Image: unspecified format and border enlarge
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|2000px]]
[[File:Foobar.jpg|border|2000px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: "unspecified format" and border reduce
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|1000px]]
[[File:Foobar.jpg|border|1000px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: thumbs reduce
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|50px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: bitmap thumbs can't be enlarged past original size, but vector can.
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|2000px]]
[[File:Foobar.svg|thumb|2000px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: frameless can reduce in size
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|frameless|50px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: bitmap frameless can't be enlarged past original size, but vector can
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|frameless|2000px]]
[[File:Foobar.svg|frameless|2000px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: framed images are always unscaled.
!! config
wgParserEnableLegacyMediaDOM=true
!! options
parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|frame]]
[[File:Foobar.jpg|frame|50px]]
[[File:Foobar.jpg|frame|50x50px]]
[[File:Foobar.jpg|frame|2000px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: manualthumb images are always unscaled.
!! options
parsoid=wt2html,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumbnail=Thumb.png]]
[[File:Foobar.jpg|thumbnail=Thumb.png|50px]]
[[File:Foobar.jpg|thumbnail=Thumb.png|50x50px]]
[[File:Foobar.jpg|thumbnail=Thumb.png|2000px]]
!! html/php
!! html/parsoid
!! end
!! test
Bogus sizes during html2wt
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
[[File:Foobar.jpg]]
[[File:Foobar.jpg|10x10px]]
!! end
###################
!! test
Link to image page- image page normally doesn't exist, hence edit link
Add test with existing image page
#
!! end
!! test
T20784 Link to non-existent image page with caption should use caption as link text
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[:Image:test|caption]]
!! html/php
!! end
!! test
Frameless image caption with a free URL
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|http://example.com]]
!! html/php
!! html/parsoid
!! end
!! test
Thumbnail image caption with a free URL
!! options
thumbsize=220
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|http://example.com]]
!! html/php
!! html/parsoid
!! end
!! test
Thumbnail image caption with a free URL and explicit alt
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
!! html/php
!! html/parsoid
!! end
!! test
SVG thumbnails with no language set
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.svg|thumb|caption]]
!! html/php
caption
!! html/parsoid
!! end
!! test
SVG thumbnails with language de
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.svg|lang=de|thumb|caption]]
!! html/php
caption
!! html/parsoid
!! end
!! test
SVG thumbnails with invalid language code
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
!! html/php
lang=invalid:language:code
!! html/parsoid
!! end
!! test
SVG thumbnails in page language
!! options
title=Rupage
language=ru
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Файл:Foobar.svg]] [[Файл:Foobar.svg|lang=en]]
!! html/php
!! html/parsoid
!! end
!! test
SVG thumbnails in page language not present in the file
!! options
title=Depage
language=de
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Datei:Foobar.svg]] [[Datei:Foobar.svg|sprache=ru]]
!! html/php
!! html/parsoid
!! end
!! test
T3887: A ISBN with a thumbnail
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|ISBN 1235467890]]
!! html/php
!! html/parsoid
!! end
!! test
T3887: A RFC with a thumbnail
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|This is RFC 12354]]
!! html/php
!! html/parsoid
!! end
!! test
T3887: A mailto link with a thumbnail
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
!! html/php
!! html/parsoid
!! end
# Pending resolution to T2368
!! test
T2648: Frameless image caption with a link
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|text with a [[link]] in it]]
!! html/php
!! html/parsoid
!! end
!! test
T2648: Frameless image caption with a link (suffix)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|text with a [[link]]foo in it]]
!! html/php
!! html/parsoid
!! end
!! test
T2648: Frameless image caption with an interwiki link
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
!! html/php
!! html/parsoid
!! end
!! test
T2648: Frameless image caption with a piped interwiki link
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
!! html/php
!! html/parsoid
!! end
!! test
T107474: Frameless image caption with
!! wikitext
[[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
!! html/parsoid
!! end
!! test
Escape HTML special chars in image alt text
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|& < > "]]
!! html/php
!! html/parsoid
!! end
!! test
Escape HTML special chars in image alt text with LanguageConverter
!! options
language=zh
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|& < > "]]
!! html/php
!! html/parsoid
!! end
!! test
Entities in file name and attributes
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
!! html/php
!! end
!! test
T2499: Alt text should have Ӓ, not &1234;
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|♀]]
!! html/php
!! html/parsoid
!! end
!! test
Broken image caption with link
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
!! html/php
[[Image:Foobar.jpg|thumb|This is a broken caption. But this is just an ordinary link.
!! html/parsoid
[[Image:Foobar.jpg|thumb|This is a broken caption. But this is just an ordinary link.
!! end
!! test
Image caption containing another image
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
!! html/php
This is a caption with another inside it!
!! html/parsoid
!! end
!! test
Image: caption containing a newline
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|This
*is some text]]
!! html/php
!! html/parsoid
!!end
!!test
Image: caption containing leading space
(The leading space should not trigger nowiki escaping in wt2wt mode)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb| bar]]
!! html/php
bar
!! html/parsoid
!!end
# html/php output not have newlines after table, td, th, etc. because
# Linker::makeThumbLink2() replaces the newlines with spaces since
# the table is inside a caption.
# FIXME: Verify if that circa 2004 fix is still required.
!! test
Image: caption containing a table
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
{|
!Foo!!Bar
|-
|Foo1||Bar1
|}
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
Foo
Bar
Foo1
Bar1
and some more text.
!! end
!! test
T5090: External links other than http: in image captions
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
!! html/php
!! html/parsoid
!! end
!! test
Localized image handling (3).
!! options
language=fa
parsoid=html2wt
!! html/parsoid
!! wikitext
[[File:Foobar.jpg|بندانگشتی]]
!! end
!! test
"border", "frameless" and "class" attributes on an image.
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|frameless|border|class=extra|caption]]
!! html/php
!! html/parsoid
!! end
# Note that 'right' is the default alignment, despite the misspelled 'righ' below
!! test
Invalid image attributes (T64500)
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|float|left|caption]]
[[File:Foobar.jpg|thumb|righ|caption]]
[[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
!! html/php
caption
caption
caption
!! html/parsoid
!! end
!! article
File:Barfoo.jpg
!! text
#REDIRECT [[File:Barfoo.jpg]]
!! endarticle
# FIXME: Parsoid should run this test -- but we'd need to teach the
# mockAPI about the redirected Barfoo.jpg image.
!! test
Redirected image
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:Barfoo.jpg]]
!! html/php
!! end
## FIXME: Parsoid needs to learn about this flag.
!! test
Missing image with uploads disabled
!! options
wgEnableUploads=0
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobaz.jpg]]
!! html/php
!! end
# Parsoid-specific testing for images
# https://www.mediawiki.org/wiki/Specs/HTML#Images
# Currently imperfect due to a flaw in the Parsoid testrunner
# Work in progress
# THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
# image tests.
!! test
Parsoid-specific image handling - simple image with size and middle alignment
!! wikitext
[[File:Foobar.jpg|middle|50px]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
!! options
parsoid=wt2wt,wt2html,html2html
!! wikitext
[[Image:Foobar.jpg|middle|50px]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - simple image with size and middle alignment (existing content)
!! wikitext
[[File:Foobar.jpg|50px|middle]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[Image:Foobar.jpg|50px|middle]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
!! wikitext
[[File:Foobar.jpg|500x10px|baseline|caption]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - simple image with border and size spec
!! wikitext
[[File:Foobar.jpg|50px|border|caption]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - thumbnail with halign, valign, and caption
!! options
parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|left|baseline|thumb|caption content]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
!! options
parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|thumb|left|baseline|caption content]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
!! options
parsoid=wt2html,html2html
!! wikitext
[[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
!! options
parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
!! options
parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|frame|500x50px|caption]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
!! options
parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - frameless image with specific size, border, and caption
!! wikitext
[[File:Foobar.jpg|frameless|442x50px|border|caption]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - simple image with a formatted caption
!! wikitext
[[File:Foobar.jpg|
a
b
c
]]
!! html/parsoid
!! end
!! test
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
!! end
!! test
Parsoid-specific image handling - caption with unbalanced tags in it
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
foo
[[File:Foobar.jpg|thumb|200x200px|This caption has a
unbalanced tag in it.]]
bar
!! html/parsoid
foo
bar
!! end
!! test
Parsoid-specific image handling - empty caption (1)
!! options
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
!! test
Parsoid-specific image handling - empty caption (2)
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
[[File:Foobar.jpg|thumb]]
!! end
!! test
Parsoid-specific image handling - whitespace caption
!! wikitext
[[File:Foobar.jpg|thumb| ]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - lang option
!! wikitext
foo
[[File:Foobar.svg|lang=de|caption]]
bar
!! html/parsoid
foo
bar
!! end
!! test
File containing double quotes and spaces
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Cool "Gator".png]]
!! html/php
!! end
!! test
Media in wikilink
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Test|[[File:Foobar.jpg]]]]
!! html/php
[[Test|]]
!! html/parsoid
[[Test|]]
!! end
!! article
No link
!! text
Dummy article to suppress redlinks in tests
!! end
!! test
Template with thumb image (with link in description)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
{{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
!! html/php
!! end
!! test
T3219 URL next to image (good)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
http://example.com [[File:Foobar.jpg]]
!! html/php
!! end
## Parsoid thinks the "centre" here is a property, not a caption.
!! test
Gallery
!! options
parsoid={
"modes": ["wt2html"]
}
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
image1.png |
image2.gif|||||
image3|
image4 |300px| centre
image5.svg| http://///////
[[x|xx]]]]
* image6
!! html/php
!! end
!! test
Gallery (without px units)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg
!! html/php
!! html/parsoid
!! end
!! test
Gallery (with invalid units)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg
!! html/php
!! html/parsoid
!! end
!! test
Gallery with link that has fragment
!! options
parsoid={
"modes": ["wt2html", "html2html"]
}
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
image:foobar.jpg|link=Main_Page
image:foobar.jpg|link=Main_Page#section
image:foobar.jpg|link=Main Page#section|caption
!! html/php
caption
!! html/parsoid
caption
!! end
!! test
Gallery with template inside caption
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg|{{1x|ho}}
!! html/php
hi
ho
!! html/parsoid
hi
ho
!! end
!! article
Link
!! text
Dummy article to suppress redlinks in tests
!! end
# Ugh! The +standalone/+integrated repetition is because of the {{ns:-1}} wikitext that
# renders as "-1" in standalone mode and "Special" in integrated mode.
!! test
Gallery with wikitext inside gallery caption
!! options
parsoid={
"modes": ["wt2html", "html2html"]
}
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg|Image caption
!! html/php
# This should not be a list item Text boldlink Special
# This should not be a list item Text boldlinkSpecial
Image caption
!! end
!! test
Gallery with wikitext inside caption
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
!! html/php
This is a test template
!! html/parsoid
This is a test template
!! end
!! test
Gallery with wikitext incl bogus HTML tag (T237318)
!! options
parsoid=wt2html,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg|
!! html/php
</ref>
!! html/parsoid
</ref>
!! end
!! test
Gallery (with showfilename option)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Nonexistent.jpg|caption
File:Nonexistent.jpg
File:Foobar.jpg|some '''caption''' [[Main Page]]
File:Foobar.jpg
File:Redirect to foobar.jpg
!! html/php
!! end
!! test
Gallery override link with wikilink (T36852)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg|alt=galleryalt|link=Wikilink
!! html/php
!! html/parsoid
!! end
!! test
Gallery override link with absolute external link (T36852)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
!! html/php
!! html/parsoid
!! end
## Putting the caption at the end here runs into T49646 on the php side
## so reducing the modes this runs in Parsoid
!! test
Gallery override link with absolute external link with LanguageConverter
!! options
language=zh
parsoid=wt2html,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
!! html/php
caption
!! html/parsoid
caption
!! end
!! test
Gallery override link with malicious javascript (T36852)
!! options
parsoid={
"modes": ["wt2html", "html2html"]
}
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
!! html/php
!! html/parsoid
!! end
!! test
Gallery with invalid title as link (T45964)
!! options
parsoid={
"modes": ["wt2html", "html2html"]
}
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg|link=<
!! html/php
!! html/parsoid
!! end
!! test
Serialize gallery without attrs in data-mw
!! options
parsoid={
"modes": ["html2wt"]
}
!! html/parsoid
!! wikitext
File:Test.png
!! end
!! test
Gallery with class and style attributes
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg
!! html/php
!! html/parsoid
!! end
!! test
Gallery in nolines mode
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg|foo
!! html/php
No Lines!
foo
!! html/parsoid
No Lines!
foo
!! end
!! test
Gallery in slideshow mode
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg
!! html/php
!! html/parsoid
!! end
!! test
Gallery in packed mode
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg
!! html/php
!! html/parsoid
!! end
!! test
Gallery in packed-overlay mode
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg|foo
!! html/php
Packed Overlay!
foo
!! html/parsoid
Packed Overlay!
foo
!! end
!! test
Gallery in packed-hover mode
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg|foo
!! html/php
Packed Hover!
foo
!! html/parsoid
Packed Hover!
foo
!! end
!! test
Serialize gallery image captions on a line
!! options
parsoid={
"modes": ["html2wt"]
}
!! html/parsoid
hi
ho
hi ho
!! wikitext
File:Foobar.jpg| hi ho
File:Foobar.jpg|hi ho
!! end
!! test
Centre-aligned image
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:foobar.jpg|centre]]
!! html/php
!! html/parsoid
!! end
!! test
None-aligned image
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:foobar.jpg|none]]
!! html/php
!! html/parsoid
!! end
!! test
Width + Height sized image (using px) (height is ignored)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:foobar.jpg|640x480px]]
!! html/php
!! html/parsoid
!! end
!! test
Width-sized image (using px, no following whitespace)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:foobar.jpg|640px]]
!! html/php
!! html/parsoid
!! end
!! test
Width-sized image (using px, with following whitespace - test regression from r39467)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:foobar.jpg|640px ]]
!! html/php
!! html/parsoid
!! end
!! test
Width-sized image (using px, with preceding whitespace - test regression from r39467)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Image:foobar.jpg| 640px]]
!! html/php
!! html/parsoid
!! end
!! test
Image with page parameter
!! options
djvu
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:LoremIpsum.djvu]]
[[File:LoremIpsum.djvu|page=2]]
!! html/php
!! html/parsoid
!! end
!! test
Image with page parameter generated by a template
!! options
djvu
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:LoremIpsum.djvu|page={{1x|2}}]]
!! html/php
!! html/parsoid
!! end
!! test
Image with modified page parameter; serialize data-mw not href query
!! options
djvu
parsoid={
"modes": ["wt2wt", "selser"],
"changes": [
["a[href]", "attr", "href", "./File:LoremIpsum.djvu?page=3"]
]
}
!! wikitext
[[File:LoremIpsum.djvu|page 2]]
[[File:LoremIpsum.djvu|page {{1x|2}}]]
!! wikitext/edited
[[File:LoremIpsum.djvu|page 2]]
[[File:LoremIpsum.djvu|page {{1x|2}}]]
!! end
!! test
Image with modified page parameter; serialize data-mw not href query (2)
!! options
djvu
parsoid={
"modes": ["wt2wt", "selser"],
"changes": [
["span", "attr", "data-mw", "{}"]
]
}
!! wikitext
[[File:LoremIpsum.djvu|page 2]]
[[File:LoremIpsum.djvu|page {{1x|2}}]]
!! wikitext/edited
[[File:LoremIpsum.djvu]]
[[File:LoremIpsum.djvu]]
!! end
# Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "" tag.
!! test
Images with the "|" character in the comment
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|An [http://test/?param1=|left|¶m2=|x external] URL]]
!! html/php
!! html/parsoid
!! end
!! test
T146305: Don't break image parsing if language converter markup is in the caption.
!! options
language=sr
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
!! html/php
caption:
!! html/parsoid
!! end
!! test
T146305: Don't break image parsing if nested language converter markup is in the caption.
!! options
language=zh variant=zh-cn
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
!! html/php
blog (hk: WEBJOURNAL, tw: WEBLOG)
!! html/parsoid
!! end
# XXX html2wt disabled because rich markup in alt is not preserved.
!! test
Don't break gallery if language converter markup is inside.
!! options
language=zh
parsoid=wt2html,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
File:Foobar.jpg|alt=-{R|bat}-|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]
File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=-{R|param}-}}
!! html/php
This is a test template
!! html/parsoid
This is a test template
!! end
!! test
Free external link invading image caption
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|http://x|hello]]
!! html/php
hello
!! html/parsoid
!! end
!! test
Special characters in embedded file links (T29679)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Contains & ampersand.jpg]]
[[File:Does not exist.jpg|Title with & ampersand]]
!! html/php
!! end
# T65642/T68749: Formatting elt fixup around images.
# We know wt2wt will fail, but we expect selser to pass.
# Due to the nature of our testing, wt2wt and selser tests will enter the
# banned list and we'll catch selser regressions based on changes to the
# banned list entries for selser tests.
!! test
1. Treebuilder fixup of formatting elt
!! options
parsoid=wt2html,wt2wt
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
{|
|
[[Image:Foobar.jpg|right|Test]]
|}
!! html/php
!! html/parsoid
!! end
!! test
2. Treebuilder fixup of formatting elt
!! options
parsoid=wt2html,wt2wt
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
'''foo[[File:Foobar.jpg|thumb|caption]]bar'''
[[Image:Foobar.jpg|right|300px]]
!! html/php
foo
caption
bar
!! html/parsoid
foo
bar
!! end
!! test
3. Treebuilder fixup of formatting elt
!! options
parsoid=wt2html,wt2wt
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
'''foo[[File:Foobar.jpg|thumb|caption]]bar'''
!! html/php
foo
caption
bar
!! html/parsoid
foo
bar
!! end
!! test
4. Treebuilder fixup of formatting elt: formatting tags around captionless images
!! options
parsoid=wt2html,wt2wt
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
'''[[Image:Foobar.jpg|right|300px]]'''
!! html/php
!! html/parsoid
!! end
!! test
Image: Modifying size of an image (1)
!! options
parsoid={
"modes": ["wt2wt"],
"changes": [
["img[height]", "attr", "height", "22"],
["img[width]", "attr", "width", "200"]
]
}
!! wikitext
[[Image:Foobar.jpg|230x230px]]
!! wikitext/edited
[[Image:Foobar.jpg|200x200px]]
!!end
!! test
Image: Modifying size of an image (2)
!! options
parsoid={
"modes": ["wt2wt"],
"changes": [
["img[height]", "attr", "height", "100"],
["img[width]", "attr", "width", "500"]
]
}
!! wikitext
[[Image:Foobar.jpg|230x230px]]
!! wikitext/edited
[[Image:Foobar.jpg|500x500px]]
!!end
# Change in size is ignored so long as class='mw-default-size'
!! test
Image: Modifying size of an image (3)
!! options
parsoid={
"modes": ["wt2wt"],
"changes": [
["figure[class]", "removeClass", "mw-default-size"],
["figure img", "attr", "height", "19"],
["figure img", "attr", "width", "170"]
]
}
!! wikitext
[[Image:Foobar.jpg|thumb]]
!! wikitext/edited
[[Image:Foobar.jpg|thumb|170x170px]]
!!end
!! test
Image: Modifying alignment of an image (T50665)
!! options
parsoid={
"modes": ["wt2wt"],
"changes": [
["figure[class]", "removeClass", "mw-halign-right"],
["figure[class]", "addClass", "mw-halign-left"]
]
}
!! wikitext
[[Image:Foobar.jpg|thumb|caption|right]]
!! wikitext/edited
[[Image:Foobar.jpg|thumb|caption|left]]
!! end
!! test
Image: Modifying mw-default-size of an frameless image (T64805)
!! options
parsoid={
"modes": ["wt2wt"],
"changes": [
["figure.mw-default-size", "removeClass", "mw-default-size"]
]
}
!! wikitext
[[Image:Foobar.jpg|frameless|right]]
!! wikitext/edited
[[Image:Foobar.jpg|frameless|right|180x180px]]
!! end
!! test
Image: Modifying valign of an image (T51221)
!! options
parsoid={
"modes": ["wt2wt"],
"changes": [
["*[typeof=\"mw:File\"]", "removeClass", "mw-valign-middle"],
["*[typeof=\"mw:File\"]", "addClass", "mw-valign-text-top"]
]
}
!! wikitext
[[File:Foobar.jpg|20px|middle]]
!! wikitext/edited
[[File:Foobar.jpg|20px|text-top]]
!! end
!! test
Image: Modifying alt attribute of an image (T58400)
!! options
disabled
parsoid={
"modes": ["wt2wt"],
"changes": [
["img[alt]", "attr", "alt", "some alternate edited text"]
]
}
!! wikitext
[[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
!! wikitext/edited
[[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
!!end
!! test
Image: Modifying caption of an image
!! options
parsoid={
"modes": ["wt2wt"],
"changes": [
["figcaption", "text", "new caption"]
]
}
!! wikitext
[[Image:Foobar.jpg|thumb|original caption]]
!! wikitext/edited
[[Image:Foobar.jpg|thumb|new caption]]
!!end
!! test
Image: empty alt attribute (T50924)
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|alt=|thumb|bar]]
!! html/php
bar
!! html/parsoid
!! end
!! test
Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
!! options
parsoid=html2wt
language=ar
disabled
!! html/parsoid
!! wikitext
[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
!! end
!! test
Image: Block level image should have \n before and after
!! wikitext
123
[[File:Foobar.jpg|right|thumb|150x150px]]
456
!! html/parsoid
123
456
!! end
!! test
Image: New block level image should have \n before and after (existing content)
!! wikitext
123
[[File:Foobar.jpg|right|thumb|150x150px]]
456
!! html/parsoid
123
456
!! end
!! test
Image: upright option (parsoid)
!! wikitext
[[File:Foobar.jpg|thumb|upright|caption]]
[[File:Foobar.jpg|thumb|upright=0.5|caption]]
[[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
!! html/parsoid
!! end
!! test
Image: upright option is ignored on inline and frame images (parsoid)
!! wikitext
[[File:Foobar.jpg|500x500px|upright=0.5|caption]]
!! html/parsoid
!! end
!! test
Image: in template parameter with empty parameter
!! wikitext
{{1x|[[File:Foobar.jpg|link=]]}}
!! html/parsoid
!! end
!! test
Image: from basic HTML (1)
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
[[File:Foobar.jpg|link=|alt=Alt|100x100px]]
!! end
!! test
Image: from basic HTML (2)
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
[[File:Foobar.jpg|link=|alt=Alt|100x100px]]
!! end
!! test
Image: from basic HTML (3)
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
[[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
!! end
!! test
Image: from basic HTML (4)
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
[[File:Foobar.jpg|link=]]
!! end
!! test
Image: Invalid title as link
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|link=<]]
!! html/php
!! html/parsoid
!! end
!! article
Test"123
!! text
Dummy article to suppress redlinks in tests
!! end
## Roundtripping the gallery here without normalization needs T252246 / T252246
!! test
Percent decode titles in the link option (T216003#7836261)
!! options
parsoid=wt2html,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[Test%22123]]
[[File:Foobar.jpg|link=Test%22123]]
[[File:Foobar.jpg|link=[[Test%22123]]]]
File:Foobar.jpg|link=Test%22123
File:Foobar.jpg|link=[[Test%22123]]
!! html/php
!! end
!! test
Various link types in alt and link options
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|link=[[Main Page]]|alt=[[Main Page]]|caption]]
[[File:Foobar.jpg|link=[[Media:Thumb.png]]|alt=[[Media:Thumb.png]]|caption]]
[[File:Foobar.jpg|link=[[wikipedia:Foo]]|alt=[[wikipedia:Foo]]|caption]]
!! html/php
!! html/parsoid+standalone
!! html/parsoid+integrated
!! end
## Don't necessarily expect this to roundtrip, but run serialization to catch crashers
!! test
File in link scenarios
!! options
parsoid={
"modes": ["wt2html","html2wt"],
"suppressErrors": true
}
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[http://www.google.com [[File:Foobar.jpg|123]]]
[http://www.google.com [[File:Foobar.jpg|thumb|123]]]
!! html/php
123
!! html/parsoid
!! end
!! test
Thumbnail output
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Thumb.png|thumb]]
!! html/php
!! html/parsoid
!! end
## The bogus option here isn't going to roundtrip
!! test
File with caption with pipe in extension tag attribute
!! options
parsoid=wt2html,html2html
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|Test 123]]
!! html/php
Test 123
!! html/parsoid
!! end
!! test
File with table in caption with extra table attribute spaces
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Foobar.jpg|thumb|
{|
|-
|hi
|}
]]
!! html/php
hi
!! html/parsoid
hi
!! end
## Parsoid uses the alt as the link text, legacy parser uses the caption
!! test
Broken inline media with a caption and an alt
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Broken.jpg|alt=An alternative text description.|A caption for the media.]]
!! html/php
!! end
## Parsoid uses the alt as the link text, legacy parser doesn't use either
!! test
Broken block media with a caption and an alt
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Broken.jpg|alt=An alternative text description.|thumb|A caption for the media.]]
!! html/php
!! html/parsoid
!! end
## Caption set as the link text, similar to alt on images
!! test
Broken inline media with a caption
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Broken.jpg|A caption for the media.]]
!! html/php
!! end
## Neither implementation uses the caption as link text since it's already visible in the figcaption/thumbcaption, similar to alt on images
!! test
Broken block media with a caption
!! config
wgParserEnableLegacyMediaDOM=true
!! wikitext
[[File:Broken.jpg|thumb|A caption for the media.]]
!! html/php