Page MenuHomePhabricator

Media options don't have the whitespace leniency as template arguments
Open, MediumPublic

Description

One of the notes I added to Help:Images: "If there is a space character between alt and the equals sign, the alt statement will be treated as a caption." This behavior is contrary to how editors are used to working with template parameters. Yes, I know that images are not templates, but it is difficult to manage this inconsistent behavior, and there does not appear to be a good design reason for treating these spaces as syntactically meaningful while (for example) stripping out spaces after the equals sign.

You can see this alt= versus alt = behavior here: https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox3&oldid=935129500

This comes from pattern matching,

{
                "name": "img_alt",
                "aliases": [
                    "alt=$1"
                ],
                "case-sensitive": ""
},

https://github.com/wikimedia/parsoid/blob/master/baseconfig/enwiki.json#L1158