!! Version 2 !! 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 ### ### Images ### ### For Parsoid-specific tests, see ### https://www.mediawiki.org/wiki/Specs/HTML#Images !! test Simple image !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:foobar.jpg]] !! html/php

Foobar.jpg

!! html/parsoid

!! 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) !! wikitext [[File:Foobar.jpg]] !! html/php

Foobar.jpg

!! html/parsoid

!! end !! test Right-aligned image !! wikitext [[File:Foobar.jpg|right]] !! html/php
Foobar.jpg
!! html/parsoid
!! end !! test Image with caption !! wikitext [[File:Foobar.jpg|right|Caption text]] !! html/php
Caption text
!! html/parsoid
Caption text
Caption text
!! end !! test Image with caption, T55312 #1 !! wikitext [[File:Foobar.jpg|right|Caption page stuff]] !! html/php
Caption page stuff
!! html/parsoid
Caption page stuff
Caption page stuff
!! end !! test Image with caption, T55312 #2 !! wikitext [[File:Foobar.jpg|right|Caption page=]] !! html/php
Caption page=
!! html/parsoid
Caption page=
Caption page=
!! end !! test Image with caption, T55312 #3 !! wikitext [[File:Foobar.jpg|right|Caption page=stuff]] !! html/php
Caption page=stuff
!! html/parsoid
Caption page=stuff
Caption page=stuff
!! end !! test Image caption with pipe entity !! wikitext [[File:Foobar.jpg|thumb|one | two]] [[File:Foobar.jpg|thumb|one ''two'' | three]] !! html/php
one | two
one two | three
!! html/parsoid
one | two
one two | three
!! end !! test Bad images - basic functionality !! wikitext [[File:Bad.jpg]] !! html/php

File:Bad.jpg

!! html/parsoid

File:Bad.jpg

!! end !! test Bad images - T18039: text after bad image disappears !! wikitext Foo bar [[File:Bad.jpg]] Bar foo !! html/php

Foo bar File:Bad.jpg Bar foo

!! html/parsoid

Foo bar File:Bad.jpg Bar foo

!! end !! test Bad images - in gallery !! wikitext File:Bad.jpg !! html/php !! html/parsoid !! end !! test Allow empty links in image captions (T62753) !! options thumbsize=220 !! wikitext [[File:Foobar.jpg|thumb|Caption [[Link1]] [[]] [[Link2]] ]] !! html/php
Caption Link1 [[]] Link2
!! html/parsoid
Caption Link1 [[]] Link2
!! end !! test Titles in unlinked images (T23454) !! wikitext [[File:Foobar.jpg|link=|stuff]] !! html/php

stuff

!! html/parsoid

stuff

!! end !! test Link with empty target !! wikitext [[]] !! html

[[]]

!! end !! test Image with link trail !! wikitext Linktrails should not work for images: [[File:Foobar.jpg]]s !! html/php

Linktrails should not work for images: Foobar.jpgs

!! html/parsoid

Linktrails should not work for images: s

!! end !! test Image with empty attribute !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|right||Caption text]] !! html/php
Caption text
!! html/parsoid
Caption text
Caption text
!! end !! test 1. Block image with individual attributes from templates !! wikitext [[File:Foobar.jpg|thumb|{{1x|137px}}|This is a caption]] !! html/php
This is a caption
!! html/parsoid
This is a caption
!! end !! test 2. Block Image with individual attributes from templates !! wikitext [[File:Foobar.jpg|{{1x|thumb}}|{{1x|137px}}|This is a caption]] !! html/php
This is a caption
!! html/parsoid
This is a caption
!! end !! test 3. Inline image with individual attributes from templates !! wikitext [[File:Foobar.jpg|{{1x|50px}}]] !! html/php

Foobar.jpg

!! 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 !! wikitext [[File:Foobar.jpg|{{image_attribs}}]] !! html/php
Caption text
!! html/parsoid
Caption text
Caption text
!! end !! test Image with link tails !! options thumbsize=220 !! wikitext 123[[File:Foobar.jpg]]456 123[[File:Foobar.jpg|right]]456 123[[File:Foobar.jpg|thumb]]456 !! html/php

123Foobar.jpg456

123

Foobar.jpg

456 123

Foobar.jpg

456

!! html/parsoid

123456

123

456 123

456

!! end !! test Image with multiple captions -- only last one is accepted !! wikitext [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]] !! html/php
Caption3 - accepted
!! html/parsoid
Caption3 - accepted
Caption3 - accepted
!! end !! test Image with multiple widths -- use last !! wikitext [[File:Foobar.jpg|200px|300px|caption]] !! html/php

caption

!! html/parsoid

caption

!! end !! test Image with multiple alignments -- use first (T50664) !! options thumbsize=220 !! wikitext [[File:Foobar.jpg|thumb|left|right|center|caption]] [[File:Foobar.jpg|middle|text-top|caption]] !! html/php
caption

caption

!! html/parsoid
caption

caption

!! end !! test Image with width attribute at different positions !! wikitext [[File:Foobar.jpg|200px|right|Caption]] [[File:Foobar.jpg|right|200px|Caption]] [[File:Foobar.jpg|right|Caption|200px]] !! html/php
Caption
Caption
Caption
!! html/parsoid
Caption
Caption
Caption
Caption
Caption
Caption
!! end # a sad bit of backward-compatibility !! test Image with size specified with pxpx (T15500, T53628) !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|20pxpx]] [[File:Foobar.jpg|200x20pxpx]] !! html/php

Foobar.jpg Foobar.jpg

!! html/parsoid

!! end !! test Image with link parameter, wiki target !! wikitext [[File:Foobar.jpg|link=Main Page]] !! html/php

Foobar.jpg

!! html/parsoid

!! end # parsoid T51293 (part 1) !! test Image with link parameter, URL target !! wikitext [[File:Foobar.jpg|link=http://example.com/]] !! html/php

Foobar.jpg

!! html/parsoid

!! end # parsoid T51293 (part 2) !! test Image with link parameter, protocol-less URL target !! wikitext [[File:Foobar.jpg|link=//example.com/]] !! html/php

Foobar.jpg

!! 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" !! html/php

Foobar.jpg

!! end !! test Image with link parameter, wgNoFollowLinks set to false !! wikitext [[Image:foobar.jpg|link=http://example.com/]] !! config wgNoFollowLinks=false !! html/php

Foobar.jpg

!! end !! test Image with link parameter, wgNoFollowDomainExceptions !! wikitext [[Image:foobar.jpg|link=http://example.com/]] !! config wgNoFollowDomainExceptions="example.com" !! html/php

Foobar.jpg

!! 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" !! html/php

Title

!! end !! test Image with empty link parameter !! wikitext [[File:Foobar.jpg|link=]] !! html/php

Foobar.jpg

!! html/parsoid

!! end !! test Image with link parameter (wiki target) and unnamed parameter !! wikitext [[File:Foobar.jpg|link=Main_Page|Title]] !! html/php

Title

!! html/parsoid

Title

!! end !! test Image with link parameter (URL target) and unnamed parameter !! wikitext [[File:Foobar.jpg|link=http://example.com/|Title]] !! html/php

Title

!! html/parsoid

Title

!! end !! test Thumbnail image with link parameter !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb|link=http://example.com/|Title]] !! html/php
Title
!! html/parsoid
Title
!! end !! test Manually-specified thumbnail image !! options thumbsize=220 !! wikitext [[File:Foobar.jpg|thumbnail=Thumb.png|Title]] !! html/php
Title
!! html/parsoid
Title
!! end !! test Manually-specified thumbnail image (backwards compat) !! options thumbsize=220 parsoid=html2wt !! wikitext [[File:Foobar.jpg|thumbnail=Thumb.png|Title]] !! html/php
Title
!! html/parsoid
Title
!! end !! test Manually-specified thumbnail image with explicit link to wiki page !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]] !! html/php
Title
!! html/parsoid
Title
!! end !! test Manually-specified thumbnail image with explicit link to url !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]] !! html/php
Title
!! html/parsoid
Title
!! end !! test Manually-specified thumbnail image with explicit no link !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]] !! html/php
Title
!! html/parsoid
Title
!! end !! test Manually-specified thumbnail image with explicit link and alt text !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]] !! html/php
alttext
Title
!! html/parsoid
alttext
Title
!! end !! test Image with frame and link !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]] !! html/php
This is a test image Main Page
!! html/parsoid
This is a test image Main Page
!! end !! test Image with frame and link and explicit alt !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]] !! html/php
Altitude
This is a test image Main Page
!! html/parsoid
Altitude
This is a test image Main Page
!! end !! test Image with wiki markup in implicit alt !! wikitext [[Image:Foobar.jpg|testing '''bold''' in alt]] [[Image:Foobar.jpg|alt=testing '''bold''' in alt]] !! html/php

testing bold in alt

testing bold in alt

!! html/parsoid

testing bold in alt

testing bold in alt

!! end !! test Alt image option should handle most kinds of wikitext without barfing !! wikitext [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{1x|''bold template''}}.]] !! html/php
This is a link and a bold template.
This is the image caption
!! html/parsoid
This is a link and a bold template.
This is the image caption
!! end !! test Ampersand in alt attribute (T206940) !! 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 !! 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

http://testing.123?4=5|6

http://testing.123?4=5|6

!! html/parsoid

http://testing.123?4=5|6

http://testing.123?4=5|6

!! end !! test Italics markup in alt attribute (T206940) !! options parsoid=wt2html,html2html !! wikitext [[File:Foobar.jpg|alt=''x''|caption]] File:Foobar.jpg|alt=''x''|caption !! html/php

x

!! html/parsoid

x

!! end ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0 ## are no longer in storage. !! test Nowiki markup in alt attribute (T206940) !! options parsoid=html2wt !! wikitext [[File:Foobar.jpg|alt=''x''|caption]] File:Foobar.jpg|alt=''x''|caption !! html/php

''x''

!! html/parsoid

''x''

!! end !! test Nowiki markup in alt attribute (edited html, no data-parsoid) (T206940) !! wikitext [[File:Foobar.jpg|alt=''x''|caption]] File:Foobar.jpg|alt=''x''|caption !! html/php

''x''

!! html/parsoid

''x''

!! end ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0 ## are no longer in storage. !! test Ampersand in link attribute (T206940) !! options parsoid=html2wt !! wikitext [[File:Foobar.jpg|link=Foo & bar]] File:Foobar.jpg|link=Foo & bar !! html/php

Foobar.jpg

!! html/parsoid

!! end !! test Ampersand in link attribute (edited html, no data-parsoid) (T206940) !! wikitext [[File:Foobar.jpg|link=Foo_&_bar]] File:Foobar.jpg|link=Foo_&_bar !! html/php

Foobar.jpg

!! html/parsoid

!! end !! test Italics markup in link attribute (T206940) !! options parsoid=wt2html,html2html !! 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

Foo''s bar''s

caption1

caption2

!! html/parsoid

Foo''s bar''s

caption1

caption2

!! end ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0 ## are no longer in storage. !! test Nowiki markup in link attribute (T206940) !! options parsoid=html2wt !! wikitext [[File:Foobar.jpg|link=Foo''s_bar''s|caption]] File:Foobar.jpg|link=Foo''s_bar''s|caption !! html/php

caption

!! html/parsoid

!! end !! test Nowiki markup in link attribute (edited html, no data-parsoid) (T206940) !! 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) !! wikitext [[File:Foobar.jpg|link=https://example.com?foo¶ms=bar]] File:Foobar.jpg|link=https://example.com?foo¶ms=bar !! html/php

Foobar.jpg

!! 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 !! wikitext [[File:Foobar.jpg|thumb| ===Testing=== 123 -------------- ]] !! html/php

Testing[edit]

123
!! html/parsoid

Testing

123
!! 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 !! 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

caption

caption

caption

caption

!! html/parsoid

caption

caption

caption

caption

!! end !! test Image with 'frame' first. !! options parsoid=wt2html,wt2wt,html2html !! 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
caption
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]] [[File:Foobar.jpg|thumb|frame|caption]] [[File:Foobar.jpg|thumb|thumbnail=Thumb.png|caption]] !! html/php
caption
caption
caption
caption
!! html/parsoid
caption
caption
caption
caption
!! end !! test Image with 'thumbnail=' first. !! options parsoid=wt2html,wt2wt,html2html !! 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
caption
caption
caption
caption
!! 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 !! wikitext [[File:Foobar.jpg|2000px]] [[File:Foobar.jpg|border|2000px]] !! html/php

Foobar.jpg

Foobar.jpg

!! html/parsoid

!! end !! test Image: "unspecified format" and border reduce !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|1000px]] [[File:Foobar.jpg|border|1000px]] !! html/php

Foobar.jpg

Foobar.jpg

!! html/parsoid

!! end !! test Image: thumbs reduce !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb|50px]] !! html/php
Foobar.jpg
!! html/parsoid
!! end !! test Image: bitmap thumbs can't be enlarged past original size, but vector can. !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb|2000px]] [[File:Foobar.svg|thumb|2000px]] !! html/php
Foobar.jpg
Foobar.svg
!! html/parsoid
!! end !! test Image: frameless can reduce in size !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frameless|50px]] !! html/php

Foobar.jpg

!! html/parsoid

!! end !! test Image: bitmap frameless can't be enlarged past original size, but vector can !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frameless|2000px]] [[File:Foobar.svg|frameless|2000px]] !! html/php

Foobar.jpg

Foobar.svg

!! html/parsoid

!! end !! test Image: framed images are always unscaled. !! 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
Foobar.jpg
Foobar.jpg
Foobar.jpg
Foobar.jpg
!! html/parsoid
!! end !! test Image: manualthumb images are always unscaled. !! options parsoid=wt2html,html2html !! 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
Foobar.jpg
Foobar.jpg
Foobar.jpg
Foobar.jpg
!! 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 #

Image:test !! wikitext [[:Image:test]] !! html

Image:test

!! end !! test T20784 Link to non-existent image page with caption should use caption as link text !! wikitext [[:Image:test|caption]] !! html

caption

!! end !! test Frameless image caption with a free URL !! wikitext [[File:Foobar.jpg|http://example.com]] !! html/php

http://example.com

!! html/parsoid

http://example.com

!! end !! test Thumbnail image caption with a free URL !! options thumbsize=220 !! wikitext [[File:Foobar.jpg|thumb|http://example.com]] !! html/php
!! html/parsoid
http://example.com
!! end !! test Thumbnail image caption with a free URL and explicit alt !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]] !! html/php
!! html/parsoid
Alteration
http://example.com
!! end !! test SVG thumbnails with no language set !! wikitext [[File:Foobar.svg|thumb|caption]] !! html/php
caption
!! html/parsoid
caption
!! end !! test SVG thumbnails with language de !! wikitext [[File:Foobar.svg|lang=de|thumb|caption]] !! html/php
caption
!! html/parsoid
caption
!! end !! test SVG thumbnails with invalid language code !! wikitext [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]] !! html/php
lang=invalid:language:code
!! html/parsoid
caption
!! end !! test SVG thumbnails in page language !! options title=Rupage language=ru !! wikitext [[Файл:Foobar.svg]] [[Файл:Foobar.svg|lang=en]] !! html/php

Foobar.svg Foobar.svg

!! html/parsoid

!! end !! test SVG thumbnails in page language not present in the file !! options title=Depage language=de !! wikitext [[Datei:Foobar.svg]] [[Datei:Foobar.svg|sprache=ru]] !! html/php

Foobar.svg Foobar.svg

!! html/parsoid

!! end !! test T3887: A ISBN with a thumbnail !! wikitext [[File:Foobar.jpg|thumb|ISBN 1235467890]] !! html/php
!! html/parsoid
ISBN 1235467890
!! end !! test T3887: A RFC with a thumbnail !! wikitext [[File:Foobar.jpg|thumb|This is RFC 12354]] !! html/php
This is RFC 12354
!! html/parsoid
This is RFC 12354
!! end !! test T3887: A mailto link with a thumbnail !! wikitext [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]] !! html/php
!! html/parsoid
Please mailto:nobody@example.com
!! end # Pending resolution to T2368 !! test T2648: Frameless image caption with a link !! wikitext [[File:Foobar.jpg|text with a [[link]] in it]] !! html/php

text with a link in it

!! html/parsoid

text with a link in it

!! end !! test T2648: Frameless image caption with a link (suffix) !! wikitext [[File:Foobar.jpg|text with a [[link]]foo in it]] !! html/php

text with a linkfoo in it

!! html/parsoid

text with a linkfoo in it

!! end !! test T2648: Frameless image caption with an interwiki link !! wikitext [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]] !! html/php

text with a MeatBall:Link in it

!! html/parsoid

text with a MeatBall:Link in it

!! end !! test T2648: Frameless image caption with a piped interwiki link !! wikitext [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]] !! html/php

text with a link in it

!! html/parsoid

text with a link in it

!! end !! test T107474: Frameless image caption with !! wikitext [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]] !! html/parsoid

text with a [[MeatBall:Link|link]] in it

!! end !! test Escape HTML special chars in image alt text !! wikitext [[File:Foobar.jpg|& < > "]] !! html/php

& < > "

!! html/parsoid

& < > "

!! end !! test Escape HTML special chars in image alt text with LanguageConverter !! options language=zh !! wikitext [[File:Foobar.jpg|& < > "]] !! html/php

& < > "

!! html/parsoid

& < > "

!! end !! test Entities in file name and attributes !! wikitext [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]] !! html/php

7% solution

!! html/parsoid

File:7% solution.gif

!! end !! test T2499: Alt text should have Ӓ, not &1234; !! wikitext [[File:Foobar.jpg|♀]] !! html/php

♀

!! html/parsoid

♀

!! end !! test Broken image caption with link !! options parsoid=wt2html,wt2wt,html2html !! 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 !! 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 image inside it!
!! html/parsoid
This is a caption with another image inside it!
!! end !! test Image: caption containing a newline !! wikitext [[File:Foobar.jpg|This *is some text]] !! html/php

This *is some text

!! html/parsoid

This
*is some text

!!end !!test Image: caption containing leading space (The leading space should not trigger nowiki escaping in wt2wt mode) !! wikitext [[File:Foobar.jpg|thumb| bar]] !! html/php
bar
!! html/parsoid
bar
!!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 !! 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
FooBar
Foo1 Bar1
and some more text.
!! end !! test T5090: External links other than http: in image captions !! wikitext [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]] !! html/php
This caption has irc and Secure ext links in it.
!! html/parsoid
This caption has irc and Secure ext links in it.
!! end !! test Custom class !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:foobar.jpg|a|class=b]] !! html/php

a

!! html/parsoid

a

!! end !! test Localized image handling (1). !! options parsoid=wt2html,wt2wt,html2html language=es !! wikitext [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]] !! html/php
caption
!! html/parsoid
caption
caption
!! end !! test Localized image handling (2). !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html language=es !! wikitext [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]] !! html/php
caption
!! html/parsoid
caption
!! 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 !! wikitext [[File:Foobar.jpg|frameless|border|class=extra|caption]] !! html/php

caption

!! html/parsoid

caption

!! 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 !! 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
caption
caption
caption
!! 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 !! wikitext [[Image:Barfoo.jpg]] !! html/php

File:Barfoo.jpg

!! end ## FIXME: Parsoid needs to learn about this flag. !! test Missing image with uploads disabled !! options wgEnableUploads=0 !! wikitext [[File:Foobaz.jpg]] !! html/php

File:Foobaz.jpg

!! html/parsoid

File:Foobaz.jpg

!! 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

caption

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

caption

!! 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
caption content
!! 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
caption content
!! 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
caption
!! 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
caption
!! 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
caption
!! 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
caption
!! end !! test Parsoid-specific image handling - frameless image with specific size, border, and caption !! wikitext [[File:Foobar.jpg|frameless|442x50px|border|caption]] !! html/parsoid

caption

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

abc

!! 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
This caption has a transclusion in it.
!! 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

This caption has a
unbalanced tag in it.

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 caption bar

!! end !! test File containing double quotes and spaces !! wikitext [[File:Cool "Gator".png]] !! html/php

File:Cool "Gator".png

!! html/parsoid

File:Cool "Gator".png

!! end !! test File containing single quotes !! wikitext [[File:Foo's ''italic'' bar.jpg]] [[File:Foo's ''italic'' bar.jpg|Foo's ''italic'' bar]] !! html/php

File:Foo's italic bar.jpg Foo's italic bar

!! end !! test Broken image links with HTML captions (T41700) !! wikitext [[File:Nonexistent|]] [[File:Nonexistent|100x100px|]] [[File:Nonexistent|<]] [[File:Nonexistent|abc]] !! html/php

<script></script> <script></script> < abc

!! html/parsoid

File:Nonexistent File:Nonexistent File:Nonexistent File:Nonexistent

!! end !! test Media in wikilink !! wikitext [[Test|[[File:Foobar.jpg]]]] !! html/php

[[Test|Foobar.jpg]]

!! html/parsoid

[[Test|]]

!! end !! test Template with thumb image (with link in description) !! wikitext {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} !! html/php

This is a test template with parameter

!! html/parsoid

This is a test template with parameter

File:Noimage.png
link caption
!! end !! test T3219 URL next to image (good) !! wikitext http://example.com [[File:Foobar.jpg]] !! html/php

http://example.com Foobar.jpg

!! html/parsoid

http://example.com

!!end !! test T3219 URL next to image (broken) !! wikitext http://example.com[[File:Foobar.jpg]] !! html/php

http://example.comFoobar.jpg

!! html/parsoid

http://example.com

!!end !! test Image link to nonexistent file (T3850 - good) !! wikitext [[File:No_such.jpg]] !! html/php

File:No such.jpg

!! html/parsoid

File:No such.jpg

!! end !! test :Image link to nonexistent file (T3850 - bad) !! wikitext [[:Image:No such.jpg]] !! html/php

Image:No such.jpg

!! html/parsoid

Image:No such.jpg

!! end !! test Fuzz testing: image with bogus manual thumbnail !! wikitext [[Image:foobar.jpg|thumbnail= ]] !! html/php
Error creating thumbnail:
!! html/parsoid
File:Foobar.jpg
!! end !! test Gallery with valid attributes !! wikitext File:File:Foobar.jpg !! html/php !! html/parsoid !! end ## Parsoid thinks the "centre" here is a property, not a caption. !! test Gallery !! options parsoid={ "modes": ["wt2html"] } !! wikitext image1.png | image2.gif||||| image3| image4 |300px| centre image5.svg| http:///////// [[x|xx]]]] * image6 !! html/php !! html/parsoid !! end !! test Gallery (with options, html) !! options parsoid={ "modes": ["wt2html", "html2html"] } !! wikitext File:Nonexistent.jpg|caption File:Nonexistent.jpg image:foobar.jpg|some '''caption''' [[Main Page]] image:foobar.jpg image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla. !! html/php !! html/parsoid !! end ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0 ## are no longer in storage. !! test Gallery (with options, extsrc) !! options parsoid=html2wt !! wikitext File:Nonexistent.jpg|caption File:Nonexistent.jpg image:foobar.jpg|some '''caption''' [[Main Page]] image:foobar.jpg image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla. !! html/php !! html/parsoid !! end !! test Gallery (without px units) !! wikitext File:Foobar.jpg !! html/php !! html/parsoid !! end !! test Gallery (with invalid units) !! wikitext File:Foobar.jpg !! html/php !! html/parsoid !! end !! test Gallery with link that has fragment !! options parsoid={ "modes": ["wt2html", "html2html"] } !! wikitext image:foobar.jpg|link=Main_Page image:foobar.jpg|link=Main_Page#section image:foobar.jpg|link=Main Page#section|caption !! html/php !! html/parsoid !! end !! test Gallery with template inside caption !! wikitext File:Foobar.jpg|{{1x|ho}} !! html/php !! html/parsoid !! end !! test Gallery with wikitext inside gallery caption !! options parsoid={ "modes": ["wt2html", "html2html"] } !! wikitext File:Foobar.jpg|Image caption !! html/php !! html/parsoid !! end !! test Gallery with wikitext inside caption !! wikitext File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]] File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}} !! html/php !! html/parsoid !! end !! test Gallery with wikitext incl bogus HTML tag (T237318) !! options parsoid=wt2html,html2html !! wikitext File:Foobar.jpg| !! html/php !! html/parsoid !! end !! test Gallery (with showfilename option) !! wikitext File:Nonexistent.jpg|caption File:Nonexistent.jpg File:Foobar.jpg|some '''caption''' [[Main Page]] File:Foobar.jpg !! html/php !! html/parsoid !! end ## Should Parsoid be preserving these variations? See T151367 !! test Gallery (with namespace-less filenames) !! options parsoid={ "modes": ["wt2html", "html2html"] } !! wikitext File:Nonexistent.jpg Nonexistent.jpg image:foobar.jpg foobar.jpg !! html/php !! html/parsoid !! end !! test Gallery override link with wikilink (T36852) !! wikitext File:Foobar.jpg|alt=galleryalt|link=Wikilink !! html/php !! html/parsoid !! end !! test Gallery override link with absolute external link (T36852) !! 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 !! wikitext File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org !! html/php !! html/parsoid !! end !! test Gallery override link with malicious javascript (T36852) !! options parsoid={ "modes": ["wt2html", "html2html"] } !! 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"] } !! 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 !! wikitext File:Foobar.jpg !! html/php !! html/parsoid !! end !! test Gallery in nolines mode !! wikitext File:Foobar.jpg|foo !! html/php !! html/parsoid !! end !! test Gallery in slideshow mode !! wikitext File:Foobar.jpg !! html/php !! html/parsoid !! end !! test Gallery in packed mode !! wikitext File:Foobar.jpg !! html/php !! html/parsoid !! end !! test Gallery in packed-overlay mode !! wikitext File:Foobar.jpg|foo !! html/php !! html/parsoid !! end !! test Gallery in packed-hover mode !! wikitext File:Foobar.jpg|foo !! html/php !! html/parsoid !! end !! test Serialize gallery image captions on a line !! options parsoid={ "modes": ["html2wt"] } !! html/parsoid !! wikitext File:Foobar.jpg| hi ho File:Foobar.jpg|hi
ho
!! end !! test Centre-aligned image !! wikitext [[Image:foobar.jpg|centre]] !! html/php
Foobar.jpg
!! html/parsoid
!! end !! test None-aligned image !! wikitext [[Image:foobar.jpg|none]] !! html/php
Foobar.jpg
!! html/parsoid
!! end !! test Width + Height sized image (using px) (height is ignored) !! wikitext [[Image:foobar.jpg|640x480px]] !! html/php

Foobar.jpg

!! html/parsoid

!! end !! test Width-sized image (using px, no following whitespace) !! wikitext [[Image:foobar.jpg|640px]] !! html/php

Foobar.jpg

!! html/parsoid

!! end !! test Width-sized image (using px, with following whitespace - test regression from r39467) !! wikitext [[Image:foobar.jpg|640px ]] !! html/php

Foobar.jpg

!! html/parsoid

!! end !! test Width-sized image (using px, with preceding whitespace - test regression from r39467) !! wikitext [[Image:foobar.jpg| 640px]] !! html/php

Foobar.jpg

!! html/parsoid

!! end !! test Image with page parameter !! options djvu !! wikitext [[File:LoremIpsum.djvu]] [[File:LoremIpsum.djvu|page=2]] !! html/php

LoremIpsum.djvu

LoremIpsum.djvu

!! html/parsoid

!! end !! test Image with page parameter generated by a template !! options djvu !! wikitext [[File:LoremIpsum.djvu|page={{1x|2}}]] !! html/php

LoremIpsum.djvu

!! 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 !! wikitext [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|¶m2=|x external] URL]] !! html/php
An external URL
!! html/parsoid
An external URL
!! end !! test T146305: Don't break image parsing if language converter markup is in the caption. !! options language=sr !! 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 !! 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 !! 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 !! html/parsoid !! end !! test Free external link invading image caption !! wikitext [[File:Foobar.jpg|thumb|http://x|hello]] !! html/php
hello
!! html/parsoid
hello
!! end !! test Special characters in embedded file links (T29679) !! wikitext [[File:Contains & ampersand.jpg]] [[File:Does not exist.jpg|Title with & ampersand]] !! html/php

File:Contains & ampersand.jpg Title with & ampersand

!! html/parsoid

File:Contains & ampersand.jpg File:Does not exist.jpg

!! 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 !! wikitext {| | [[Image:Foobar.jpg|right|Test]] |} !! html/php

Test

!! html/parsoid

Test
Test

!! end !! test 2. Treebuilder fixup of formatting elt !! options parsoid=wt2html,wt2wt !! wikitext '''foo[[File:Foobar.jpg|thumb|caption]]bar''' [[Image:Foobar.jpg|right|300px]] !! html/php

foo

caption

bar

Foobar.jpg
!! html/parsoid

foo

caption

bar

!! end !! test 3. Treebuilder fixup of formatting elt !! options parsoid=wt2html,wt2wt !! wikitext '''foo[[File:Foobar.jpg|thumb|caption]]bar''' !! html/php

foo

caption

bar

!! html/parsoid

foo

caption

bar

!! end !! test 4. Treebuilder fixup of formatting elt: formatting tags around captionless images !! options parsoid=wt2html,wt2wt !! wikitext '''[[Image:Foobar.jpg|right|300px]]''' !! html/php
Foobar.jpg
!! 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) !! wikitext [[File:Foobar.jpg|alt=|thumb|bar]] !! html/php
bar
!! html/parsoid
bar
!! 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
caption
caption
caption
!! end !! test Image: upright option is ignored on inline and frame images (parsoid) !! wikitext [[File:Foobar.jpg|500x500px|upright=0.5|caption]] !! html/parsoid

caption

!! 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 Alt !! wikitext [[File:Foobar.jpg|link=|alt=Alt|100x100px]] !! end !! test Image: from basic HTML (2) !! options parsoid=html2wt !! html/parsoid Alt !! wikitext [[File:Foobar.jpg|link=|alt=Alt|100x100px]] !! end !! test Image: from basic HTML (3) !! options parsoid=html2wt !! html/parsoid Alt !! 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 !! wikitext [[File:Foobar.jpg|link=<]] !! html/php

link=<

!! html/parsoid

!! end ## Roundtripping the gallery here without normalization needs T252246 / T252246 !! test Percent decode titles in the link option (T216003#7836261) !! options parsoid=wt2html,html2html !! 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

Test"123 Foobar.jpg Foobar.jpg

!! html/parsoid

Test"123

!! end !! test Various link types in alt and link options !! 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

Main Page

Media:Thumb.png

wikipedia:Foo

!! html/parsoid

Main Page

Media:Thumb.png

wikipedia:Foo

!! end !! test Magic links inside image captions (autolinked) !! wikitext [[File:Foobar.jpg|thumb|http://example.com]] [[File:Foobar.jpg|thumb|RFC 1234]] [[File:Foobar.jpg|thumb|PMID 1234]] [[File:Foobar.jpg|thumb|ISBN 123456789x]] !! html/php !! html/parsoid
http://example.com
RFC 1234
PMID 1234
ISBN 123456789x
!! end !! test Interwiki links inside image captions !! options language=de !! wikitext [[File:Foobar.jpg|thumb|right|[[:Wikipedia:Foo]] bar]] !! html/php !! html/parsoid
Wikipedia:Foo bar
!! 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 } !! wikitext [http://www.google.com [[File:Foobar.jpg|123]]] [http://www.google.com [[File:Foobar.jpg|thumb|123]]] !! html/php

123

123
!! html/parsoid

123

123
!! end !! test Thumbnail output !! wikitext [[File:Thumb.png|thumb]] !! html/php
Thumb.png
!! 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 !! wikitext [[File:Foobar.jpg|thumb|Test 123]] !! html/php
Test 123
!! html/parsoid
Test 123
!! end !! test File with table in caption with extra table attribute spaces !! wikitext [[File:Foobar.jpg|thumb| {| |- |hi |} ]] !! html/php
hi
!! html/parsoid
hi
!! end