!! 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=false !! wikitext [[Image:foobar.jpg]] !! html/php

!! html/parsoid

!! end !! test Simple image redirect !! options parsoid=wt2html,wt2wt,html2html !! config wgParserEnableLegacyMediaDOM=false !! 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 Serialize simple image with mw:Image typeof !! options parsoid=html2wt !! html/parsoid

!! wikitext [[File:Foobar.jpg]] !! end !! test Simple image (using File: namespace, now canonical) !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg]] !! html/php

!! html/parsoid

!! end !! test Right-aligned image !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|right]] !! html/php
!! html/parsoid
!! end !! test Image with caption !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|right|Caption text]] !! html/php
Caption text
Caption text
!! html/parsoid
Caption text
Caption text
!! end !! test Image with caption, T55312 #1 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|right|Caption page stuff]] !! html/php
Caption page stuff
Caption page stuff
!! html/parsoid
Caption page stuff
Caption page stuff
!! end !! test Image with caption, T55312 #2 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|right|Caption page=]] !! html/php
Caption page=
Caption page=
!! html/parsoid
Caption page=
Caption page=
!! end !! test Image with caption, T55312 #3 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|right|Caption page=stuff]] !! html/php
Caption page=stuff
Caption page=stuff
!! html/parsoid
Caption page=stuff
Caption page=stuff
!! end !! test Image caption with pipe entity !! config wgParserEnableLegacyMediaDOM=false !! 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 ## FIXME: Legacy output doesn't match Parsoid !! test Bad images - basic functionality !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Bad.jpg]] !! html/php

File:Bad.jpg

!! html/parsoid

File:Bad.jpg

!! end ## FIXME: Legacy output doesn't match Parsoid !! test Bad images - T18039: text after bad image disappears !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext File:Bad.jpg !! html/php !! html/parsoid !! 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=false !! 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) !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|link=|stuff]] !! html/php

stuff

!! html/parsoid

stuff

!! end !! test Unlinked media in gallery !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! 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=false !! wikitext [[File:Foobar.jpg|right||Caption text]] !! html/php
Caption text
Caption text
!! html/parsoid
Caption text
Caption text
!! end !! test 1. Block image with individual attributes from templates !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! wikitext [[File:Foobar.jpg|{{image_attribs}}]] !! html/php
Caption text
Caption text
!! html/parsoid
Caption text
Caption text
!! end !! test Image with link tails !! options thumbsize=220 !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! wikitext [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]] !! html/php
Caption3 - accepted
Caption3 - accepted
!! html/parsoid
Caption3 - accepted
Caption3 - accepted
!! end !! test Image with multiple widths -- use last !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|200px|right|Caption]] [[File:Foobar.jpg|right|200px|Caption]] [[File:Foobar.jpg|right|Caption|200px]] !! html/php
Caption
Caption
Caption
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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|20pxpx]] [[File:Foobar.jpg|200x20pxpx]] !! html/php

!! html/parsoid

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

!! html/parsoid

!! end !! test File with link to page section !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[Main Page#section]] [[File:Foobar.jpg|link=Main Page#section]] !! html/php

Main Page#section

!! html/parsoid

Main Page#section

!! end # parsoid T51293 (part 1) !! test Image with link parameter, URL target !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! 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=false !! html/php

!! end # wgExternalLinkTarget not supported by Parsoid !! test Thumb with link parameter, wgExternalLinkTarget !! wikitext [[Image:foobar.jpg|thumb|link=http://example.com/]] !! config wgExternalLinkTarget="foobar" wgParserEnableLegacyMediaDOM=false !! html/php
!! end !! test Image with link parameter, wgNoFollowLinks set to false !! wikitext [[Image:foobar.jpg|link=http://example.com/]] !! config wgNoFollowLinks=false wgParserEnableLegacyMediaDOM=false !! html/php

!! end !! test Image with link parameter, wgNoFollowDomainExceptions !! wikitext [[Image:foobar.jpg|link=http://example.com/]] !! config wgNoFollowDomainExceptions="example.com" wgParserEnableLegacyMediaDOM=false !! 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=false !! html/php

Title

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

!! html/parsoid

!! end !! test Image with link parameter (wiki target) and unnamed parameter !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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) !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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) !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|alt=''x''|caption]] File:Foobar.jpg|alt=''x''|caption !! html/php

''x''

!! html/parsoid

''x''

!! end !! test Ampersand in link attribute (edited html, no data-parsoid) (T206940) !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! 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 !! test Nowiki markup in link attribute (edited html, no data-parsoid) (T206940) !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! 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=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 & manualthumb 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=false !! 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=false !! 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=false !! 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=false !! 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=false !! 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=false !! wikitext [[File:Foobar.jpg|frameless|2000px]] [[File:Foobar.svg|frameless|2000px]] !! html/php

!! html/parsoid

!! end !! test Image: framed images are always unscaled. !! options parsoid=wt2html,html2html !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! 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 #

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

Image:test

!! html/parsoid

Image:test

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

caption

!! html/parsoid

caption

!! end !! test Frameless image caption with a free URL !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb|http://example.com]] !! html/php
http://example.com
!! html/parsoid
http://example.com
!! end !! test Thumbnail image caption with a free URL and explicit alt !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]] !! html/php
Alteration
http://example.com
!! html/parsoid
Alteration
http://example.com
!! end !! test SVG thumbnails with no language set !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.svg|thumb|caption]] !! html/php
caption
!! html/parsoid
caption
!! end !! test SVG thumbnails with language de !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.svg|lang=de|thumb|caption]] !! html/php
caption
!! html/parsoid
caption
!! end !! test SVG thumbnails with invalid language code !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! wikitext [[Datei:Foobar.svg]] [[Datei:Foobar.svg|sprache=ru]] !! html/php

!! html/parsoid

!! end !! test T3887: A ISBN with a thumbnail !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb|ISBN 1235467890]] !! html/php
ISBN 1235467890
!! html/parsoid
ISBN 1235467890
!! end !! test T3887: A RFC with a thumbnail !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]] !! html/php
Please mailto:nobody@example.com
!! html/parsoid
Please mailto:nobody@example.com
!! end # Pending resolution to T2368 !! test T2648: Frameless image caption with a link !! config wgParserEnableLegacyMediaDOM=false !! 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) !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! wikitext [[File:Foobar.jpg|& < > "]] !! html/php

& < > "

!! html/parsoid

& < > "

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

7% solution

!! html/parsoid

7% solution

!! end !! test T2499: Alt text should have Ӓ, not &1234; !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|This *is some text]] !! html/php

This *is some text

!! html/parsoid

This
*is some text

!!end ## The leading space should not trigger nowiki escaping in wt2wt mode !! test Image: caption containing leading space !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]] !! html/php
caption
caption
!! html/parsoid
caption
caption
!! end !! test Localized image handling (2). !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html language=es !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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: To run this in standalone mode, we'd need to teach the # mockAPI about the redirected Barfoo.jpg image !! test Redirected image !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext foo [[File:Foobar.svg|lang=de|caption]] bar !! html/php

foo caption bar

!! html/parsoid

foo caption bar

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

File:Cool "Gator".png

!! html/parsoid

File:Cool "Gator".png

!! end !! test File containing single quotes !! config wgParserEnableLegacyMediaDOM=false !! 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) !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Nonexistent|]] [[File:Nonexistent|100x100px|]] [[File:Nonexistent|<]] [[File:Nonexistent|abc]] !! html/php

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

!! html/parsoid

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

!! end !! test Media in wikilink !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! wikitext {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} !! html/php

This is a test template with parameter

File:Noimage.png
link caption
!! html/parsoid

This is a test template with parameter

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

http://example.com

!! html/parsoid

http://example.com

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

http://example.com

!! html/parsoid

http://example.com

!! end !! test Image link to nonexistent file (T3850 - good) !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[Image:foobar.jpg|thumbnail= ]] !! html/php
File:Foobar.jpg
!! html/parsoid
File:Foobar.jpg
!! end !! test Gallery with valid attributes !! config wgParserEnableLegacyMediaDOM=false !! 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"] } !! config wgParserEnableLegacyMediaDOM=false !! wikitext image1.png | image2.gif||||| image3| image4 |300px| centre image5.svg| http:///////// [[x|xx]]]] * image6 !! html/php !! html/parsoid !! end !! test Gallery with line not in the file namespace !! config wgParserEnableLegacyMediaDOM=false !! wikitext :'''''Albert Willimsky''' ''Geboren am 28.2.1890'' !! html/php !! end !! test Gallery (with options, html) !! config wgParserEnableLegacyMediaDOM=false !! wikitext File:Nonexistent.jpg|caption File:Nonexistent.jpg image:foobar.jpg|some '''caption''' [[Main Page]] image:foobar.jpg image:foobar.jpg|alt=This is a foo-bar.|blabla. !! html/php !! html/parsoid !! end !! test Gallery (without px units) !! config wgParserEnableLegacyMediaDOM=false !! wikitext File:Foobar.jpg !! html/php !! html/parsoid !! end !! test Gallery (with invalid units) !! config wgParserEnableLegacyMediaDOM=false !! wikitext File:Foobar.jpg !! html/php !! html/parsoid !! end !! test Gallery with link that has fragment !! options parsoid={ "modes": ["wt2html", "html2html"] } !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext File:Foobar.jpg|{{1x|ho}} !! html/php !! html/parsoid !! 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=false !! wikitext File:Foobar.jpg|Image caption !! html/php !! html/parsoid+standalone !! html/parsoid+integrated !! end !! test Gallery with wikitext inside caption !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext File:Foobar.jpg| !! html/php !! html/parsoid !! end !! test Gallery (with showfilename option) !! config wgParserEnableLegacyMediaDOM=false !! 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 !! html/parsoid+integrated !! end ## Should Parsoid be preserving these variations? See T151367 !! test Gallery (with namespace-less filenames) !! options parsoid={ "modes": ["wt2html", "html2html"] } !! config wgParserEnableLegacyMediaDOM=false !! wikitext File:Nonexistent.jpg Nonexistent.jpg image:foobar.jpg foobar.jpg !! html/php !! html/parsoid !! end !! test Gallery override link with wikilink (T36852) !! config wgParserEnableLegacyMediaDOM=false !! wikitext File:Foobar.jpg|alt=galleryalt|link=Wikilink !! html/php !! html/parsoid !! end !! test Gallery override link with absolute external link (T36852) !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! 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"] } !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! 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=false !! wikitext File:Foobar.jpg !! html/php !! html/parsoid !! end !! test Gallery in nolines mode !! config wgParserEnableLegacyMediaDOM=false !! wikitext File:Foobar.jpg|foo !! html/php !! html/parsoid !! end !! test Gallery in slideshow mode !! config wgParserEnableLegacyMediaDOM=false !! wikitext File:Foobar.jpg !! html/php !! html/parsoid !! end !! test Gallery in packed mode !! config wgParserEnableLegacyMediaDOM=false !! wikitext File:Foobar.jpg !! html/php !! html/parsoid !! end !! test Gallery in packed-overlay mode !! config wgParserEnableLegacyMediaDOM=false !! wikitext File:Foobar.jpg|foo !! html/php !! html/parsoid !! end !! test Gallery in packed-hover mode !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[Image:foobar.jpg|centre]] !! html/php
!! html/parsoid
!! end !! test None-aligned image !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[Image:foobar.jpg|none]] !! html/php
!! html/parsoid
!! end !! test Width + Height sized image (using px) (height is ignored) !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[Image:foobar.jpg|640x480px]] !! html/php

!! html/parsoid

!! end !! test Width-sized image (using px, no following whitespace) !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! 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=false !! wikitext [[Image:foobar.jpg| 640px]] !! html/php

!! html/parsoid

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

!! html/parsoid

!! end !! test Image with page parameter and link !! options djvu !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:LoremIpsum.djvu|link=https://google.com|page=2]] [[File:LoremIpsum.djvu|link=https://google.com?page=4|page=2]] !! html/php

!! html/parsoid

!! end !! test Image with page parameter and manualthumb !! options djvu !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:LoremIpsum.djvu|thumbnail=Thumb.png|page=2]] !! html/php
!! html/parsoid
!! end !! test Image with page parameter generated by a template !! options djvu !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! 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=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb|http://x|hello]] !! html/php
hello
!! html/parsoid
hello
!! end !! test Special characters in embedded file links (T29679) !! config wgParserEnableLegacyMediaDOM=false !! 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 Title with & ampersand

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

Test
Test

!! html/parsoid

Test
Test

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

foo

caption

bar

!! html/parsoid

foo

caption

bar

!! end !! test 3. Treebuilder fixup of formatting elt !! options parsoid=wt2html,wt2wt !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|link=<]] [[File:Foobar.jpg|link=<|thumb]] !! html/php

link=<

link=<
!! html/parsoid

!! end !! test Image with page parameter and invalid link !! options djvu !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:LoremIpsum.djvu|link=<|page=2]] !! html/php

link=<

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

!! html/parsoid

Test"123

!! end !! test Should not double decode the link option !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[Test%2522]] [[File:Foobar.jpg|link=Test%2522]] [[File:Foobar.jpg|link=[[Test%2522]]]] !! html/php

[[Test%2522]] link=Test%2522 link=[[Test%2522]]

!! html/parsoid

[[Test%2522]]

!! end !! test Various link types in alt and link options !! config wgParserEnableLegacyMediaDOM=false !! 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) !! config wgParserEnableLegacyMediaDOM=false !! 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
http://example.com
RFC 1234
PMID 1234
ISBN 123456789x
!! html/parsoid
http://example.com
RFC 1234
PMID 1234
ISBN 123456789x
!! end ## FIXME: Parsoid isn't recognizing an Interwiki here in standalone mode !! test Interwiki links inside image captions !! options language=de !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb|right|[[:Wikipedia:Foo]] bar]] !! html/php
Wikipedia:Foo bar
!! html/parsoid+standalone
Wikipedia:Foo bar
!! html/parsoid+integrated
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 } !! config wgParserEnableLegacyMediaDOM=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! 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=false !! 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 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb| {| |- |hi |} ]] !! html/php
hi
!! html/parsoid
hi
!! end ## Expect the media structure to account for cases like this since it's common enough !! test File in formatting element violating content model !! options parsoid=wt2html,html2html !! config wgParserEnableLegacyMediaDOM=false !! wikitext

''[[File:Foobar.jpg|thumb]]''

!! html/php

!! html/parsoid

!! end ## Expect the media structure to account for cases like this since it's common enough !! test File in formatting element violating content model, multiple open !! options parsoid=wt2html,html2html !! config wgParserEnableLegacyMediaDOM=false !! wikitext

'''''[[File:Foobar.jpg|thumb]]'''''

!! html/php

!! html/parsoid

!! end ## Expect the media structure to account for cases like this since it's common enough !! test File in formatting element violating content model, figcaption content !! options parsoid=wt2html,html2html !! config wgParserEnableLegacyMediaDOM=false !! wikitext

''test [[File:Foobar.jpg|thumb|123]] 456''

!! html/php

test

123

456

!! html/parsoid

test

123

456

!! end !! test Table in figcaption nested in table !! config wgParserEnableLegacyMediaDOM=false !! wikitext {| |foo |[[File:Foobar.jpg|thumb| {| |bar |} ]] |} !! html/php
foo
bar
!! html/parsoid
foo
bar
!! end !! test Files with case sensitive media options !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb|left]] [[File:Foobar.jpg|thumb|Left]] !! html/php
Left
!! html/parsoid
Left
!! end !! test Exercise selser on native galleries !! options parsoid= { "modes": ["selser"], "changes": [ ["div.gallerytext", "contents", "text", "456"] ] } !! wikitext File:Foobar.jpg|alt=123|123 !! wikitext/edited File:Foobar.jpg|alt=123|456 !! end !! test Format option in gallery - T214601 !! options parsoid=wt2html !! wikitext File:Foobar.jpg|thumb|123 File:Doesnotexist.jpg|thumb|456 - has an error noted in the rdfa !! html/parsoid !! end ## Alt takes precedence as the link text !! test Broken inline media with a caption and an alt !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Broken.jpg|alt=An alternative text description.|A caption for the media.]] !! html/php

An alternative text description.

!! html/parsoid

An alternative text description.

!! end ## Alt takes precedence as the link text !! test Broken block media with a caption and an alt !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Broken.jpg|alt=An alternative text description.|thumb|A caption for the media.]] !! html/php
An alternative text description.
A caption for the media.
!! html/parsoid
An alternative text description.
A caption for the media.
!! end ## Caption set as the link text, similar to alt on images !! test Broken inline media with a caption !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Broken.jpg|A caption for the media.]] !! html/php

A caption for the media.

!! html/parsoid

A caption for the media.

!! end ## Caption isn't used as link text since it's already visible in the figcaption, similar to alt on images !! test Broken block media with a caption !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Broken.jpg|thumb|A caption for the media.]] !! html/php
File:Broken.jpg
A caption for the media.
!! html/parsoid
File:Broken.jpg
A caption for the media.
!! end ## In contrast with imagemaps !! test Gallery line without file namespace !! config wgParserEnableLegacyMediaDOM=false !! wikitext Foobar.jpg !! html/php !! html/parsoid !! end