Page MenuHomePhabricator

Support an inline option for images to generate <span> wrappers instead of <div> when using extended image syntax
Open, Needs TriagePublic


What is requested ?

A means to place a fully styled or optioned [[File:]] inside a SPAN based element without the generated HTML breaking structuring conventions.

What is the problem you are trying or wanting to solve?

Currently when using mediawiki File: syntax to center an image using the |center option and when adding a border with the |frame or |thumb options, a series of container DIV's are generated in which to center the image and on which to add the relevant borders. For most use cases this is more than acceptable.

However in certain instances, The image (and file Syntax ) may occur inside what is semantically a SPAN based element, such as here :- where the nominal [[File:]] is nested inside a template that uses a SPAN element, to avoid breaking the flow of a paragraph.

If no additional options are specified for the file (other than a width), then a simple <IMG> tag is generated in the HTML, which can reasonably be placed inside the SPAN element that a template (in the example {{dropinitial}} ) creates. However if additional options such as |center are specified then a wrapper DIV is generated by mediawiki, which leads to bad structuring according to HTML conventions, as a DIV cannot be placed inside a span.

How could the feature be implemented, or a solution be provided.?

By generating classed SPAN's (classed as "display:block" or "display:inline-block") instead of classed DIV's for the wrapper containers, based on an |inline option in addition to the existing |frame and |thumb options.

English Wikisource implements a template : which is in part intended to address some of the limitations of using [[File:]] syntax: directly. The approach this template uses should ideally be part of the image syntax so that it's one |inline option as opposed to writing indvidual and lengthy template calls for common uses cases such as centering a simple image within a parent span, (in this instance the Dropinital's container SPAN.) do not need extensive and costly template invocations.

It is also possible to do a "float: center" (which isn't defined in CSS) within a nominal "display block:SPAN" with a pusedo float as noted in the discussion on English Wikisource here : - which seems to have a similar visual effect when using {{FIS}} on English Wikisource as using the |center option with a [[File:]] generate a block (ie DIV) wrapped image. ( However that approach uses a CSS3 feature calc, which may not be compatible with older browsers. )

Event Timeline

Aklapper changed the task status from Open to Stalled.Jul 11 2019, 1:13 PM

This task lacks information / a use case which problem would be solved by this.
Please follow when creating tasks and always provide: 1) a list of clear steps to reproduce a problem, 2) expected outcome, and 3) actual outcome. Thanks!

Aklapper renamed this task from Feature Request: Support an inline option for images to generate SPAN wrappers instead of DIV when using extended image syntax. to Support an inline option for images to generate <span> wrappers instead of <div> when using extended image syntax.Jul 11 2019, 2:49 PM
Aklapper changed the task status from Stalled to Open.
Aklapper added a project: MediaWiki-Parser.