Page MenuHomePhabricator

VisualEditor: Reference & cite tooltips should show content snippets, instead of generic labels
Closed, ResolvedPublic8 Estimated Story Points

Description

For citation template references we may also want to specify a subset of parameters to show first.
Links and citation mocks:

context-03.png (197×451 px, 26 KB)

1-02.png (180×432 px, 35 KB)

Version: unspecified
Severity: enhancement

Details

Reference
bz69474

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:43 AM
bzimport set Reference to bz69474.
  • Bug 69744 has been marked as a duplicate of this bug. ***

We could list template values in order until we run out of room, but this may not lead to desirable results, for example the first parameter in {{Cite web}} is URL.

A more complex solution would be to come up with a format for defining how to generate the summary of a template and store it in template data, either as a value on the column (summary order):

Field Desc Summary order
url ... null
publisher ... 2
title ... 1
date ... 3
month ... null

A simplified version of this would just flag one field as being used in the summary.

etc.

Or as a string concatenation message somewhere:

"{{{title}}}, {{{publisher}}} - {{{date}}}"

I think we'd much rather keep the current model of showing the name of something shown, or the value of something not shown (like for HTML comments)…

Any attempt to "parse" the template parameters is going to become very complex or fail to address the needs of wikis other than the English Wikipedia. How about just displaying the parsed content of the reference, stripped of links and any block markup, and limited to some length?

I played with it and the following sort of works for all reference node types. There must be a better way to do it, but I can't find one. (It also doesn't update the tooltip after reference contents are changed, probably because that is done deferred or something.)

ve.ce.MWReferenceNode.static.getDescription = function ( model ) {
  var refModel = ve.dm.MWReferenceModel.static.newFromReferenceNode( model );
  var surface = ve.init.target.createSurface( refModel.getDocument() );
  var text = $( surface.getView().$element ).text();
  surface.destroy();
  return text;
};

(I tried messing around with ve.dm.Converter too, but it seems impossible to render the contents of templated references without involving the surface, probably because they're magically generated in ve.ce.)

(In reply to Bartosz Dziewoński from comment #6)

(I tried messing around with ve.dm.Converter too, but it seems impossible to
render the contents of templated references without involving the surface,
probably because they're magically generated in ve.ce.)

Yeah, this needs CE. I think we may have to rethink how we do descriptions a little.

Jdforrester-WMF lowered the priority of this task from High to Medium.Jan 15 2015, 12:49 AM