Page MenuHomePhabricator

Parsoid should support SVG thumbnails in page language
Open, MediumPublic

Description

This support was added to core in T205040 (I348840ef405e1370cc0c17d69051bce30153c9c0) and needs to be ported to Parsoid. Parsertests for this feature were added to the blacklist in Ic4e77a06638770e7439edcce1572bfe26f5838ad

Event Timeline

cscott created this task.Nov 2 2018, 7:51 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 2 2018, 7:51 PM
Shreyasminocha added a subscriber: Shreyasminocha.

I'll try to work on this.

Shreyasminocha triaged this task as Medium priority.Nov 29 2018, 4:42 PM

Starting points, copied from IRC:

the first step would be to do some research: look at the patch that was landed to enable this support in the core parser (linked from T205040)
figure out what the filenames for the language-specific svg thumbnails look like (there's an example in the phabricator task comments, but you should verify against the code)
then look at the info returned by the imageinfo API request to see if the required information is present
assuming it is, you'd then (1) add code to tokenize/parse the "lang" option (this might already be present)
(2) tweak the parsoid code which does the imageinfo request to pass along the language; hopefully this will return the right thumbnail URLs from core
(3) check that the parsertests for this feature now pass and/or add new tests (or new parsoid-specific test output for existing tests)
on the parsoid side, all the code you'd need to alter should be in lib/mw/ApiRequest.js lib/mw/Batcher.js lib/wt2html/tt/LinkHandler.js and tests/mockAPI.js:
if you don't already know about https://en.wikipedia.org/wiki/Special:ApiSandbox it will probably be very helpful
https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=imageinfo&titles=File%3AAlbert%20Einstein%20Head.jpg&iiprop=url%7Cmediatype%7Cmime%7Csize&iiurlwidth=200
is an example imageinfo request that returns thumbnail urls
so the goal would be to tweak that request (as made by parsoid) to return the proper language-specific thumbnail urls

takidelfin added a subscriber: takidelfin.