Page MenuHomePhabricator

VE: allow to edit template which contain references list
Open, Needs TriagePublic

Description

Currently, if you click on a template wich generates a reference list, you’re seeing this message:
“This reference list is generated by a template, and for now can only be edited in source mode.”

Even if T54750 would be fixed, you might want to edit template parameters which are defined in its templateData.

I do not understand why that isn’t permitted.

Event Timeline

Pols12 created this task.Jan 11 2020, 4:50 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 11 2020, 4:50 PM
JTannerWMF moved this task from To Triage to Freezer on the VisualEditor board.Jan 14 2020, 4:26 PM
JTannerWMF added a subscriber: JTannerWMF.

At this time this is out of scope for what the team is working on. Thank for filing the ticket, we have taken a note of this challenge for the future.

Edit has been prevented with 495d9420f0db to let the ref list automatically update. I still think it could be edited as a standard template.

I'd like to elaborate a little on why this is difficult to do.

It's a limitation of our internal data structures. A piece of content can't be both a template and something else at the same time. Or in other words, when something is generated by a template, VisualEditor doesn't know what's inside of it. It doesn't recognize whether it generated a link, a table, a references list, or whatever else – it's just a template for us.

So in most cases, we just treat those things as templates, as that's usually more useful for editors. For references lists I guess we really wanted them to reflect changes to the individual references, even when generated by a template, so we try to detect some simple cases and pretend they are actual references lists and not templates. But in general, this is a risky approach, since if that content was edited, saving the page would result in the template being "substituted" when that part of the page is edited (not exactly, but the effect is similar) – this is why we had to make it impossible to edit the references lists, and any bugs in that code cause ugly page corruption (T209493).

It's not entirely impossible to handle template-generated things better (for example, templates that generate table cells "know" that they are table cells, otherwise table rendering would be very broken). But it's difficult, it has to be implemented separately for each type of content, and most of all it fails when a template generates multiple things (e.g. imagine a template generating a references list inside of a table cell).

And to make everything even worse, there are similar limitations in Parsoid, which means that in some cases VisualEditor actually can't detect what exactly was generated by the template (e.g. T150612).

I hope that we will be able to improve this some day, but I don't think we'll have time to work on it anytime soon.

Many thanks for your detailed explanation! =)