Page MenuHomePhabricator

Proposed spec for Parsoid's gallery implementation

Authored By
Arlolra
Jan 27 2016, 1:23 AM
Size
3 KB
Referenced Files
None
Subscribers
None

Proposed spec for Parsoid's gallery implementation

<!--
Working off: https://github.com/wikimedia/mediawiki/blob/master/includes/parser/Parser.php#L5300-L5312
Params to support (on the extension tag): showfilename, caption, mode, widths, heights, perrow
Content is explode by: \n
A line should match: "/^([^|]+)(\\|(.*))?$/"
If a '%' is found, rawurldecode?
Title is before the first | and needs a namespace: NS_FILE
TODO: Mainly the "mode"s, and their interaction with "widths", "heights", and "perrow".
-->
<gallery caption="Foo [[Main Page]]">
[[x|xx]]]]
File:Nonexistent.jpg|caption
Image:foobar.jpg|some '''caption''' [[Main Page]]
foobar.jpg
Image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
Image:foobar.jpg|link=Main_Page
</gallery>
<gallery showfilename="">
File:Foobar.jpg
Image:Foobar.jpg|some '''caption''' [[Main Page]]
</gallery>
<!-- Renders as -->
<div typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"caption":"Foo [[Main Page]]"},"body":{}}'>
<div class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div>
<!--[[x|xx]]]]-->
<figure class="mw-default-size mw-halign-none" typeof="mw:Error mw:Image/Thumb" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="220" width="220"/></a><figcaption>caption</figcaption></figure>
<figure class="mw-default-size mw-halign-none" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
<figure class="mw-default-size mw-halign-none" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure>
<figure class="mw-default-size mw-halign-none" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>blabla.</figcaption></figure>
<figure class="mw-default-size mw-halign-none" typeof="mw:Image/Thumb"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure>
</div>
<div typeof="mw:Extension/gallery" about="#mwt4" data-parsoid='{}' data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
<figure class="mw-default-size mw-halign-none" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><span class="showfilename"><a href="./File:Foobar.jpg">File:Foobar.jpg</a><br/></span></figcaption></figure>
<figure class="mw-default-size mw-halign-none" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><span class="showfilename"><a href="./File:Foobar.jpg">File:Foobar.jpg</a><br/></span>some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
</div>

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3291576
Default Alt Text
Proposed spec for Parsoid's gallery implementation (3 KB)

Event Timeline