Images: New images get a link=… set whether or not they need it
Closed, ResolvedPublic

Description

Follow-on from bug 49596.

The insertion of a new image adds link=… whether or not it's been actively set away from the default.

Thus (in the example in bug 49596 comment 0) we get:

[[File:CV.03326.jpg|link=https://commons.wikimedia.org/wiki/File:CV.03326.jpg|right|framed|424x275px]]

… instead of:

[[File:CV.03326.jpg|right|framed|424x275px]]

… which is bad in terms of wikitext-user utility.


Version: unspecified
Severity: minor

bzimport added a project: Parsoid.Via ConduitNov 22 2014, 2:09 AM
bzimport set Reference to bz49844.
Jdforrester-WMF created this task.Via LegacyJun 19 2013, 10:45 PM
Esanders added a comment.Via ConduitJun 21 2013, 11:56 AM

This looks like a Parsoid issue:

Esanders added a comment.Via ConduitJun 21 2013, 11:57 AM

<span typeof="mw:Image" ><a href="./File:VisualEditor-logo.svg" data-parsoid="{'a':{'href':'./File:VisualEditor-logo.svg'}}"><img src="http://vewiki/MediaWiki/images/thumb/1/12/VisualEditor-logo.svg/300px-VisualEditor-logo.svg.png" resource="./File:VisualEditor-logo.svg" width="300" height="105"></a></span>

serialises to:

[[File:VisualEditor-logo.svg|300x105px]]

Whereas

<span typeof="mw:Image" ><a href="./File:VisualEditor-logo.svg"><img src="http://vewiki/MediaWiki/images/thumb/1/12/VisualEditor-logo.svg/300px-VisualEditor-logo.svg.png" resource="./File:VisualEditor-logo.svg" width="300" height="105"></a></span>

(removed data-parsoid from <a> tag)

serialises to:

[[File:VisualEditor-logo.svg|link=File:VisualEditor-logo.svg|300x105px]]

gerritbot added a comment.Via ConduitJun 25 2013, 10:09 PM

Related URL: https://gerrit.wikimedia.org/r/70551 (Gerrit Change I75dbbfdd248a6f5696252ef3a2d7ca6ede0fa156)

Jdforrester-WMF added a comment.Via ConduitJun 26 2013, 2:43 AM
  • Bug 49848 has been marked as a duplicate of this bug. ***
Jdforrester-WMF added a comment.Via ConduitJun 26 2013, 2:44 AM

This is worked around (albeit with potentially a bit of a hack) in VisualEditor, so not so important now from VisualEditor's POV.

Aklapper added a comment.Via ConduitJul 4 2013, 10:33 AM

[Parsoid component reorg by merging JS/General and General. See bug 50685 for more information. Filter bugmail on this comment. parsoidreorg20130704]

ssastry added a comment.Via ConduitNov 22 2013, 12:56 AM

I cannot reproduce this on latest master.

[subbu@earth lib] cat /tmp/img.html
<span typeof="mw:Image" ><a href="./File:VisualEditor-logo.svg"><img src="http://vewiki/MediaWiki/images/thumb/1/12/VisualEditor-logo.svg/300px-VisualEditor-logo.svg.png" resource="./File:VisualEditor-logo.svg" width="300" height="105"></a></span>
[subbu@earth lib] node parse --html2wt < /tmp/img.html
[[File:VisualEditor-logo.svg|300x300px]]

cscott added a comment.Via ConduitDec 23 2013, 3:07 PM

This should be fixed by https://gerrit.wikimedia.org/r/103082 (if it wasn't already fixed). Should be verified fixed by the VE team once this lands (and their local workaround reverted?).

cscott added a comment.Via ConduitFeb 19 2014, 10:07 PM

This bug is fixed; opened bug 61560 for the VE team to revert their workaround hack.

cscott added a comment.Via ConduitMar 17 2014, 3:54 PM

Hm, maybe this only occurs with images from commons now? Can you confirm that, James? It would be helpful to see exactly what VE is giving to Parsoid for new images, and how you are indicating that the link is the default.

cscott added a comment.Via ConduitMar 17 2014, 4:04 PM

Hm, I note that the DOM spec describes "resource attribute on image" this way:

link to image resource page. TODO: what to use for images from commons?

I'm guessing this is the root of the problem. What is VE currently setting the resource attribute to, for images from commons?

cscott added a comment.Via ConduitMar 17 2014, 5:30 PM

Ok, from looking at the code I can confirm that the link= attribute should be suppressed iff the img[resource] attribute is equal to the a[href]. I'm guessing that autocommons is screwing with this?

cscott added a comment.Via ConduitMar 17 2014, 6:20 PM

mooeypoo and I tried to reproduce without success. the code looks correct: the link option is suppressed iff a[href] == img[resource]. Both of these should be local relative URLs, since the only way external images can be referenced is via instacommons (which provides local URLs for the image).

cscott added a comment.Via ConduitMar 17 2014, 6:36 PM
gerritbot added a comment.Via ConduitMar 17 2014, 6:39 PM

Change 119087 had a related patch set uploaded by Cscott:
Clarified the default link for image insertion.

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

gerritbot added a comment.Via ConduitMar 17 2014, 6:45 PM

Change 119087 merged by jenkins-bot:
Clarified the default link for image insertion.

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

Add Comment