Page MenuHomePhabricator

Hovercards: Use a link interpreter instead of title attribute
Closed, ResolvedPublic

Description

Currently Hovercards just takes the title attribute and uses that value as the article that it wants to preview.

This does not handle many types of links, nor is not very reliable in combination with image links.

Hovering an image like: [[File:S can.gif|18px|link=Cancer (astrology)|Cancer]] Will show you the article 'Cancer' instead of 'Cancer (astrology)' for instance, because inline images set their link title attribute to the caption.

A link interpreter is also much more flexible and would be able to identify, different types of links.


Version: master
Severity: enhancement

Details

Reference
bz67466

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:30 AM
bzimport added a project: Page-Previews.
bzimport set Reference to bz67466.
bzimport added a subscriber: Unknown Object (MLST).

@ssastry I assume this is something Parsoid solves? If we used Parsoid as the main parser would this be given for free?

@ssastry I assume this is something Parsoid solves? If we used Parsoid as the main parser would this be given for free?

I don't fully understand how hovercards work, but from the description, it looks like it relies on the title attribute? Right now, Parsoid doesn't set the title attribute for images.

But, the description / title also says "link intepreter" and I don't know what that means either.

So, need more specifics about what hovercards needs to function properly and we can talk more if Parsoid can support that out of the box.

So my interpretation of this is:
Hovercards hijacks wiki links and gives a preview of the pages they refer to to save clicks to them.
To obtain the title of the page associated with the wiki link it relies on the title attribute, which is sometimes accurate.
My question is, does Parsoid mark up links so that it is clear which page title they relate to?

To obtain the title of the page associated with the wiki link it relies on the title attribute, which is sometimes accurate.

Wrong. It has been relying on href since https://gerrit.wikimedia.org/r/199694.

Thanks for the clarification @Ricordisamoa but still href is not ideal. Can you update the title/description accordingly?

Thanks for the clarification @Ricordisamoa but still href is not ideal. Can you update the title/description accordingly?

I'm not aware of any steps that could be made to improve the status quo without needing Parsoid (which would be very bad for small wikis) or T40598.
And after all, the current mechanism is kind of a link interpreter already.

I'm not aware of any steps that could be made to improve the status quo without needing Parsoid

BTW, according to spec, Parsoid does nothing to make parsing the title easier, in fact here's what VisualEditor does:
https://github.com/wikimedia/mediawiki-extensions-VisualEditor/blob/867c63e9b235968f2a9f92c75b483b719b222609/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js#L92