Page MenuHomePhabricator

Add Citoid support to RefToolbar gadget
Closed, ResolvedPublic3 Story Points

Description

Since T94223 is probably going to be declined, we should consider more short-term solutions. (The long-term solution is theoretically T104479).

It should be relatively easy to add Citoid support to the RefToolbar gadget. It already supports look-ups for other parameters like DOI and PMID. We should just switch it to use the Citoid public API and add a URL lookup as well.

https://en.wikipedia.org/wiki/Wikipedia:RefToolbar
https://www.mediawiki.org/wiki/Citoid

The code for the RefToolbar lookup API resides at https://github.com/alexz-enwp/reftoolbar/blob/master/lookup.php.

Event Timeline

kaldari created this task.Sep 29 2015, 6:48 PM
kaldari raised the priority of this task from to Needs Triage.
kaldari updated the task description. (Show Details)
kaldari added a project: Community-Tech.
kaldari added a subscriber: kaldari.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 29 2015, 6:48 PM
kaldari updated the task description. (Show Details)Sep 29 2015, 6:50 PM
kaldari set Security to None.
kaldari updated the task description. (Show Details)Oct 1 2015, 9:50 PM
kaldari updated the task description. (Show Details)Oct 1 2015, 10:09 PM

It looks like the output of the Citoid API varies considerably depending on what type of URL is used. For example, if the URL is for a book chapter (http://link.springer.com/chapter/10.1007/11926078_68) it will return the chapter title as "title" and the book title as "bookTitle", but if the URL is for a book (https://books.google.com/books?id=k-XBMNVRfw4C), it will return the book title as "title". So we'll need to be careful to look at the itemType before deciding how to map the values.

FWIW, it seems that Mr.Z-Man (Alex) has possibly retired from Wikipedia. He hasn't edited any projects or touched any of his tools in GitHub for the past couple months. If someone wanted to work on this, they might have to folk the code.

Blahma added a subscriber: Blahma.Oct 16 2015, 9:10 PM
Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptNov 17 2015, 1:54 PM
DannyH moved this task from Product backlog to Design backlog on the Community-Tech board.
kaldari closed this task as Resolved.Dec 13 2015, 7:03 PM
kaldari claimed this task.

Went ahead and did this over the weekend.

kaldari added a project: Community-Tech-Sprint.
kaldari moved this task from Ready to Q3 2018-19 on the Community-Tech-Sprint board.
DannyH edited a custom field.
DannyH edited a custom field.
DannyH added a project: Community-Tech-fixes.

In the editor, I lookup a DOI and get no result (10.1109/ase.2011.6100176)

In the console, I see that the AJAX Call is made to reftoolbar, and it returns nothing:
https://tools.wmflabs.org/reftoolbar/lookup.php?doi=10.1109%2FASE.2011.6100176&template=journal&format=ref

On the contrary, a call to the citation API would return the correct result:
https://en.wikipedia.org/api/rest_v1/data/citation/zotero/10.1109%2fASE.2011.6100076

How to use the right URL is the editor gadget?

Mvolz added a subscriber: Mvolz.Oct 19 2018, 8:43 PM

I believe you have to use the "URL" field for citoid results in reftoolbar.
I'm not sure who is running the reftoolbar labs instance but maybe it's
broken. Putting the doi in the URL field should work for the time being.

Probably there should be a separate bug filed for the doi field issue.

Thanks for your answer. We make progress.

There is a difference depending on the editor:

Yet, it does not work in the Visual Editor, because of an encoding problem, see T207518

RefToolbar queries Citoid only for ISBN and URL queries, see https://github.com/alexz-enwp/reftoolbar/blob/master/lookup.php#L328

This pull-request proposes that RefToolbar also uses Citoid for DOI calls: https://github.com/alexz-enwp/reftoolbar/pull/1

Mvolz added a comment.Oct 21 2018, 2:06 PM

Yes, you have to put the DOI in the URL field if you want a response from
citoid - a bit confusing. Plausibly we should enable citoid for the DOI
field as well.