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

!! html/parsoid

!! end !! test Simple image redirect !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:Redirect to foobar.jpg]] !! html/php

!! html/parsoid+integrated

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

!! html/parsoid

!! end !! test Right-aligned image !! wikitext [[File:Foobar.jpg|right]] !! html/php
!! html/parsoid
!! end !! test Image with caption !! 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 !! 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 !! 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 !! 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 !! 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 - manualthumb !! wikitext [[File:Foobar.jpg|thumbnail=Bad.jpg|Uh oh]] !! html/php
File:Foobar.jpg
Uh oh
!! html/parsoid
File:Foobar.jpg
Uh oh
!! end !! test Bad images - in gallery !! 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 !! 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 Unlinked media in gallery !! wikitext File:Foobar.jpg|link=|stuff !! html/php !! html/parsoid !! 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: s

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

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

123456

123

456 123

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
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
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 cat !! wikitext [[File:Foobar.jpg|20pxpx]] [[File:Foobar.jpg|200x20pxpx]] !! metadata cat=Pages_with_image_sizes_containing_extra_px sort= !! html/php

!! html/parsoid

!! end !! test T374311: Gallery with trailing px should not trigger double-px !! options parsoid=wt2html cat !! wikitext File:Foobar.jpg !! metadata !! html/php !! html/parsoid !! end !! test Image with link parameter, wiki target !! wikitext [[File:Foobar.jpg|link=Main Page]] !! html/php

!! html/parsoid

!! end !! test File with link to page section !! 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 !! 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 !! 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 !! test Image with link parameter, wgExternalLinkTarget !! wikitext [[File:Foobar.jpg|link=http://example.com/]] !! config wgExternalLinkTarget="foobar" !! html/php

!! html/parsoid

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

!! html/parsoid

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

!! html/parsoid

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

Title

!! html/parsoid

Title

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

!! 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 ## FIXME(T404241): There should probably be some sort of indication that this ## has an expanded attribute in Parsoid's output. ## Also, note the inconsistency in the gallery line caption parsing vs the ## wikilink in the legacy output. Parsoid's output is preferable !! test Link media option with template with arguments !! wikitext [[File:Foobar.jpg|link=http://test{{1x|345}}|odd]] File:Foobar.jpg|link=http://test{{1x|345}}|odd !! html/php

odd

!! html/parsoid

odd