Page MenuHomePhabricator

VisualEditor tooltip incorrectly parses names of multiline templates
Closed, ResolvedPublic1 Estimated Story Points

Description

Screen Shot 2017-06-11 at 20.42.34.png (1×2 px, 423 KB)

Screen Shot 2017-06-11 at 20.40.21.png (1×2 px, 454 KB)

Screen Shot 2017-06-11 at 20.40.23.png (1×2 px, 452 KB)

Event Timeline

@FDMS I'm new at this, so it's not clear to me what's going on here. Please can you add to this bug:

  • The specifics steps to reproduce the problem
  • What you would expect to happen
  • What actually happens

Thanks!

  1. Go to any file page that has the default infobox template on it (e.g. File:Berninabahn zwischen Lagalb und Ospizio Bernina im Winter.jpg)
  2. Open VisualEditor on that page
  3. Hover over the infobox template and wait for the template tooltip

Expected behaviour: The template's name, "information", should be displayed.
Actual behaviour: The template's name plus a linebreak are displayed.

Screen Shot 2017-06-12 at 15.23.38.png (1×2 px, 1003 KB)

(This can also be reproduced with Wikipedia infoboxes or any other templates usually occupying more than one source wikitext line.)

matmarex subscribed.

The root cause of this is that mw.Title.newFromText() doesn't accept input containing newlines (which is correct and matches PHP Title::newFromText()), so the template name is not formatted prettily. We should be stripping any leading/trailing newlines before.

Change 359074 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Use Parsoid data for template names rather than detect from wikitext

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

(I discovered T167933 while working on this.)

Deskana moved this task from To Triage to TR1: Releases on the VisualEditor board.
Jdforrester-WMF set the point value for this task to 1.

Change 359074 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Use Parsoid data for template names rather than detect from wikitext

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