!! 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
Foo bar File:Bad.jpg Bar foo
!! html/parsoidFoo bar File:Bad.jpg Bar foo
!! end !! test Bad images - manualthumb !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb=Bad.jpg|Uh oh]] !! html/php !! end !! test Bad images - in gallery !! config wgParserEnableLegacyMediaDOM=false !! wikitext!! html/parsoid
!! end !! test Unlinked media in gallery !! config wgParserEnableLegacyMediaDOM=false !! wikitext
stuff
[[]]
!! end !! test Image with link trail !! config wgParserEnableLegacyMediaDOM=false !! wikitext Linktrails should not work for images: [[File:Foobar.jpg]]s !! html/phpLinktrails should not work for images: s
!! html/parsoidLinktrails 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 !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! 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/php123
456 123
456
!! html/parsoid123
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 !! html/parsoid !! end !! test Image with multiple widths -- use last !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|200px|300px|caption]] !! html/php !! html/parsoid !! end !! test Image with multiple alignments -- use first (T50664) !! options thumbsize=220 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb|left|right|center|caption]] [[File:Foobar.jpg|middle|text-top|caption]] !! html/php !! html/parsoid !! 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 !! html/parsoid !! end # a sad bit of backward-compatibility !! test Image with size specified with pxpx (T15500, T53628) !! options parsoid=wt2html,wt2wt,html2html !! config wgParserEnableLegacyMediaDOM=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 !! html/parsoid !! 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|!! 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 !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! end !! test Manually-specified thumbnail image !! options thumbsize=220 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumbnail=Thumb.png|Title]] !! html/php !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! end !! test Ampersand in alt attribute (T206940) !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|alt=&]]
caption
caption
caption1
caption2
caption
Image:test !! wikitext [[:Image:test]] !! html/php
!! html/parsoid !! end !! test T20784 Link to non-existent image page with caption should use caption as link text !! wikitext [[:Image:test|caption]] !! html/php !! html/parsoid !! end !! test Frameless image caption with a free URL !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|http://example.com]] !! html/php !! html/parsoid !! end !! test Thumbnail image caption with a free URL !! options thumbsize=220 !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb|http://example.com]] !! html/php !! html/parsoid !! end !! test Thumbnail image caption with a free URL and explicit alt !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]] !! html/php !! html/parsoid !! end !! test SVG thumbnails with no language set !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.svg|thumb|caption]] !! html/php !! html/parsoid !! end !! test SVG thumbnails with language de !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.svg|lang=de|thumb|caption]] !! html/php !! html/parsoid !! end !! test SVG thumbnails with invalid language code !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]] !! html/php !! html/parsoid !! 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 !! html/parsoid !! end !! test T3887: A RFC with a thumbnail !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb|This is RFC 12354]] !! html/php !! html/parsoid !! end !! test T3887: A mailto link with a thumbnail !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]] !! html/php !! html/parsoid !! end # Pending resolution to T2368 !! test T2648: Frameless image caption with a link !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|text with a [[link]] in it]] !! html/php !! html/parsoid !! end !! test T2648: Frameless image caption with a link (suffix) !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|text with a [[link]]foo in it]] !! html/php !! html/parsoid !! end !! test T2648: Frameless image caption with an interwiki link !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]] !! html/php !! html/parsoid !! end !! test T2648: Frameless image caption with a piped interwiki link !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]] !! html/php !! html/parsoid !! end !! test T107474: Frameless image caption with[[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 !! html/parsoid !! end !! test Image: caption containing a newline !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|This *is some text]] !! html/php !! html/parsoid !!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 !! html/parsoid !!end # html/php output not have newlines after table, td, th, etc. because # Linker::makeThumbLink2() replaces the newlines with spaces since # the table is inside a caption. # FIXME: Verify if that circa 2004 fix is still required. !! test Image: caption containing a table !! options parsoid=wt2html,wt2wt,html2html !! config wgParserEnableLegacyMediaDOM=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 !! html/parsoid !! 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 !! html/parsoid !! end !! test Custom class !! options parsoid=wt2html,wt2wt,html2html !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[Image:foobar.jpg|a|class=b]] !! html/php !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! end !! test Localized image handling (3). !! options language=fa parsoid=html2wt !! html/parsoid !! wikitext [[File:Foobar.jpg|بندانگشتی]] !! end !! test "border", "frameless" and "class" attributes on an image. !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|frameless|border|class=extra|caption]] !! html/php !! html/parsoid !! end # Note that 'right' is the default alignment, despite the misspelled 'righ' below !! test Invalid image attributes (T64500) !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! config wgParserEnableLegacyMediaDOM=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 !! html/parsoid !! 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 !! 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 !! html/parsoid !! end # Parsoid-specific testing for images # https://www.mediawiki.org/wiki/Specs/HTML#Images # Currently imperfect due to a flaw in the Parsoid testrunner # Work in progress # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific # image tests. !! test Parsoid-specific image handling - simple image with size and middle alignment !! wikitext [[File:Foobar.jpg|middle|50px]] !! html/parsoid !! end !! test Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias !! options parsoid=wt2wt,wt2html,html2html !! wikitext [[Image:Foobar.jpg|middle|50px]] !! html/parsoid !! end !! test Parsoid-specific image handling - simple image with size and middle alignment (existing content) !! wikitext [[File:Foobar.jpg|50px|middle]] !! html/parsoid !! end !! test Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:Foobar.jpg|50px|middle]] !! html/parsoid !! end !! test Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption !! wikitext [[File:Foobar.jpg|500x10px|baseline|caption]] !! html/parsoid !! end !! test Parsoid-specific image handling - simple image with border and size spec !! wikitext [[File:Foobar.jpg|50px|border|caption]] !! html/parsoid !! end !! test Parsoid-specific image handling - thumbnail with halign, valign, and caption !! options parsoid=wt2html,html2html !! wikitext [[File:Foobar.jpg|left|baseline|thumb|caption content]] !! html/parsoid !! end !! test Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content) !! options parsoid=wt2html,html2html !! wikitext [[File:Foobar.jpg|thumb|left|baseline|caption content]] !! html/parsoid !! end !! test Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption !! options parsoid=wt2html,html2html !! wikitext [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]] !! html/parsoid !! end !! test Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content) !! options parsoid=wt2html,html2html !! wikitext [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]] !! html/parsoid !! end !! test Parsoid-specific image handling - framed image with specific size and caption (size is ignored) !! options parsoid=wt2html,html2html !! wikitext [[File:Foobar.jpg|frame|500x50px|caption]] !! html/parsoid !! end !! test Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored) !! options parsoid=wt2html,html2html !! wikitext [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]] !! html/parsoid !! end !! test Parsoid-specific image handling - frameless image with specific size, border, and caption !! wikitext [[File:Foobar.jpg|frameless|442x50px|border|caption]] !! html/parsoid !! end !! test Parsoid-specific image handling - simple image with a formatted caption !! wikitext [[File:Foobar.jpg|a | b |
c |
foo
bar
!! end !! test Parsoid-specific image handling - empty caption (1) !! options parsoid=wt2html,wt2wt !! wikitext [[File:Foobar.jpg|thumb|]] !! html/parsoid !! end # empty captions don't get serialized unless we're in the "round trip" case !! test Parsoid-specific image handling - empty caption (2) !! options parsoid=html2wt !! html/parsoid !! wikitext [[File:Foobar.jpg|thumb]] !! end !! test Parsoid-specific image handling - whitespace caption !! wikitext [[File:Foobar.jpg|thumb| ]] !! html/parsoid !! end !! test Parsoid-specific image handling - lang option !! config wgParserEnableLegacyMediaDOM=false !! wikitext foo [[File:Foobar.svg|lang=de|caption]] bar !! html/php !! html/parsoid !! end !! test File containing double quotes and spaces !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Cool "Gator".png]] !! html/php !! html/parsoid !! 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/phpFile: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 !! html/parsoid !! 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/phpThis is a test template with parameter
!! html/parsoidThis is a test template with parameter
!! end !! test T3219 URL next to image (good) !! config wgParserEnableLegacyMediaDOM=false !! wikitext http://example.com [[File:Foobar.jpg]] !! html/php !! html/parsoid !!end !! test T3219 URL next to image (broken) !! config wgParserEnableLegacyMediaDOM=false !! wikitext http://example.com[[File:Foobar.jpg]] !! html/php !! html/parsoid !! end !! test Image link to nonexistent file (T3850 - good) !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:No_such.jpg]] !! html/php !! html/parsoid !! end !! test :Image link to nonexistent file (T3850 - bad) !! wikitext [[:Image:No such.jpg]] !! html/php !! html/parsoid !! end !! test Fuzz testing: image with bogus manual thumbnail !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[Image:foobar.jpg|thumbnail= ]] !! html/php !! html/parsoid !! end !! test Gallery with valid attributes !! config wgParserEnableLegacyMediaDOM=false !! wikitextcentre
caption
some caption Main Page
blabla.
caption
ho
Image caption
This is a test template
</ref>
Nonexistent.jpg caption
Foobar.jpg some caption Main Page
caption
foo
foo
hi
ho
This is a test template
File:Contains & ampersand.jpg Title with & ampersand
!! html/parsoidFile: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
|
foo
bar
!! html/parsoidfoo
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/phpfoo
bar
!! html/parsoidfoo
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 !! html/parsoid !! end !! test Image: new attributes should be serialized in wiki's language for RTL languages (T53852) !! options parsoid=html2wt language=ar disabled !! html/parsoid !! wikitext [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]] !! end !! test Image: Block level image should have \n before and after !! wikitext 123 [[File:Foobar.jpg|right|thumb|150x150px]] 456 !! html/parsoid123
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/parsoid123
456
!! end !! test Image: upright option (parsoid) !! wikitext [[File:Foobar.jpg|thumb|upright|caption]] [[File:Foobar.jpg|thumb|upright=0.5|caption]] [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]] !! html/parsoid !! end !! test Image: upright option is ignored on inline and frame images (parsoid) !! wikitext [[File:Foobar.jpg|500x500px|upright=0.5|caption]] !! html/parsoid !! end !! test Image: in template parameter with empty parameter !! wikitext {{1x|[[File:Foobar.jpg|link=]]}} !! html/parsoid!! end !! test Image: from basic HTML (1) !! options parsoid=html2wt !! html/parsoid !! wikitext [[File:Foobar.jpg|link=|alt=Alt|100x100px]] !! end !! test Image: from basic HTML (2) !! options parsoid=html2wt !! html/parsoid !! wikitext [[File:Foobar.jpg|link=|alt=Alt|100x100px]] !! end !! test Image: from basic HTML (3) !! options parsoid=html2wt !! html/parsoid !! wikitext [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]] !! end !! test Image: from basic HTML (4) !! options parsoid=html2wt !! html/parsoid !! wikitext [[File:Foobar.jpg|link=]] !! end !! test Image: Invalid title as link !! config wgParserEnableLegacyMediaDOM=false !! wikitext [[File:Foobar.jpg|link=<]] [[File:Foobar.jpg|link=<|thumb]] !! html/php !! 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 !! 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|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/phptest
456
!! html/parsoidtest
456
!! end !! test Table in figcaption nested in table !! config wgParserEnableLegacyMediaDOM=false !! wikitext {| |foo |[[File:Foobar.jpg|thumb| {| |bar |} ]] |} !! html/phpfoo |
foo |
An alternative text description.
!! html/parsoidAn 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 !! html/parsoid !! 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 !! html/parsoid !! 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 !! html/parsoid !! end ## In contrast with imagemaps !! test Gallery line without file namespace !! config wgParserEnableLegacyMediaDOM=false !! wikitext