Page MenuHomePhabricator

MediaViewer needs mw-parser-output class to display TemplateStyles correctly
Closed, ResolvedPublic

Description

MediaViewer captions have no .mw-parser-output class, which means that they only conserve inline styles provided in HTML element and not the TemplateStyles that can be defined on the page.

In the case of some templates, like Template:Legend, that can lead to substandard rendering of the caption. If .mw-parser-output was added, the styles from TemplateStyles declaration would work.

Example:
https://en.wikipedia.org/wiki/Intersex_rights_in_the_United_Kingdom#/media/File:Inclusion_of_sex_characteristics_in_anti-discrimination_law.svg

Event Timeline

FWIW MediaViewer strips most HTML from the description (e.g. the <div>s in the linked example). In general, figuring out a structured way of storing things like legends is a better way forward in my opinion.

Well, in the case here it takes the caption from the page itself, without removing <span> tags. I’d think it’s only natural that any styling defined for them should work in the captions inside MediaViewer, too.

Aklapper triaged this task as Low priority.Jul 14 2022, 9:51 AM

Change 930907 had a related patch set uploaded (by Saint Johann; author: Saint Johann):

[mediawiki/extensions/MultimediaViewer@master] Add mw-parser-output to file captions

https://gerrit.wikimedia.org/r/930907

Change 930907 merged by jenkins-bot:

[mediawiki/extensions/MultimediaViewer@master] Add mw-parser-output to file captions

https://gerrit.wikimedia.org/r/930907

matmarex assigned this task to stjn.
matmarex subscribed.