Images: Presence of template-generated link wikitext in alt (and maybe other) attributes of images leads to incorrect HTML for the image
OpenPublic

Description

en.wp user User:Timwi reports

"On the page [[Earth]], we had the following markup code:

[[File:(filename)|thumb|700px|center| (caption here) |alt= (alt text here) ]]

The VisualEditor parsed this incorrectly and assumed that “alt= (alt text here)” was the ''caption''.

Changing the order of the items fixed this despite having no effect on the rendered page, which indicates that it’s a bug in VisualEditor and not incorrect MediaWiki markup." http://en.wikipedia.org/w/index.php?title=Earth&diff=566614668&oldid=566595613

I've done some testing in my sandbox and it seems like the issue is somehow related to the presence of the {{val}} template. I wasn't able to replicate the bug with the {{small}} or {{convert}} templates for example, but I've not done extensive testing with the latter or with any other template.

https://en.wikipedia.org/w/index.php?title=User:Thryduulf/sandbox&oldid=566618437&veaction=edit


Version: unspecified
Severity: normal
URL: http://parsoid-lb.eqiad.wikimedia.org/enwiki/User:Thryduulf/sandbox?oldid=566618437

bzimport added a project: Parsoid.Via ConduitNov 22 2014, 2:08 AM
bzimport set Reference to bz52341.
Thryduulf created this task.Via LegacyJul 31 2013, 7:57 PM
ssastry added a comment.Via ConduitJul 24 2014, 9:08 PM

Verified fixed in deployed Parsoid version.

ssastry added a comment.Via ConduitJul 24 2014, 9:13 PM

Never mind. My eyes deceived me. The following snippet still parses incorrectly.

[[File:Solar Life Cycle.svg|thumb|700px|center|The life cycle of the Sun|alt=14 billion year timeline showing Sun's present age at {{val|4.6|ul=byr}}; from {{val|6|u=byr}} Sun gradually warming, becoming a red dwarf at, "soon" followed by its transformation into a white dwarf star]]

ssastry added a comment.Via WebTue, Feb 3, 10:49 PM

The problem seems to be with the link that the val template emits and Parsoid is somehow barfing on it. Can be reproduced with the following reduced test case:

[[File:Foo.jpg|thumb|Caption here|alt=This {{echo|[[will]]}} break]]

Compare with output of

[[File:Foo.jpg|thumb|Caption here|alt=This {{echo|will not}} break]]
ssastry changed the title from "Images: alt text instead becomes the caption if it is last and contains the {{val}} template" to "Images: Presence of link wikitext in alt (and maybe other) attributes of images leads to incorrect HTML for the image".Via WebTue, Feb 3, 10:50 PM
ssastry set Security to None.
ssastry moved this task to VE Q3 on the Parsoid workboard.
Jdforrester-WMF moved this task to Dependencies on the § VisualEditor Q3 Blockers workboard.Via WebTue, Feb 10, 7:43 PM
Jdforrester-WMF set Story Points to 0.Via WebTue, Feb 10, 8:31 PM
cscott added a subscriber: cscott.Via WebWed, Feb 11, 5:09 PM
cscott changed the title from "Images: Presence of link wikitext in alt (and maybe other) attributes of images leads to incorrect HTML for the image" to "Images: Presence of template-generated link wikitext in alt (and maybe other) attributes of images leads to incorrect HTML for the image".Via WebThu, Feb 19, 6:06 PM

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.